T - The model object typeE - class of a single element in the choices listpublic abstract class AbstractChoice<T,E> extends FormComponent<T>
This component uses String concatenation to keep its memory footprint light. Use Select, SelectOptions and SelectOption from wicket-extensions for more sophisticated needs.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractChoice.LabelPosition
An enumeration of possible positions of the label for a choice
|
FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, VALUE_SEPARATORENABLE, FLAG_AFTER_RENDERING, FLAG_INITIALIZED, FLAG_PREPARED_FOR_RENDER, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RENDERING, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING| Constructor and Description |
|---|
AbstractChoice(String id)
Constructor.
|
AbstractChoice(String id,
IModel<? extends List<? extends E>> choices)
Constructor.
|
AbstractChoice(String id,
IModel<? extends List<? extends E>> choices,
IChoiceRenderer<? super E> renderer)
Constructor.
|
AbstractChoice(String id,
IModel<T> model,
IModel<? extends List<? extends E>> choices)
Constructor.
|
AbstractChoice(String id,
IModel<T> model,
IModel<? extends List<? extends E>> choices,
IChoiceRenderer<? super E> renderer)
Constructor.
|
AbstractChoice(String id,
IModel<T> model,
List<? extends E> choices)
Constructor.
|
AbstractChoice(String id,
IModel<T> model,
List<? extends E> choices,
IChoiceRenderer<? super E> renderer)
Constructor.
|
AbstractChoice(String id,
List<? extends E> choices)
Constructor.
|
AbstractChoice(String id,
List<? extends E> choices,
IChoiceRenderer<? super E> renderer)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendOptionHtml(AppendingStringBuffer buffer,
E choice,
int index,
String selected)
Generates and appends html for a single choice into the provided buffer
|
protected void |
detachModel()
Detaches the model for this component if it is detachable.
|
protected CharSequence |
escapeOptionHtml(String displayValue)
Method to override if you want special escaping of the options html.
|
IChoiceRenderer<? super E> |
getChoiceRenderer() |
List<? extends E> |
getChoices() |
IModel<? extends List<? extends E>> |
getChoicesModel() |
protected CharSequence |
getDefaultChoice(String selectedValue)
Get a default choice to be rendered additionally to the choices available in the model.
|
protected boolean |
isDisabled(E object,
int index,
String selected)
Gets whether the given value is disabled.
|
protected abstract boolean |
isSelected(E object,
int index,
String selected)
Gets whether the given value represents the current selection.
|
protected boolean |
localizeDisplayValues()
Override this method if you want to localize the display values of the generated options.
|
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Handle the container's body.
|
AbstractChoice<T,E> |
setChoiceRenderer(IChoiceRenderer<? super E> renderer)
Set the choice renderer to be used.
|
AbstractChoice<T,E> |
setChoices(IModel<? extends List<? extends E>> choices)
Sets the list of choices
|
AbstractChoice<T,E> |
setChoices(List<? extends E> choices)
Sets the list of choices.
|
protected void |
setOptionAttributes(AppendingStringBuffer buffer,
E choice,
int index,
String selected)
Sets the attributes of a single choice into the provided buffer.
|
FormComponent<T> |
setType(Class<?> type)
Sets the type that will be used when updating the model for this component.
|
add, add, checkRequired, clearInput, convertInput, convertValue, error, getConvertedInput, getDefaultLabel, getDefaultLabel, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getModelValue, getParameterValues, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, newValidationError, onComponentTag, onDetach, onDisabled, onInvalid, onRequired, onValid, processChildren, processInput, remove, reportRequiredError, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, shouldTrimInput, trim, updateAutoLabels, updateCollectionModel, updateModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrdergetLabelgetWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSessionadd, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildrenadd, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, 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, 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, initModel, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrappublic AbstractChoice(String id)
id - See Componentpublic AbstractChoice(String id, List<? extends E> choices)
id - See Componentchoices - The collection of choices in the dropdownpublic AbstractChoice(String id, List<? extends E> choices, IChoiceRenderer<? super E> renderer)
id - See Componentrenderer - The rendering enginechoices - The collection of choices in the dropdownpublic AbstractChoice(String id, IModel<T> model, List<? extends E> choices)
id - See Componentmodel - See Componentchoices - The collection of choices in the dropdownpublic AbstractChoice(String id, IModel<T> model, List<? extends E> choices, IChoiceRenderer<? super E> renderer)
id - See Componentmodel - See Componentchoices - The drop down choicesrenderer - The rendering enginepublic AbstractChoice(String id, IModel<? extends List<? extends E>> choices)
id - See Componentchoices - The collection of choices in the dropdownpublic AbstractChoice(String id, IModel<? extends List<? extends E>> choices, IChoiceRenderer<? super E> renderer)
id - See Componentrenderer - The rendering enginechoices - The collection of choices in the dropdownpublic AbstractChoice(String id, IModel<T> model, IModel<? extends List<? extends E>> choices)
id - See Componentmodel - See Componentchoices - The collection of choices in the dropdownpublic List<? extends E> getChoices()
public IModel<? extends List<? extends E>> getChoicesModel()
public final AbstractChoice<T,E> setChoices(IModel<? extends List<? extends E>> choices)
choices - model representing the list of choicespublic final AbstractChoice<T,E> setChoices(List<? extends E> choices)
choices - the list of choicespublic final IChoiceRenderer<? super E> getChoiceRenderer()
public final AbstractChoice<T,E> setChoiceRenderer(IChoiceRenderer<? super E> renderer)
renderer - The IChoiceRenderer used for rendering the data objectsprotected void detachModel()
ComponentdetachModel in class Componentprotected CharSequence getDefaultChoice(String selectedValue)
selectedValue - The currently selected valuesetChoices(IModel)protected abstract boolean isSelected(E object, int index, String selected)
object - The object to checkindex - The index in the choices collection this object is in.selected - The currently selected string valueprotected boolean isDisabled(E object, int index, String selected)
object - The object to checkindex - The index in the choices collection this object is in.selected - The currently selected string valuepublic void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
onComponentTagBody in class MarkupContainermarkupStream - The markup streamopenTag - The open tag for the bodyprotected void appendOptionHtml(AppendingStringBuffer buffer, E choice, int index, String selected)
buffer - Appending string buffer that will have the generated html appendedchoice - Choice objectindex - The index of this optionselected - The currently selected string valueprotected void setOptionAttributes(AppendingStringBuffer buffer, E choice, int index, String selected)
buffer - Appending string buffer that will have the generated html appendedchoice - Choice objectindex - The index of this optionselected - The currently selected string valueprotected CharSequence escapeOptionHtml(String displayValue)
displayValue - protected boolean localizeDisplayValues()
public final FormComponent<T> setType(Class<?> type)
FormComponentsetType in class FormComponent<T>Copyright © 2006–2021 Apache Software Foundation. All rights reserved.