Updated Branches: refs/heads/master c0e085692 -> d6a114ef5
reordered methods by the invocation order Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d6a114ef Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d6a114ef Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d6a114ef Branch: refs/heads/master Commit: d6a114ef535ed3280d40b32d3f02a87db6ee3087 Parents: c0e0856 Author: svenmeier <[email protected]> Authored: Thu Dec 13 21:19:50 2012 +0100 Committer: svenmeier <[email protected]> Committed: Thu Dec 13 21:19:50 2012 +0100 ---------------------------------------------------------------------- .../wicket/ajax/attributes/IAjaxCallListener.java | 141 +++++++-------- 1 files changed, 70 insertions(+), 71 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/d6a114ef/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java index 48bc1fc..ec77351 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/IAjaxCallListener.java @@ -19,122 +19,121 @@ package org.apache.wicket.ajax.attributes; import org.apache.wicket.Component; /** - * Interface used to listen at the most important points when Wicket performs an Ajax callback. - * <br/> - * Ajax call listeners are potential contributors to the page header by implementing + * Interface used to listen at the most important points when Wicket performs an Ajax callback. <br/> + * Ajax call listeners are potential contributors to the page header by implementing * {@link org.apache.wicket.markup.html.IComponentAwareHeaderContributor}. E.g. the JavaScript used * by the listener may depend on some JavaScript library, by implementing - * {@link org.apache.wicket.markup.html.IComponentAwareHeaderContributor} interface - * they can assure it will be loaded. - * + * {@link org.apache.wicket.markup.html.IComponentAwareHeaderContributor} interface they can assure + * it will be loaded. + * * @since 6.0 */ public interface IAjaxCallListener { /** - * 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: + * 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: * <ol> - * <li>data - the Ajax response. Its type depends on {@link AjaxRequestAttributes#dataType}</li> - * <li>textStatus - the status as text</li> - * <li>jqXHR - the jQuery XMLHttpRequest object</li> - * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> * </ol> - * + * * @param component - * the Component with the Ajax behavior - * @return the JavaScript that will be executed after a successful - * return of the Ajax call. + * the Component with the Ajax behavior + * @return the JavaScript that will be executed before the Ajax call. */ - CharSequence getSuccessHandler(Component component); + CharSequence getBeforeHandler(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: + * A JavaScript function that is invoked before the request executes. If it returns + * {@code false} then the execution of the Ajax call will be cancelled. The script will be + * executed in a function that receives the following parameters: * <ol> - * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> * </ol> - * + * * @param component - * the Component with the Ajax behavior - * @return the JavaScript that will be executed after a unsuccessful - * return of the Ajax call. + * the Component with the Ajax behavior + * @return the JavaScript that should be used to decide whether the Ajax call should be made at + * all. */ - CharSequence getFailureHandler(Component component); + CharSequence getPrecondition(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: + * 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: * <ol> - * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>jqXHR - the jQuery XMLHttpRequest object</li> + * <li>settings - the settings used for the jQuery.ajax() call</li> * </ol> - * + * * @param component - * the Component with the Ajax behavior + * the Component with the Ajax behavior * @return the JavaScript that will be executed before the Ajax call. */ - CharSequence getBeforeHandler(Component component); - + 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: + * The JavaScript that will be executed after the Ajax call. The script will be executed in a + * function that receives the following parameters: * <ol> - * <li>attrs - the AjaxRequestAttributes as JSON</li> - * <li>jqXHR - the jQuery XMLHttpRequest object</li> - * <li>settings - the settings used for the jQuery.ajax() call</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> * </ol> - * + * <strong>Note</strong>: if the Ajax call is synchronous (see + * {@link AjaxRequestAttributes#setAsynchronous(boolean)}) then this JavaScript will be executed + * after the {@linkplain #getCompleteHandler(org.apache.wicket.Component) complete handler}. + * * @param component - * the Component with the Ajax behavior - * @return the JavaScript that will be executed before the Ajax call. + * the Component with the Ajax behavior + * @return the JavaScript that will be executed after the start of the Ajax call but before its + * response is returned. */ - CharSequence getBeforeSendHandler(Component component); + 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: + * 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: * <ol> - * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>data - the Ajax response. Its type depends on {@link AjaxRequestAttributes#dataType}</li> + * <li>textStatus - the status as text</li> + * <li>jqXHR - the jQuery XMLHttpRequest object</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> * </ol> - * + * * @param component - * the Component with the Ajax behavior - * @return the JavaScript that will be executed after the start of the Ajax call - * but before its response is returned. <strong>Note</strong>: if the Ajax call - * is synchronous (see {@link AjaxRequestAttributes#setAsynchronous(boolean)}) - * then this JavaScript will be executed after the - * {@linkplain #getCompleteHandler(org.apache.wicket.Component) complete handler}. + * the Component with the Ajax behavior + * @return the JavaScript that will be executed after a successful return of the Ajax call. */ - CharSequence getAfterHandler(Component component); + CharSequence getSuccessHandler(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: + * 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: * <ol> - * <li>jqXHR - the jQuery XMLHttpRequest object</li> - * <li>textStatus - the status as text</li> - * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> * </ol> + * * @param component - * the Component with the Ajax behavior - * @return the JavaScript that will be executed after both successful - * and unsuccessful return of the Ajax call. + * the Component with the Ajax behavior + * @return the JavaScript that will be executed after a unsuccessful return of the Ajax call. */ - CharSequence getCompleteHandler(Component component); + CharSequence getFailureHandler(Component component); /** - * A JavaScript function that is invoked before the request executes. - * If it returns {@code false} then the execution of the Ajax call will - * be cancelled. - * The script will be executed in a function that receives the following parameters: + * 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: * <ol> - * <li>attrs - the AjaxRequestAttributes as JSON</li> + * <li>jqXHR - the jQuery XMLHttpRequest object</li> + * <li>textStatus - the status as text</li> + * <li>attrs - the AjaxRequestAttributes as JSON</li> * </ol> - * - * @return the JavaScript that should be used to decide whether the Ajax - * call should be made at all. + * + * @param component + * the Component with the Ajax behavior + * @return the JavaScript that will be executed after both successful and unsuccessful return of + * the Ajax call. */ - CharSequence getPrecondition(Component component); + CharSequence getCompleteHandler(Component component); }
