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 Details

  • 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:
      1. attrs - the AjaxRequestAttributes as JSON
      Specified by:
      getBeforeHandler in interface IAjaxCallListener
      Overrides:
      getBeforeHandler in class AjaxCallListener
      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:
      1. attrs - the AjaxRequestAttributes as JSON
      2. jqXHR - the jQuery XMLHttpRequest object
      3. textStatus - the status as text
      Specified by:
      getCompleteHandler in interface IAjaxCallListener
      Overrides:
      getCompleteHandler in class AjaxCallListener
      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:
      1. attrs - the AjaxRequestAttributes as JSON
      2. jqXHR - the jQuery XMLHttpRequest object
      3. errorMessage - in case of HTTP error the textual portion of the HTTP status
      4. textStatus - type of failure: null, "timeout", "error", "abort" or "parsererror"
      Specified by:
      getFailureHandler in interface IAjaxCallListener
      Overrides:
      getFailureHandler in class AjaxCallListener
      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'.