Interface IAjaxCallListener
-
- All Known Implementing Classes:
AjaxCallListener,CancelEventIfAjaxListener
public interface IAjaxCallListenerInterface used to listen at the most important points when Wicket performs an Ajax callback.Each method can return JavaScript that will be used as a body of a function that is executed at the appropriate time. If the method returns
nullor an empty string then it is ignored and no function will be executed for this listener. Each JavaScript function receives arguments in the exact order as specified in the method's javadoc.Ajax call listeners are potential contributors to the page header by implementing
IComponentAwareHeaderContributor. E.g. the JavaScript used by the listener may depend on some JavaScript library, by implementingIComponentAwareHeaderContributorinterface they can assure it will be loaded.- Since:
- 6.0
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default java.lang.CharSequencegetAfterHandler(Component component)The JavaScript that will be executed after the Ajax call.default java.lang.CharSequencegetBeforeHandler(Component component)The JavaScript that will be executed before the Ajax call, as early as possible.default java.lang.CharSequencegetBeforeSendHandler(Component component)The JavaScript that will be executed right before the execution of the the Ajax call, only if all preconditions pass.default java.lang.CharSequencegetCompleteHandler(Component component)The JavaScript that will be executed after both successful and unsuccessful return of the Ajax call.default java.lang.CharSequencegetDoneHandler(Component component)The JavaScript that will be executed after the Ajax call is done, regardless whether it was sent or not.default java.lang.CharSequencegetFailureHandler(Component component)The JavaScript that will be executed after unsuccessful return of the Ajax call.default java.lang.CharSequencegetInitHandler(Component component)The JavaScript that will be executed on initialization of the Ajax call, immediately after the causing event.default java.lang.CharSequencegetPrecondition(Component component)A JavaScript function that is invoked before the request is being executed.default java.lang.CharSequencegetSuccessHandler(Component component)The JavaScript that will be executed after successful return of the Ajax call.
-
-
-
Method Detail
-
getInitHandler
default java.lang.CharSequence getInitHandler(Component component)
The JavaScript that will be executed on initialization of the Ajax call, immediately after the causing event. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed on initialization of the Ajax call.
-
getBeforeHandler
default java.lang.CharSequence getBeforeHandler(Component component)
The JavaScript that will be executed before the Ajax call, as early as possible. Even before the preconditions. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed before the Ajax call.
-
getPrecondition
default java.lang.CharSequence getPrecondition(Component component)
A JavaScript function that is invoked before the request is being executed. If it returnsfalsethen the execution of the Ajax call will be cancelled. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that should be used to decide whether the Ajax call should be made at all.
-
getBeforeSendHandler
default java.lang.CharSequence getBeforeSendHandler(Component component)
The JavaScript that will be executed right before the execution of the the Ajax call, only if all preconditions pass. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- jqXHR - the jQuery XMLHttpRequest object
- settings - the settings used for the jQuery.ajax() call
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed before the Ajax call.
-
getAfterHandler
default java.lang.CharSequence getAfterHandler(Component component)
The JavaScript that will be executed after the Ajax call. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
AjaxRequestAttributes.setAsynchronous(boolean)) then this JavaScript will be executed after the complete handler, otherwise it is executed right after the execution of the Ajax request.- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed after the start of the Ajax call but before its response is returned.
-
getSuccessHandler
default java.lang.CharSequence getSuccessHandler(Component component)
The JavaScript that will be executed after successful return of the Ajax call. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- jqXHR - the jQuery XMLHttpRequest object
- data - the Ajax response. Its type depends on
AjaxRequestAttributes.dataType - textStatus - the status as text
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed after a successful return of the Ajax call.
-
getFailureHandler
default java.lang.CharSequence getFailureHandler(Component component)
The JavaScript that will be executed after unsuccessful return of the Ajax call. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- jqXHR - the jQuery XMLHttpRequest object
- errorMessage - in case of HTTP error the textual portion of the HTTP status
- textStatus - type of failure: null, "timeout", "error", "abort" or "parsererror"
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed after a unsuccessful return of the Ajax call.
-
getCompleteHandler
default java.lang.CharSequence getCompleteHandler(Component component)
The JavaScript that will be executed after both successful and unsuccessful return of the Ajax call. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- jqXHR - the jQuery XMLHttpRequest object
- textStatus - the status as text
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed after both successful and unsuccessful return of the Ajax call.
-
getDoneHandler
default java.lang.CharSequence getDoneHandler(Component component)
The JavaScript that will be executed after the Ajax call is done, regardless whether it was sent or not. The script will be executed in a function that receives the following parameters:- attrs - the AjaxRequestAttributes as JSON
- Parameters:
component- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed after the Ajax call is done.
-
-