You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Johannes Schneider <ma...@cedarsoft.com> on 2009/08/26 21:15:58 UTC

AjaxLink/Behaviour with shortcut

Hi,

I have here several AjaxLinks that should be triggered using a shortcut
(e.g. PageDown or Delete).
Does anybody have some lines of code or a hint how that could be done?

Alternatively a AjaxBehaviour could be used to start the action.


Any ideas?
Thanks,


Johannes

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxLink/Behaviour with shortcut

Posted by Johannes Schneider <ma...@cedarsoft.com>.
thanks.

danisevsky wrote:
> look at
> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/input-events-parent/
> 
> 2009/8/26 Johannes Schneider <ma...@cedarsoft.com>
> 
>> Hi,
>>
>> I have here several AjaxLinks that should be triggered using a shortcut
>> (e.g. PageDown or Delete).
>> Does anybody have some lines of code or a hint how that could be done?
>>
>> Alternatively a AjaxBehaviour could be used to start the action.
>>
>>
>> Any ideas?
>> Thanks,
>>
>>
>> Johannes
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxLink/Behaviour with shortcut

Posted by Johannes Schneider <ma...@cedarsoft.com>.
Yes, I have seen the example project - thanks for that. Great stuff btw.
Extending "inputevent" class? I don't get it...

One more thing: What about adding some sort of direct ajax callback to
java without having to add a AjaxLink?
In my case I have a delete link that opens a popup. But now I try to add
a shortcut (e.g. ctrl+Delete) that shouldn't ask for confirmation.
I have solved this with a second link that is not visible - but that
seems to be a little bit strange..


Thanks,

Johannes

nino martinez wael wrote:
> Thanks for the feedback, the quick solution would be to extend the
> inputevent class. Did you see the example project?
> 
> 2009/8/28 Johannes Schneider <ma...@cedarsoft.com>:
>> And I think EventType shouldn't be an enum but instead a class with
>> several constants. So everybody could add own event types if necessary.
>>
>>
>> Regards
>>
>> Johannes
>>
>> Johannes Schneider wrote:
>>> I made some progress:
>>>
>>> When using the (newly created) EventType "onclick" the behvious seems to
>>> be improved.
>>>
>>> The first time it works great, but if I add the link to the
>>> AjaxRequestTarget (so that the link is updated), the event is executed
>>> multiple times...
>>>
>>>
>>> Regards,
>>>
>>> Johannes
>>>
>>>
>>> Johannes Schneider wrote:
>>>> That thing works great with normal links. But I have a problem with
>>>> Ajax(Fallback)Links. The created JavaScript looks good but it does not work.
>>>> Since I really don't understand JavaScript I don't have a clue what to
>>>> do next. I have modified the example to reproduce the problem:
>>>>
>>>>
>>>> Add to HomePage.html:
>>>>
>>>>  <hr><a href="#" wicket:id="ajaxLink">Ajax here!</a>
>>>>
>>>>
>>>> Added to HomePage.java:
>>>>
>>>>  AjaxLink<Object> ajaxLink = new AjaxLink<Object>("ajaxLink") {
>>>>       @Override
>>>>       public void onClick( AjaxRequestTarget ajaxRequestTarget ) {
>>>>         System.out.println( "#########" );
>>>>       }
>>>>     };
>>>>
>>>>     ajaxLink.add( new InputBehavior( new KeyType[]{KeyType.n} ) );
>>>>     add( ajaxLink );
>>>>
>>>>
>>>>
>>>> Any ideas?
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Johannes
>>>>
>>>>
>>>> danisevsky wrote:
>>>>> look at
>>>>> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/input-events-parent/
>>>>>
>>>>> 2009/8/26 Johannes Schneider <ma...@cedarsoft.com>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have here several AjaxLinks that should be triggered using a shortcut
>>>>>> (e.g. PageDown or Delete).
>>>>>> Does anybody have some lines of code or a hint how that could be done?
>>>>>>
>>>>>> Alternatively a AjaxBehaviour could be used to start the action.
>>>>>>
>>>>>>
>>>>>> Any ideas?
>>>>>> Thanks,
>>>>>>
>>>>>>
>>>>>> Johannes
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxLink/Behaviour with shortcut

