|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.AbstractChoice<T,T> org.apache.wicket.markup.html.form.AbstractSingleSelectChoice<T>
T
- The model object typepublic abstract class AbstractSingleSelectChoice<T>
Abstract base class for single-select choices.
Field Summary | |
---|---|
protected static Object |
NO_SELECTION_VALUE
|
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_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
AbstractSingleSelectChoice(String id)
Constructor. |
|
AbstractSingleSelectChoice(String id,
IModel<? extends List<? extends T>> choices)
Constructor. |
|
AbstractSingleSelectChoice(String id,
IModel<? extends List<? extends T>> choices,
IChoiceRenderer<? super T> renderer)
Constructor. |
|
AbstractSingleSelectChoice(String id,
IModel<T> model,
IModel<? extends List<? extends T>> choices)
Constructor. |
|
AbstractSingleSelectChoice(String id,
IModel<T> model,
IModel<? extends List<? extends T>> choices,
IChoiceRenderer<? super T> renderer)
Constructor. |
|
AbstractSingleSelectChoice(String id,
IModel<T> model,
List<? extends T> choices)
Constructor. |
|
AbstractSingleSelectChoice(String id,
IModel<T> model,
List<? extends T> choices,
IChoiceRenderer<? super T> renderer)
Constructor. |
|
AbstractSingleSelectChoice(String id,
List<? extends T> choices)
Constructor. |
|
AbstractSingleSelectChoice(String id,
List<? extends T> choices,
IChoiceRenderer<? super T> renderer)
Constructor. |
Method Summary | |
---|---|
protected T |
convertChoiceIdToChoice(String id)
Converts submitted choice id string back to choice object. |
protected T |
convertValue(String[] value)
Subclasses should overwrite this if the conversion is not done through the type field and the IConverter . |
protected CharSequence |
getDefaultChoice(Object selected)
The localizer will be ask for the property to display Depending on if null is allowed or not it will ask for: nullValid: when null is valid and by default it will show an empty string as a choice. null: when null is not a valid choice and it will make a choice with "Choose One" The choice for null is valid will always be returned. |
String |
getModelValue()
|
protected Object |
getNoSelectionValue()
In case "-1" is not a suitable "no selection value", you may provide your own implementation of getNoSelectionValue(). |
protected String |
getNullKey()
Return the localization key for null value |
protected String |
getNullValidKey()
Return the localization key for nullValid value |
boolean |
isNullValid()
Determines whether or not the null value should be included in the list of choices when the field's model value is nonnull, and whether or not the null_valid string property (e.g. |
protected boolean |
isSelected(T object,
int index,
String selected)
Gets whether the given value represents the current selection. |
AbstractSingleSelectChoice<T> |
setNullValid(boolean nullValid)
/** Determines whether or not the null value should be included in the list of choices when the field's model value is nonnull, and whether or not the null_valid string property (e.g. |
Methods inherited from class org.apache.wicket.markup.html.form.AbstractChoice |
---|
appendOptionHtml, detachModel, escapeOptionHtml, getChoiceRenderer, getChoices, isDisabled, localizeDisplayValues, onComponentTagBody, setChoiceRenderer, setChoices, setChoices |
Methods inherited from class org.apache.wicket.markup.html.form.FormComponent |
---|
add, add, checkRequired, clearInput, convertInput, error, getConvertedInput, getForm, getInput, getInputAsArray, getInputName, getModel, getModelObject, getRawInput, getType, getValidatorKeyPrefix, getValidators, getValue, hasRawInput, inputAsInt, inputAsInt, inputAsIntArray, inputChanged, internalOnModelChanged, invalid, isInputNullable, isMultiPart, isRequired, isValid, newValidatable, onComponentTag, onDetach, onDisabled, onInvalid, onValid, processChildren, processInput, remove, setConvertedInput, setLabel, setModel, setModelObject, setModelValue, setRequired, setType, shouldTrimInput, trim, updateModel, valid, validate, validateRequired, validateValidators, visitComponentsPostOrder, visitFormComponentsPostOrder |
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer |
---|
getLabel, setLabelInternal |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final Object NO_SELECTION_VALUE
Constructor Detail |
---|
public AbstractSingleSelectChoice(String id)
id
- See Componentpublic AbstractSingleSelectChoice(String id, List<? extends T> choices)
id
- See Componentchoices
- The collection of choices in the dropdownpublic AbstractSingleSelectChoice(String id, List<? extends T> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentrenderer
- The rendering enginechoices
- The collection of choices in the dropdownpublic AbstractSingleSelectChoice(String id, IModel<T> model, List<? extends T> choices)
id
- See Componentmodel
- See Componentchoices
- The collection of choices in the dropdownpublic AbstractSingleSelectChoice(String id, IModel<T> model, List<? extends T> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentmodel
- See Componentchoices
- The drop down choicesrenderer
- The rendering enginepublic AbstractSingleSelectChoice(String id, IModel<? extends List<? extends T>> choices)
id
- See Componentchoices
- The collection of choices in the dropdownpublic AbstractSingleSelectChoice(String id, IModel<T> model, IModel<? extends List<? extends T>> choices)
id
- See Componentmodel
- See Componentchoices
- The drop down choicespublic AbstractSingleSelectChoice(String id, IModel<? extends List<? extends T>> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentchoices
- The drop down choicesrenderer
- The rendering enginepublic AbstractSingleSelectChoice(String id, IModel<T> model, IModel<? extends List<? extends T>> choices, IChoiceRenderer<? super T> renderer)
id
- See Componentmodel
- See Componentchoices
- The drop down choicesrenderer
- The rendering engineMethod Detail |
---|
protected Object getNoSelectionValue()
public String getModelValue()
getModelValue
in class FormComponent<T>
FormComponent.getModelValue()
public boolean isNullValid()
FormComponent.setRequired(boolean)
. This is because even if
setNullValid() is called with false, the user can fail to provide a value simply by never
activating (i.e. clicking on) the component.
true
when the null
value is allowed.public AbstractSingleSelectChoice<T> setNullValid(boolean nullValid)
FormComponent.setRequired(boolean)
. This is because even if
setNullValid() is called with false, the user can fail to provide a value simply by never
activating (i.e. clicking on) the component.
nullValid
- whether null is a valid value
protected final T convertValue(String[] value)
FormComponent
IConverter
. WARNING: this method may be removed in future versions.
If conversion fails then a ConversionException should be thrown
convertValue
in class FormComponent<T>
value
- The value can be the getInput() or through a cookie
FormComponent.convertValue(String[])
protected T convertChoiceIdToChoice(String id)
id
- string id of one of the choice objects in the choices list. can be null.
protected CharSequence getDefaultChoice(Object selected)
getDefaultChoice
in class AbstractChoice<T,T>
selected
- The object that's currently selected
AbstractChoice.getDefaultChoice(Object)
protected String getNullValidKey()
protected String getNullKey()
protected boolean isSelected(T object, int index, String selected)
isSelected
in class AbstractChoice<T,T>
index
- The index of the object in the collectionselected
- The current selected id valueobject
- The object to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |