|
||||||||||
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,E>
T
- The model object typeE
- class of a single element in the choices listpublic abstract class AbstractChoice<T,E>
Abstract base class for all choice (html select) options.
This component uses String concatenation to keep its memory footprint light. Use Select, SelectOptions and SelectOption from wicket-extensions for more sophisticated needs.
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 | |
---|---|
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. |
Method Summary | |
---|---|
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()
|
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<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. |
Methods inherited from class org.apache.wicket.markup.html.form.LabeledWebMarkupContainer |
---|
getLabel |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
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 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 AbstractChoice(String id, IModel<T> model, IModel<? extends List<? extends E>> choices, IChoiceRenderer<? super E> renderer)
id
- See Componentmodel
- See Componentrenderer
- The rendering enginechoices
- The drop down choicesMethod Detail |
---|
public List<? extends E> getChoices()
public final AbstractChoice<T,E> setChoices(IModel<? extends List<? extends E>> choices)
choices
- model representing the list of choices
public final AbstractChoice<T,E> setChoices(List<E> choices)
choices
- the list of choices
public final IChoiceRenderer<? super E> getChoiceRenderer()
public final AbstractChoice<T,E> setChoiceRenderer(IChoiceRenderer<? super E> renderer)
renderer
-
protected void detachModel()
Component
detachModel
in class Component
protected CharSequence getDefaultChoice(String selectedValue)
selectedValue
- The currently selected value
setChoices(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 value
protected 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 value
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
onComponentTagBody
in class MarkupContainer
markupStream
- 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)
FormComponent
setType
in class FormComponent<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |