- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IGenericComponent<String,
,FormComponent<String>> IMetadataContext<Serializable,
,Component> IFormModelUpdateListener
,IFormSubmitter
,IFormSubmittingComponent
,IFormVisitorParticipant
,ILabelProvider<String>
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
- Direct Known Subclasses:
IndicatingAjaxButton
A button that submits the form via Ajax.
Note that an HTML type attribute of "submit" is automatically changed to "button"- Use
Note that an HTML type attribute of "submit" is automatically changed to "button"- Use
AjaxFallbackButton
if you want to support non-Ajax form submits too.- Since:
- 1.3
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
-
Field Summary
Fields inherited from class org.apache.wicket.markup.html.form.FormComponent
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATOR
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
-
Constructor Summary
ConstructorDescriptionAjaxButton
(String id) Construct.AjaxButton
(String id, Form<?> form) Construct.AjaxButton
(String id, IModel<String> model) Construct.AjaxButton
(String id, IModel<String> model, Form<?> form) Construct. -
Method Summary
Modifier and TypeMethodDescriptionForm<?>
getForm()
Returns the form if it was set in constructor, otherwise returns the form nearest in parent hierarchy.protected boolean
Returns whether the component can be stateless.protected AjaxFormSubmitBehavior
newAjaxFormSubmitBehavior
(String event) final void
Override this method to provide special submit handling in a multi-button form.protected void
onAfterSubmit
(AjaxRequestTarget target) Listener method invoked on form submit with no errors, afterForm.onSubmit()
.final void
onError()
This method is never called.protected void
onError
(AjaxRequestTarget target) Listener method invoked on form submit with errorsprotected void
This method is meant to be used as an alternative to initialize components.final void
onSubmit()
This method is never called.protected void
onSubmit
(AjaxRequestTarget target) Listener method invoked on form submit with no errors, beforeForm.onSubmit()
.protected boolean
Controls whether or not a JSsubmit
should be triggered on the submitting form.protected void
updateAjaxAttributes
(AjaxRequestAttributes attributes) Methods inherited from class org.apache.wicket.markup.html.form.Button
getDefaultFormProcessing, getOnClickScript, initModel, onComponentTag, onComponentTagBody, renderHead, setDefaultFormProcessing, updateModel
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent
add, add, checkRequired, clearInput, convertInput, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getInput, getInputAsArray, getInputName, getModelValue, getParameterValues, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onBeforeRender, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModelValue, setRequired, setType, shouldTrimInput, trim, updateAutoLabels, updateAutoLabels, updateCollectionModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
getLabel
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.wicket.markup.html.form.IFormSubmittingComponent
getInputName
Methods inherited from interface org.apache.wicket.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AjaxButton
Construct.- Parameters:
id
-
-
AjaxButton
Construct.- Parameters:
id
-model
- model used to setvalue
markup attribute
-
AjaxButton
Construct.- Parameters:
id
-form
-
-
AjaxButton
Construct.- Parameters:
id
-model
- model used to setvalue
markup attributeform
-
-
-
Method Details
-
onInitialize
Description copied from class:Component
This method is meant to be used as an alternative to initialize components. Usually the component's constructor is used for this task, but sometimes a component cannot be initialized in isolation, it may need to access its parent component or its markup in order to fully initialize. This method is invoked once per component's lifecycle when a path exists from this component to thePage
thus providing the component with an atomic callback when the component's environment is built out.Overrides must call super#
Component.onInitialize()
. Usually this should be the first thing an override does, much like a constructor.Parent containers are guaranteed to be initialized before their children
It is safe to use
Component.getPage()
in this methodNOTE:The timing of this call is not precise, the contract is that it is called sometime before
Component.onBeforeRender()
.- Overrides:
onInitialize
in classMarkupContainer
-
newAjaxFormSubmitBehavior
-
shouldTriggerJavaScriptSubmitEvent
Controls whether or not a JSsubmit
should be triggered on the submitting form. False by default.- Returns:
- true if
submit
should be triggered, false otherwise
-
updateAjaxAttributes
-
getForm
Returns the form if it was set in constructor, otherwise returns the form nearest in parent hierarchy.- Specified by:
getForm
in interfaceIFormSubmitter
- Overrides:
getForm
in classButton
- Returns:
- the parent form or
null
- See Also:
-
onSubmit
This method is never called.- Specified by:
onSubmit
in interfaceIFormSubmitter
- Overrides:
onSubmit
in classButton
- See Also:
-
onAfterSubmit
Description copied from class:Button
Override this method to provide special submit handling in a multi-button form. It is called whenever the user clicks this particular button, except if validation fails. This method will be called afterForm.onSubmit()
.- Specified by:
onAfterSubmit
in interfaceIFormSubmitter
- Overrides:
onAfterSubmit
in classButton
-
onError
This method is never called.- Specified by:
onError
in interfaceIFormSubmitter
- Overrides:
onError
in classButton
- See Also:
-
onSubmit
Listener method invoked on form submit with no errors, beforeForm.onSubmit()
.- Parameters:
target
-
-
onAfterSubmit
Listener method invoked on form submit with no errors, afterForm.onSubmit()
.- Parameters:
target
-
-
onError
Listener method invoked on form submit with errors- Parameters:
target
-
-
getStatelessHint
Description copied from class:Component
Returns whether the component can be stateless. Also the component behaviors must be stateless, otherwise the component will be treat as stateful. In order for page to be stateless (and not to be stored in session), all components (and component behaviors) must be stateless.- Overrides:
getStatelessHint
in classComponent
- Returns:
- whether the component can be stateless
-