T - public class ChoiceRendererNullable<T extends Enum<T>> extends Object implements org.apache.wicket.markup.html.form.IChoiceRenderer<T>
IChoiceRenderer implementation that makes it easy to work with java 5 enums. This
renderer will attempt to lookup strings used for the display value using a localizer of a given
component. If the component is not specified, the global instance of localizer will be used for
lookups.
display value resource key format: <enum.getSimpleClassName()>.<enum.name()>
id value format: <enum.name()>
| Modifier and Type | Field and Description |
|---|---|
protected static String |
UNDEFINED_ITEM_KEY
Undefined item Key
|
| Constructor and Description |
|---|
ChoiceRendererNullable()
Constructor that creates the choice renderer that will use global instance of localizer to
resolve resource keys.
|
ChoiceRendererNullable(org.apache.wicket.Component resourceSource)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getDisplayValue(T item) |
String |
getIdValue(T item,
int index) |
T |
getObject(String id,
org.apache.wicket.model.IModel<? extends List<? extends T>> choices) |
protected String |
getUndefinedKey()
Localization key for undefined value
|
protected CharSequence |
postprocess(String value)
Post-processes the
value after it is retrieved from the localizer. |
protected String |
resourceKey(T item)
Translates the
object into resource key that will be used to lookup the value shown
to the user |
protected static final String UNDEFINED_ITEM_KEY
public ChoiceRendererNullable()
public ChoiceRendererNullable(org.apache.wicket.Component resourceSource)
resourceSource - public Object getDisplayValue(T item) throws NullPointerException
getDisplayValue in interface org.apache.wicket.markup.html.form.IChoiceRenderer<T extends Enum<T>>NullPointerExceptionprotected String resourceKey(T item)
object into resource key that will be used to lookup the value shown
to the useritem - protected CharSequence postprocess(String value)
value after it is retrieved from the localizer. Default
implementation escapes any markup found in the value.value - protected String getUndefinedKey()
Copyright © 2017. All rights reserved.