Posted by Johannes Schneider <ma...@cedarsoft.com>.
I made some progress:

When using the (newly created) EventType "onclick" the behvious seems to
be improved.

The first time it works great, but if I add the link to the
AjaxRequestTarget (so that the link is updated), the event is executed
multiple times...


Regards,

Johannes


Johannes Schneider wrote:
> That thing works great with normal links. But I have a problem with
> Ajax(Fallback)Links. The created JavaScript looks good but it does not work.
> Since I really don't understand JavaScript I don't have a clue what to
> do next. I have modified the example to reproduce the problem:
> 
> 
> Add to HomePage.html:
> 
>  <hr><a href="#" wicket:id="ajaxLink">Ajax here!</a>
> 
> 
> Added to HomePage.java:
> 
>  AjaxLink<Object> ajaxLink = new AjaxLink<Object>("ajaxLink") {
>       @Override
>       public void onClick( AjaxRequestTarget ajaxRequestTarget ) {
>         System.out.println( "#########" );
>       }
>     };
> 
>     ajaxLink.add( new InputBehavior( new KeyType[]{KeyType.n} ) );
>     add( ajaxLink );
> 
> 
> 
> Any ideas?
> 
> 
> Thanks,
> 
> Johannes
> 
> 
> danisevsky wrote:
>> look at
>> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/input-events-parent/
>>
>> 2009/8/26 Johannes Schneider <ma...@cedarsoft.com>
>>
>>> Hi,
>>>
>>> I have here several AjaxLinks that should be triggered using a shortcut
>>> (e.g. PageDown or Delete).
>>> Does anybody have some lines of code or a hint how that could be done?
>>>
>>> Alternatively a AjaxBehaviour could be used to start the action.
>>>
>>>
>>> Any ideas?
>>> Thanks,
>>>
>>>
>>> Johannes
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxLink/Behaviour with shortcut

Posted by Johannes Schneider <ma...@cedarsoft.com>.
That thing works great with normal links. But I have a problem with
Ajax(Fallback)Links. The created JavaScript looks good but it does not work.
Since I really don't understand JavaScript I don't have a clue what to
do next. I have modified the example to reproduce the problem:


Add to HomePage.html:

 <hr><a href="#" wicket:id="ajaxLink">Ajax here!</a>


Added to HomePage.java:

 AjaxLink<Object> ajaxLink = new AjaxLink<Object>("ajaxLink") {
      @Override
      public void onClick( AjaxRequestTarget ajaxRequestTarget ) {
        System.out.println( "#########" );
      }
    };

    ajaxLink.add( new InputBehavior( new KeyType[]{KeyType.n} ) );
    add( ajaxLink );



Any ideas?


Thanks,

Johannes


danisevsky wrote:
> look at
> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/input-events-parent/
> 
> 2009/8/26 Johannes Schneider <ma...@cedarsoft.com>
> 
>> Hi,
>>
>> I have here several AjaxLinks that should be triggered using a shortcut
>> (e.g. PageDown or Delete).
>> Does anybody have some lines of code or a hint how that could be done?
>>
>> Alternatively a AjaxBehaviour could be used to start the action.
>>
>>
>> Any ideas?
>> Thanks,
>>
>>
>> Johannes
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: AjaxLink/Behaviour with shortcut

Posted by danisevsky <da...@gmail.com>.
look at
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/input-events-parent/

2009/8/26 Johannes Schneider <ma...@cedarsoft.com>

> Hi,
>
> I have here several AjaxLinks that should be triggered using a shortcut
> (e.g. PageDown or Delete).
> Does anybody have some lines of code or a hint how that could be done?
>
> Alternatively a AjaxBehaviour could be used to start the action.
>
>
> Any ideas?
> Thanks,
>
>
> Johannes
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>