Class FormComponentUpdatingBehavior
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.markup.html.form.FormComponentUpdatingBehavior
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IRequestListener
,IComponentAwareHeaderContributor
,IClusterable
A behavior to get notifications when a
FormComponent
changes its value.
Contrary to AjaxFormComponentUpdatingBehavior
all notification are sent via
standard HTTP requests and the full page is rendered as a response.
Notification is triggered by a change
JavaScript event - if needed getEvent()
can be overridden
to deviate from this default.
Note: This behavior has limited support for FormComponent
s outside of a form, i.e. multiple
choice components (ListMultipleChoice
and RadioGroup
) will send their last selected
choice only.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
Bind this handler to the given component.protected String
getEvent()
Which JavaScript event triggers notification.final FormComponent<?>
Get the hosting component.boolean
getStatelessHint
(Component component) This method returns false if the behavior generates a callback url (for example ajax behaviors)protected boolean
Gives the control to the application to decide whether the form component model should be updated automatically or not.protected void
onBind()
Called when the component was bound to it's host component.protected void
Hook method invoked when updating of the component resulted in an error.final void
Called when a request is received.protected void
onUpdate()
Hook method invoked when the component is updated.void
renderHead
(Component component, IHeaderResponse response) Render to the web response whatever the component wants to contribute to the head section.Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListener, detach, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, unbind
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 Details
-
FormComponentUpdatingBehavior
public FormComponentUpdatingBehavior()
-
-
Method Details
-
getStatelessHint
Description copied from class:Behavior
This method returns false if the behavior generates a callback url (for example ajax behaviors)- Overrides:
getStatelessHint
in classBehavior
- Parameters:
component
- the component that has this behavior coupled.- Returns:
- boolean true or false.
-
bind
Description copied from class:Behavior
Bind this handler to the given component. This method is called by the host component immediately after this behavior is added to it. This method is useful if you need to do initialization based on the component it is attached and you can't wait to do it at render time. Keep in mind that if you decide to keep a reference to the host component, it is not thread safe anymore, and should thus only be used in situations where you do not reuse the behavior for multiple components. -
onBind
Called when the component was bound to it's host component. You can get the bound host component by callinggetFormComponent()
. -
getFormComponent
Get the hosting component.- Returns:
- hosting component
-
renderHead
Description copied from class:Behavior
Render to the web response whatever the component wants to contribute to the head section.- Specified by:
renderHead
in interfaceIComponentAwareHeaderContributor
- Overrides:
renderHead
in classBehavior
- Parameters:
component
- component which is contributing to the response. This parameter is here to give the component as the context for component-awares implementing this interfaceresponse
- Response object
-
getEvent
Which JavaScript event triggers notification.- Returns:
change
by default
-
getUpdateModel
Gives the control to the application to decide whether the form component model should be updated automatically or not. Make sure to callFormComponent.valid()
additionally in case the application want to update the model manually.- Returns:
- true if the model of form component should be updated, false otherwise
-
onUpdate
Hook method invoked when the component is updated.Note:
onError(RuntimeException)
is called instead when processing of theFormComponent
failed with conversion or validation errors! -
onError
Hook method invoked when updating of the component resulted in an error.The
RuntimeException
will be null if it was just a validation or conversion error of the FormComponent.- Parameters:
e
- optional runtime exception
-
onRequest
Description copied from interface:IRequestListener
Called when a request is received.- Specified by:
onRequest
in interfaceIRequestListener
-