Class AutoCompleteBehavior<T>
- java.lang.Object
-
- org.apache.wicket.behavior.Behavior
-
- org.apache.wicket.behavior.AbstractAjaxBehavior
-
- org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
-
- org.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteBehavior
-
- org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteBehavior<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IRequestListener
,IComponentAwareHeaderContributor
,IClusterable
public abstract class AutoCompleteBehavior<T> extends AbstractAutoCompleteBehavior
This behavior builds on top ofAbstractAutoCompleteBehavior
by introducing the concept of aIAutoCompleteRenderer
to make response writing easier.- Since:
- 1.2
- Author:
- Igor Vaynberg (ivaynberg), Janne Hietamäki (jannehietamaki)
- See Also:
IAutoCompleteRenderer
, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteBehavior
AUTOCOMPLETE_JS, settings
-
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
-
Constructor Summary
Constructors Constructor Description AutoCompleteBehavior(IAutoCompleteRenderer<T> renderer)
ConstructorAutoCompleteBehavior(IAutoCompleteRenderer<T> renderer, boolean preselect)
ConstructorAutoCompleteBehavior(IAutoCompleteRenderer<T> renderer, AutoCompleteSettings settings)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
detach(Component component)
Allows the behavior to detach any state it has attached during request processing.protected abstract Iterator<T>
getChoices(String input)
Callback method that should return an iterator over all possible choice objects.protected void
onBind()
Subclasses should call super.onBind()protected void
onRequest(String val, RequestCycle requestCycle)
Callback for the ajax event generated by the javascript.-
Methods inherited from class org.apache.wicket.extensions.ajax.markup.html.autocomplete.AbstractAutoCompleteBehavior
constructSettingsJS, renderHead, respond, updateAjaxAttributes
-
Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onMethodMismatch, 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, 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
-
AutoCompleteBehavior
public AutoCompleteBehavior(IAutoCompleteRenderer<T> renderer)
Constructor- Parameters:
renderer
- renderer that will be used to generate output
-
AutoCompleteBehavior
public AutoCompleteBehavior(IAutoCompleteRenderer<T> renderer, boolean preselect)
Constructor- Parameters:
renderer
- renderer that will be used to generate outputpreselect
- highlight/preselect the first item in the autocomplete list automatically
-
AutoCompleteBehavior
public AutoCompleteBehavior(IAutoCompleteRenderer<T> renderer, AutoCompleteSettings settings)
Constructor- Parameters:
renderer
- renderer that will be used to generate outputsettings
- settings for the autocomplete list
-
-
Method Detail
-
onBind
protected void onBind()
Description copied from class:AbstractDefaultAjaxBehavior
Subclasses should call super.onBind()- Overrides:
onBind
in classAbstractDefaultAjaxBehavior
- See Also:
AbstractAjaxBehavior.onBind()
-
onRequest
protected final void onRequest(String val, RequestCycle requestCycle)
Description copied from class:AbstractAutoCompleteBehavior
Callback for the ajax event generated by the javascript. This is where we need to generate our response.- Specified by:
onRequest
in classAbstractAutoCompleteBehavior
- Parameters:
val
- the input entered so farrequestCycle
- current request cycle
-
getChoices
protected abstract Iterator<T> getChoices(String input)
Callback method that should return an iterator over all possible choice objects. These objects will be passed to the renderer to generate output. Usually it is enough to return an iterator over strings.- Parameters:
input
- current input- Returns:
- iterator over all possible choice objects
-
-