Package org.apache.wicket.ajax.form
Class OnChangeAjaxBehavior
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable,IComponentAwareEventSink,IRequestListener,IComponentAwareHeaderContributor,org.apache.wicket.util.io.IClusterable
public abstract class OnChangeAjaxBehavior extends AjaxFormComponentUpdatingBehavior
A behavior that updates the hostingFormComponentvia Ajax when value of the component is changed.This behavior uses best available method to track changes on different types of form components. To accomplish this for text input form components it uses a custom event, named 'inputchange', that is handled in the best way for the specific browser. For other form component types the 'change' event is used.
- Since:
- 1.3
- Author:
- Janne Hietamäki (janne)
- See Also:
AjaxFormComponentUpdatingBehavior.onUpdate(org.apache.wicket.ajax.AjaxRequestTarget),AjaxFormComponentUpdatingBehavior.onError(org.apache.wicket.ajax.AjaxRequestTarget, RuntimeException), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEVENT_CHANGEthe change eventstatic java.lang.StringEVENT_NAME'inputchange' event delegates to 'input', 'keyup', 'cut' and 'paste' events for text input form component depending on the browser.-
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
-
Constructor Summary
Constructors Constructor Description OnChangeAjaxBehavior()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OnChangeAjaxBehavioronChange(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onChange)Creates anOnChangeAjaxBehaviorbased on lambda expressionsprotected voidupdateAjaxAttributes(AjaxRequestAttributes attributes)Gives a chance to the specializations to modify the attributes.-
Methods inherited from class org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior
checkComponent, disableFocusOnBlur, getFormComponent, getUpdateModel, onBind, onError, onEvent, onUpdate, onUpdate
-
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, 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
-
-
-
-
Field Detail
-
EVENT_NAME
public static final java.lang.String EVENT_NAME
'inputchange' event delegates to 'input', 'keyup', 'cut' and 'paste' events for text input form component depending on the browser. 'change' is used as a fallback for all other form component types.- See Also:
- Constant Field Values
-
EVENT_CHANGE
public static final java.lang.String EVENT_CHANGE
the change event- See Also:
- Constant Field Values
-
-
Method Detail
-
updateAjaxAttributes
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
Description copied from class:AbstractDefaultAjaxBehaviorGives a chance to the specializations to modify the attributes.- Overrides:
updateAjaxAttributesin classAjaxFormComponentUpdatingBehavior
-
onChange
public static OnChangeAjaxBehavior onChange(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onChange)
Creates anOnChangeAjaxBehaviorbased on lambda expressions- Parameters:
onChange- theSerializableConsumerwhich accepts theAjaxRequestTarget- Returns:
- the
OnChangeAjaxBehavior
-
-