|
||||||||||
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.markup.html.form.AbstractChoice |
---|
AbstractChoice.LabelPosition |
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_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, 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(String selectedValue)
Asks the Localizer for the property to display for an additional default choice
depending on isNullValid() :
"nullValid" if null is valid, defaulting to an empty string.
"null" if null is not valid but no choice is selected (i.e. |
String |
getModelValue()
|
protected String |
getNullKey()
Return the localization key for null value |
protected String |
getNullKeyDisplayValue()
Returns the display value if null is not valid but is selected. |
protected String |
getNullValidDisplayValue()
Returns the display value for the 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, setOptionAttributes, setType |
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, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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 |
---|
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(String selectedValue)
Localizer
for the property to display for an additional default choice
depending on isNullValid()
:
null
is valid, defaulting to an empty string.null
is not valid but no choice is selected (i.e. selectedValue
is
empty), defaulting to "Choose one".
getDefaultChoice
in class AbstractChoice<T,T>
selectedValue
- The currently selected value
getNullValidKey()
,
getNullKey()
,
AbstractChoice.getDefaultChoice(String)
protected String getNullValidDisplayValue()
getNullValidKey()
.
protected String getNullValidKey()
protected String getNullKeyDisplayValue()
getNullKey()
.
protected String getNullKey()
protected boolean isSelected(T object, int index, String selected)
isSelected
in class AbstractChoice<T,T>
object
- The object to checkindex
- The index of the object in the collectionselected
- The current selected id value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |