Class ObjectAutoCompleteField<O,I extends Serializable>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.html.form.LabeledWebMarkupContainer
-
- org.apache.wicket.markup.html.form.FormComponent<T>
-
- org.apache.wicket.markup.html.form.FormComponentPanel<I>
-
- org.wicketstuff.objectautocomplete.ObjectAutoCompleteField<O,I>
-
- All Implemented Interfaces:
Serializable,Iterable<Component>,IEventSink,IEventSource,IFeedbackContributor,IConverterLocator,IGenericComponent<I,FormComponent<I>>,IMetadataContext<Serializable,Component>,IQueueRegion,IFormModelUpdateListener,IFormVisitorParticipant,ILabelProvider<String>,IHeaderContributor,IRequestableComponent,IHierarchical<Component>,IClusterable
public class ObjectAutoCompleteField<O,I extends Serializable> extends FormComponentPanel<I>
Wicket component for selecting a single object of type T with an identifier of type I via autocompletion. The textfield used for autocompletion is nothing more than a search field where the autocomplete menu presents the search results. Selecting an entry of the search results (either via keyboard or mouse click) "picks" an entity, whose id is stored in the model of this component (So, the model object type of this model is I). A subclass must provide the list of T-objects, which are presented in the autocompletion menu.- Since:
- May 21, 2008
- Author:
- roland
- See Also:
- Serialized Form
-
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconvertInput()Called when form is submitted.TextField<String>getSearchTextField()Access to internal text field which can be used for adding some decorations or behaviours (like JS-Handler or specific CSS).protected IModel<I>initModel()protected voidonComponentTag(ComponentTag pTag)voidregisterForUpdateOnSelectionChange(ObjectAutoCompleteSelectionChangeListener<I> pListener)Register a listener that needs to be updated when the selection changes, i.e.voidsearchCanceled(AjaxRequestTarget pTarget, boolean pForceRestore)Callback called in case the user cancels a search via 'escape'-
Methods inherited from class org.apache.wicket.markup.html.form.FormComponentPanel
checkRequired, clearInput, newMarkupSourcingStrategy
-
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent
add, add, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModelValue, getParameterValues, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModelValue, setRequired, setType, shouldTrimInput, trim, updateAutoLabels, updateCollectionModel, updateModel, 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, onComponentTagBody, onInitialize, 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, getStatelessHint, 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, onAfterRender, onBeforeRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, 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.IGenericComponent
getDefaultModel, getDefaultModelObject, getModel, getModelObject, setDefaultModel, setDefaultModelObject, setModel, setModelObject
-
Methods inherited from interface org.apache.wicket.IQueueRegion
dequeue, getRegionMarkup, newDequeueContext
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
registerForUpdateOnSelectionChange
public void registerForUpdateOnSelectionChange(ObjectAutoCompleteSelectionChangeListener<I> pListener)
Register a listener that needs to be updated when the selection changes, i.e. the user selected an object from the suggestion list. The listener is called with the id-model and the ajax request target which can be used for updating one self- Parameters:
pListener- the listener to notify
-
searchCanceled
public void searchCanceled(AjaxRequestTarget pTarget, boolean pForceRestore)
Callback called in case the user cancels a search via 'escape'- Parameters:
pTarget- target to which the components to update are added
-
convertInput
public void convertInput()
Called when form is submitted. We are simply store the object remembered internally.- Overrides:
convertInputin classFormComponent<I extends Serializable>
-
onComponentTag
protected void onComponentTag(ComponentTag pTag)
- Overrides:
onComponentTagin classFormComponentPanel<I extends Serializable>
-
getSearchTextField
public TextField<String> getSearchTextField()
Access to internal text field which can be used for adding some decorations or behaviours (like JS-Handler or specific CSS). Please be conservative in what you are doing, i.e. do not modify its model. Note: This method might vanish until the first release, it's probably better to provide delegation methods.- Returns:
- textfield textfield holding the search input
-
-