Package io.guise.framework.component
Class AbstractListSelectControl.DefaultValueRepresentationStrategy<VV>
java.lang.Object
io.guise.framework.component.AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>
io.guise.framework.component.AbstractListSelectControl.DefaultValueRepresentationStrategy<VV>
- Type Parameters:
VV
- The type of value the strategy is to represent.
- All Implemented Interfaces:
ListSelectControl.ValueRepresentationStrategy<VV>
- Enclosing class:
- AbstractListSelectControl<V>
public static class AbstractListSelectControl.DefaultValueRepresentationStrategy<VV>
extends AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>
A default list select value representation strategy that creates a
Label
. A label component will be generated containing the default string
representation of a value.- Author:
- Garret Wilson
- See Also:
-
Constructor Summary
ConstructorDescriptionDefaultValueRepresentationStrategy
(Converter<VV, String> converter) Converter constructor.DefaultValueRepresentationStrategy
(Class<VV> valueClass) Value class constructor with a default converter. -
Method Summary
Modifier and TypeMethodDescriptioncreateComponent
(ListSelectModel<VV> model, VV value, int index, boolean selected, boolean focused) Creates a component for the given list value.Methods inherited from class io.guise.framework.component.AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy
getConverter
-
Constructor Details
-
DefaultValueRepresentationStrategy
Value class constructor with a default converter. This implementation uses aDefaultStringLiteralConverter
.- Parameters:
valueClass
- The class indicating the type of value to convert.- Throws:
NullPointerException
- if the given value class isnull
.
-
DefaultValueRepresentationStrategy
Converter constructor.- Parameters:
converter
- The converter to use for displaying the value as a string.- Throws:
NullPointerException
- if the given converter isnull
.
-
-
Method Details
-
createComponent
public Label createComponent(ListSelectModel<VV> model, VV value, int index, boolean selected, boolean focused) Creates a component for the given list value. This implementation constructs a component from a info model that converts the value using the saved converter.This version uses covariant types to specify that a
Label
is returned.- Specified by:
createComponent
in interfaceListSelectControl.ValueRepresentationStrategy<VV>
- Overrides:
createComponent
in classAbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>
- Parameters:
model
- The model containing the value.value
- The value for which a component should be created.index
- The index of the value within the list, or -1 if the value is not in the list (e.g. for representing no selection).selected
-true
if the value is selected.focused
-true
if the value has the focus.- Returns:
- A new component to represent the given value.
- See Also:
-