Package org.apache.wicket.ajax
Class CancelEventIfAjaxListener
- java.lang.Object
-
- org.apache.wicket.ajax.attributes.AjaxCallListener
-
- org.apache.wicket.ajax.CancelEventIfAjaxListener
-
- All Implemented Interfaces:
Serializable
,IAjaxCallListener
,IComponentAwareHeaderContributor
,IClusterable
public final class CancelEventIfAjaxListener extends AjaxCallListener
Decorator that can be used to cancel the regular action if ajax call was performed. This allows us to, for example, cancel the default anchor behavior (requesting href url) if an ajax call was made in the onclick event handler. Ajax call cannot be performed if javascript has been turned off or no compatible XmlHttpRequest object can be found. This decorator will make javascript return true if the ajax call was made, and false otherwise.- Since:
- 6.0
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
AjaxFallbackLink
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CancelEventIfAjaxListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CharSequence
getBeforeHandler(Component component)
The JavaScript that will be executed before the Ajax call, as early as possible.-
Methods inherited from class org.apache.wicket.ajax.attributes.AjaxCallListener
getAfterHandler, getBeforeSendHandler, getCompleteHandler, getDoneHandler, getFailureHandler, getInitHandler, getPrecondition, getSuccessHandler, onAfter, onBefore, onBeforeSend, onComplete, onDone, onFailure, onInit, onPrecondition, onSuccess, renderHead
-
-
-
-
Constructor Detail
-
CancelEventIfAjaxListener
public CancelEventIfAjaxListener()
-
-
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.
-
-