org.apache.wicket.ajax.attributes
Interface IAjaxCallListener

All Known Implementing Classes:
AjaxCallListener, CancelEventIfAjaxListener

public interface IAjaxCallListener

Interface used to listen at the most important points when Wicket performs an Ajax callback.
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 implementing IComponentAwareHeaderContributor interface they can assure it will be loaded.

Since:
6.0

Method Summary
 CharSequence getAfterHandler(Component component)
          The JavaScript that will be executed after the Ajax call.
 CharSequence getBeforeHandler(Component component)
          The JavaScript that will be executed before the Ajax call, as early as possible.
 CharSequence getBeforeSendHandler(Component component)
          The JavaScript that will be executed right before make of the the Ajax call, only if all preconditions pass.
 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.
 CharSequence getPrecondition(Component component)
          A JavaScript function that is invoked before the request executes.
 CharSequence getSuccessHandler(Component component)
          The JavaScript that will be executed after successful return of the Ajax call.
 

Method Detail

getSuccessHandler

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:
  1. data - the Ajax response. Its type depends on AjaxRequestAttributes.dataType
  2. textStatus - the status as text
  3. jqXHR - the jQuery XMLHttpRequest object
  4. attrs - the AjaxRequestAttributes as JSON

Parameters:
component - the Component with the Ajax behavior
Returns:
the JavaScript that will be executed after a successful return of the Ajax call.

getFailureHandler

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:
  1. attrs - the AjaxRequestAttributes as JSON

Parameters:
component - the Component with the Ajax behavior
Returns:
the JavaScript that will be executed after a unsuccessful return of the Ajax call.

getBeforeHandler

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:
  1. attrs - the AjaxRequestAttributes as JSON

Parameters:
component - the Component with the Ajax behavior
Returns:
the JavaScript that will be executed before the Ajax call.

getBeforeSendHandler

CharSequence getBeforeSendHandler(Component component)
The JavaScript that will be executed right before make of the the Ajax call, only if all preconditions pass. 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. 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

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:
  1. attrs - the AjaxRequestAttributes as JSON

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. Note: if the Ajax call is synchronous (see AjaxRequestAttributes.setAsynchronous(boolean)) then this JavaScript will be executed after the complete handler.

getCompleteHandler

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:
  1. jqXHR - the jQuery XMLHttpRequest object
  2. textStatus - the status as text
  3. attrs - the AjaxRequestAttributes as JSON

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.

getPrecondition

CharSequence getPrecondition(Component component)
A JavaScript function that is invoked before the request executes. If it returns false then the execution of the Ajax call will be cancelled. The script will be executed in a function that receives the following parameters:
  1. attrs - the AjaxRequestAttributes as JSON

Returns:
the JavaScript that should be used to decide whether the Ajax call should be made at all.


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.