Module org.apache.wicket.extensions
Class AjaxDisableComponentListener
java.lang.Object
org.apache.wicket.ajax.attributes.AjaxCallListener
org.apache.wicket.extensions.ajax.AjaxDisableComponentListener
- All Implemented Interfaces:
Serializable
,IAjaxCallListener
,IComponentAwareHeaderContributor
,IClusterable
An
AjaxCallListener
to disable the associated component while the AJAX request is running.
Please note that under the hood this class uses DOM attribute 'disabled' to disable a component,
hence it can be used only with those HTML components that support this attribute.
If you want to use it with other kinds of components you should override generateHandlerJavaScript(org.apache.wicket.Component, boolean)
to generate the proper enable/disable JavaScript.- Author:
- Andrea Del Bene
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
generateHandlerJavaScript
(Component component, boolean disabled) Generate the proper enable/disable JavaScript code for the given component.getBeforeHandler
(Component component) The JavaScript that will be executed before the Ajax call, as early as possible.getCompleteHandler
(Component component) The JavaScript that will be executed after both successful and unsuccessful return of the Ajax call.getFailureHandler
(Component component) The JavaScript that will be executed after unsuccessful return of the Ajax call.Methods inherited from class org.apache.wicket.ajax.attributes.AjaxCallListener
getAfterHandler, getBeforeSendHandler, getDoneHandler, getInitHandler, getPrecondition, getSuccessHandler, onAfter, onBefore, onBeforeSend, onComplete, onDone, onFailure, onInit, onPrecondition, onSuccess, renderHead
-
Constructor Details
-
AjaxDisableComponentListener
public AjaxDisableComponentListener()
-
-
Method Details
-
getBeforeHandler
Description copied from interface:IAjaxCallListener
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
- Specified by:
getBeforeHandler
in interfaceIAjaxCallListener
- Overrides:
getBeforeHandler
in classAjaxCallListener
- Parameters:
component
- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed before the Ajax call.
-
getCompleteHandler
Description copied from interface:IAjaxCallListener
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
- Specified by:
getCompleteHandler
in interfaceIAjaxCallListener
- Overrides:
getCompleteHandler
in classAjaxCallListener
- 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.
-
getFailureHandler
Description copied from interface:IAjaxCallListener
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"
- Specified by:
getFailureHandler
in interfaceIAjaxCallListener
- Overrides:
getFailureHandler
in classAjaxCallListener
- Parameters:
component
- the Component with the Ajax behavior- Returns:
- the JavaScript that will be executed after a unsuccessful return of the Ajax call.
-
generateHandlerJavaScript
Generate the proper enable/disable JavaScript code for the given component. By default component is enabled/disabled using DOM attribute 'disabled'.
-