Re: 6.0 Migration issue: wrap Wicket Ajax JS-code as previously with AjaxCallDecorators

2013-02-15 Thread Martin Dietze
On Thu, February 14, 2013, Fred!!! wrote:

 it's possible to set an throtteling delay by Wicket AjaxRequestAttributes. 
 Have a look at 
 https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-AjaxRequestAttributes

 Something like this:
 new AjaxEventBehavior(onkeydown){
void updateAjaxAttributes(AjaxRequestAttributes attr)
{
   attributes.setThrottlingSettings(new ThrottlingSettings(id, 
 delay))
}
 }

That looks good, thank you!

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
Die groessten Liebesgeschichten sind die, die nie stattgefunden haben

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



6.0 Migration issue: wrap Wicket Ajax JS-code as previously with AjaxCallDecorators

2013-02-14 Thread Martin Dietze
In the project I'm currently migrating from Wicket 1.4 to 6.6 I have a few 
pieces
of code where AjaxCallDecorator instances would wrap the Wicket-genrated JS code
as shown in this little example:

| return new AjaxCallDecorator() {
| 
| @Override
| public CharSequence decorateScript( final CharSequence script ) {
| 
|   return var field = findField(); var result = findResult(); //
|   + if (field.val().length  3) { //
|   + renderInvisible() //
|   + } else { //
|   + $.throttle( getTimeout(), new function() {  + script + 
 }); //
|   + };
| }
| };

The problem I'm having here is that `$.throttle()' expects the actual script 
code as
a function, which it then calls according to the set timeout.

To me it seems like this is not possible with the APIs provided by Wicket 6.0, 
since
I can add code to be executed before and after the Wicket-generated code 
respecitvely,
but not *around* it. Maybe I haven't fully understood it and there actually is 
a way
to implement similar functionality?

I am rather unfamiliar with Javascript in general, maybe there's a better and 
easier way to port the above code to Wicket 6.0? 

As always grateful for any hint!

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
Wer bist du, ungezaehltes Frauenzimmer? Du bist - bist du? - Die Leute sagen, 
du waerest - lass sie sagen, sie wissen nicht, wie der Kirchturm steht. 

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



Re: 6.0 Migration issue: wrap Wicket Ajax JS-code as previously with AjaxCallDecorators

2013-02-14 Thread Fred!!!

Hi Martin,

it's possible to set an throtteling delay by Wicket 
AjaxRequestAttributes. Have a look at 
https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax#WicketAjax-AjaxRequestAttributes


Something like this:
new AjaxEventBehavior(onkeydown){
   void updateAjaxAttributes(AjaxRequestAttributes attr)
   {
  attributes.setThrottlingSettings(new ThrottlingSettings(id, 
delay))

   }
}


Greets Fred



Am 14.02.2013 17:54, schrieb Martin Dietze:

In the project I'm currently migrating from Wicket 1.4 to 6.6 I have a few 
pieces
of code where AjaxCallDecorator instances would wrap the Wicket-genrated JS code
as shown in this little example:

| return new AjaxCallDecorator() {
|
| @Override
| public CharSequence decorateScript( final CharSequence script ) {
|
|   return var field = findField(); var result = findResult(); //
|   + if (field.val().length  3) { //
|   + renderInvisible() //
|   + } else { //
|   + $.throttle( getTimeout(), new function() {  + script +  
}); //
|   + };
| }
| };

The problem I'm having here is that `$.throttle()' expects the actual script 
code as
a function, which it then calls according to the set timeout.

To me it seems like this is not possible with the APIs provided by Wicket 6.0, 
since
I can add code to be executed before and after the Wicket-generated code 
respecitvely,
but not *around* it. Maybe I haven't fully understood it and there actually is 
a way
to implement similar functionality?

I am rather unfamiliar with Javascript in general, maybe there's a better and
easier way to port the above code to Wicket 6.0?

As always grateful for any hint!

M'bert




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