wicket.ajax.calldecorator
Class AjaxCallThrottlingDecorator

java.lang.Object
  extended by wicket.ajax.calldecorator.AjaxPostprocessingCallDecorator
      extended by wicket.ajax.calldecorator.AjaxCallThrottlingDecorator
All Implemented Interfaces:
java.io.Serializable, IAjaxCallDecorator

public final class AjaxCallThrottlingDecorator
extends AjaxPostprocessingCallDecorator

Adds throttling to the ajax call. Throttled behaviors only execute once within the given delay even though they can be triggered multiple times.

For example, this is useful when attaching an event behavior to the onkeypress event. It is not desirable to have an ajax call made every time the user types so we can throttle that call to a desirable delay, such as once per second. This gives us a near real time ability to provide feedback without overloading the server.

Since:
1.2
Author:
Igor Vaynberg (ivaynberg)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface wicket.ajax.IAjaxCallDecorator
WICKET_CALL_RESULT_VAR
 
Constructor Summary
AjaxCallThrottlingDecorator(IAjaxCallDecorator decorator, java.lang.String id, Duration delay)
          Construct.
AjaxCallThrottlingDecorator(java.lang.String id, Duration delay)
          Construct.
 
Method Summary
 java.lang.CharSequence postDecorateScript(java.lang.CharSequence script)
          Decorates ajax call script
 
Methods inherited from class wicket.ajax.calldecorator.AjaxPostprocessingCallDecorator
decorateOnFailureScript, decorateOnSuccessScript, decorateScript, postDecorateOnFailureScript, postDecorateOnSuccessScript
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxCallThrottlingDecorator

public AjaxCallThrottlingDecorator(java.lang.String id,
                                   Duration delay)
Construct.

Parameters:
id - throttle id
delay - throttle delay

AjaxCallThrottlingDecorator

public AjaxCallThrottlingDecorator(IAjaxCallDecorator decorator,
                                   java.lang.String id,
                                   Duration delay)
Construct.

Parameters:
decorator - wrapped decorator
id - throttle id
delay - throttle delay
Method Detail

postDecorateScript

public final java.lang.CharSequence postDecorateScript(java.lang.CharSequence script)
Description copied from class: AjaxPostprocessingCallDecorator
Decorates ajax call script

Overrides:
postDecorateScript in class AjaxPostprocessingCallDecorator
Returns:
decorated script
See Also:
AjaxPostprocessingCallDecorator.postDecorateScript(CharSequence)


Copyright © 2004-2007 Wicket developers. All Rights Reserved.