package org.apache.wicket.ajax;
The base class for Wicket's default AJAX implementation.
- Author(s):
- Igor Vaynberg (ivaynberg)
- Since:
- 1.2
reference to the default indicator gif file.
reference to the default ajax debug support javascript file.
Subclasses should call super.onBind()
response.renderJavascript("wicketAjaxDebugEnable=true;", "wicket-ajax-debug-enable"); - Returns:
- ajax call decorator used to decorate the call generated by this behavior or null for
none
- Returns:
- javascript that will generate an ajax GET request to this behavior
- Parameters:
onlyTargetActivePage
if true the callback to this behavior will be ignore if the page is not the last
one the user accessed- Returns:
- javascript that will generate an ajax GET request to this behavior *
- Returns:
- an optional javascript expression that determines whether the request will actually
execute (in form of return XXX;);
- Returns:
- javascript that will run when the ajax call finishes with an error status
- Returns:
- javascript that will run when the ajax call finishes successfully
Returns javascript that performs an ajax callback to this behavior. The script is decorated
by the ajax callback decorator from
getAjaxCallDecorator().
- Parameters:
partialCall
Javascript of a partial call to the function performing the actual ajax callback.
Must be in format function(params, with signature
function(params, onSuccessHandler, onFailureHandler. Example: wicketAjaxGet('callbackurl'- Returns:
- script that performs ajax callback to this behavior
CharSequence success = (onSuccessScript == null) ? "" : onSuccessScript;
CharSequence failure = (onFailureScript == null) ? "" : onFailureScript;
String hide = ";wicketHide('" + indicatorId + "');"; success = success + hide;
failure = failure + hide;
if (precondition != null)
buff.append(", function() {"); if (precondition == null)
Finds the markup id of the indicator. The default search order is: component, behavior,
component's parent hieararchy.
- Returns:
- markup id or
null if no indicator found
- Parameters:
target
The AJAX target
Wraps the provided javascript with a throttled block. Throttled behaviors only execute once
within the given delay even though they are 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 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 with ajax calls.
- Parameters:
script
javascript to be throttledthrottleId
the id of the throttle to be used. Usually this should remain constant for the
same javascript block.throttleDelay
time span within which the javascript block will only execute once- Returns:
- wrapped javascript
if (throttleDelay == null)