Class AjaxDisableComponentListener
- java.lang.Object
-
- org.apache.wicket.ajax.attributes.AjaxCallListener
-
- org.apache.wicket.extensions.ajax.AjaxDisableComponentListener
-
- All Implemented Interfaces:
Serializable
,IAjaxCallListener
,IComponentAwareHeaderContributor
,IClusterable
public class AjaxDisableComponentListener extends AjaxCallListener
AnAjaxCallListener
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 overridegenerateHandlerJavaScript(org.apache.wicket.Component, boolean)
to generate the proper enable/disable JavaScript.- Author:
- Andrea Del Bene
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AjaxDisableComponentListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
generateHandlerJavaScript(Component component, boolean disabled)
Generate the proper enable/disable JavaScript code for the given component.CharSequence
getBeforeHandler(Component component)
The JavaScript that will be executed before the Ajax call, as early as possible.CharSequence
getCompleteHandler(Component component)
The JavaScript that will be executed after both successful and unsuccessful return of the Ajax call.CharSequence
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 Detail
-
AjaxDisableComponentListener
public AjaxDisableComponentListener()
-
-
Method Detail
-
getBeforeHandler
public CharSequence getBeforeHandler(Component component)
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
public CharSequence getCompleteHandler(Component component)
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
public CharSequence getFailureHandler(Component component)
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
protected String generateHandlerJavaScript(Component component, boolean disabled)
Generate the proper enable/disable JavaScript code for the given component. By default component is enabled/disabled using DOM attribute 'disabled'.
-
-