Package org.apache.wicket.ajax.form
Class AjaxFormSubmitBehavior
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.apache.wicket.behavior.AbstractAjaxBehavior
-
- org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
-
- org.apache.wicket.ajax.AjaxEventBehavior
-
- org.apache.wicket.ajax.form.AjaxFormSubmitBehavior
-
- All Implemented Interfaces:
java.io.Serializable,IComponentAwareEventSink,IRequestListener,IComponentAwareHeaderContributor,org.apache.wicket.util.io.IClusterable
public abstract class AjaxFormSubmitBehavior extends AjaxEventBehavior
Ajax event behavior that submits a form via ajax when the event it is attached to, is invoked.The form must have an id attribute in the markup or have MarkupIdSetter added.
- Since:
- 1.2
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
AjaxEventBehavior,onSubmit(org.apache.wicket.ajax.AjaxRequestTarget),onAfterSubmit(org.apache.wicket.ajax.AjaxRequestTarget),onError(org.apache.wicket.ajax.AjaxRequestTarget), Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAjaxFormSubmitBehavior.AjaxFormSubmitterA publicly reachable class that allows to introspect the submitter, e.g.
-
Field Summary
-
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
-
Constructor Summary
Constructors Constructor Description AjaxFormSubmitBehavior(java.lang.String event)Constructor.AjaxFormSubmitBehavior(Form<?> form, java.lang.String event)Construct.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Form<?>findForm()Finds form that will be submittedbooleangetDefaultProcessing()Form<?>getForm()protected voidonAfterSubmit(AjaxRequestTarget target)Override this method to provide special submit handling in a multi-button form.protected voidonError(AjaxRequestTarget target)Listener method invoked when the form has been processed and errors occurredprotected voidonEvent(AjaxRequestTarget target)Listener method for the ajax eventstatic AjaxFormSubmitBehavioronSubmit(java.lang.String eventName, org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onSubmit)Creates anAjaxFormSubmitBehaviorbased on lambda expressionsprotected voidonSubmit(AjaxRequestTarget target)Override this method to provide special submit handling in a multi-button form.voidsetDefaultProcessing(boolean defaultProcessing)protected voidupdateAjaxAttributes(AjaxRequestAttributes attributes)Gives a chance to the specializations to modify the attributes.-
Methods inherited from class org.apache.wicket.ajax.AjaxEventBehavior
getEvent, onEvent, renderHead, respond
-
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes
-
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
-
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.IRequestListener
rendersPage
-
-
-
-
Constructor Detail
-
AjaxFormSubmitBehavior
public AjaxFormSubmitBehavior(java.lang.String event)
Constructor. This constructor can only be used when the component this behavior is attached to is inside a form.- Parameters:
event- javascript event this behavior is attached to, like onclick
-
AjaxFormSubmitBehavior
public AjaxFormSubmitBehavior(Form<?> form, java.lang.String event)
Construct.- Parameters:
form- form that will be submittedevent- javascript event this behavior is attached to, like onclick
-
-
Method Detail
-
getForm
public final Form<?> getForm()
- Returns:
- Form that will be submitted by this behavior
-
findForm
protected Form<?> findForm()
Finds form that will be submitted- Returns:
- form to submit or
nullif none found
-
updateAjaxAttributes
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
Description copied from class:AbstractDefaultAjaxBehaviorGives a chance to the specializations to modify the attributes.- Overrides:
updateAjaxAttributesin classAjaxEventBehavior
-
onEvent
protected void onEvent(AjaxRequestTarget target)
Description copied from class:AjaxEventBehaviorListener method for the ajax event- Specified by:
onEventin classAjaxEventBehavior- Parameters:
target- the current request handler
-
onAfterSubmit
protected void onAfterSubmit(AjaxRequestTarget target)
Override this method to provide special submit handling in a multi-button form. This method will be called after the form's onSubmit method.- Parameters:
target- theAjaxRequestTarget
-
onSubmit
protected void onSubmit(AjaxRequestTarget target)
Override this method to provide special submit handling in a multi-button form. This method will be called before the form's onSubmit method.- Parameters:
target- theAjaxRequestTarget
-
onError
protected void onError(AjaxRequestTarget target)
Listener method invoked when the form has been processed and errors occurred- Parameters:
target-
-
getDefaultProcessing
public boolean getDefaultProcessing()
- Returns:
truefor default processing- See Also:
Button.getDefaultFormProcessing()
-
setDefaultProcessing
public void setDefaultProcessing(boolean defaultProcessing)
- Parameters:
defaultProcessing-- See Also:
Button.setDefaultFormProcessing(boolean)
-
onSubmit
public static AjaxFormSubmitBehavior onSubmit(java.lang.String eventName, org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onSubmit)
Creates anAjaxFormSubmitBehaviorbased on lambda expressions- Parameters:
eventName- the event nameonSubmit- theSerializableConsumerwhich accepts theAjaxRequestTarget- Returns:
- the
AjaxFormSubmitBehavior
-
-