T
- The model object typepublic interface IChoiceRenderer<T> extends IDetachable
Modifier and Type | Method and Description |
---|---|
default void |
detach()
Override when needed.
|
Object |
getDisplayValue(T object)
Get the value for displaying to an end user.
|
default String |
getIdValue(T object,
int index)
This method is called to get the id value of an object (used as the value attribute of a
choice element) The id can be extracted from the object like a primary key, or if the list is
stable you could just return a toString of the index.
|
default T |
getObject(String id,
IModel<? extends List<? extends T>> choices)
This method is called to get an object back from its id representation.
|
Object getDisplayValue(T object)
object
- the actual objectdefault String getIdValue(T object, int index)
Note that the given index can be -1
if the object in question is not contained in the
available choices.
object
- The object for which the id should be generatedindex
- The index of the object in the choices list.default T getObject(String id, IModel<? extends List<? extends T>> choices)
id
may be used to find/load the object in a more efficient way
than loading all choices
and find the one with the same id in the listid
- The id representation of the objectchoices
- The list of all rendered choicesid
default void detach()
detach
in interface IDetachable
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.