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 aLabel
. A label component will be generated containing the default string representation of a value.- Author:
- Garret Wilson
- See Also:
Label
-
-
Constructor Summary
Constructors Constructor Description DefaultValueRepresentationStrategy(Converter<VV,java.lang.String> converter)
Converter constructor.DefaultValueRepresentationStrategy(java.lang.Class<VV> valueClass)
Value class constructor with a default converter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Label
createComponent(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 Detail
-
DefaultValueRepresentationStrategy
public DefaultValueRepresentationStrategy(java.lang.Class<VV> valueClass)
Value class constructor with a default converter. This implementation uses aDefaultStringLiteralConverter
.- Parameters:
valueClass
- The class indicating the type of value to convert.- Throws:
java.lang.NullPointerException
- if the given value class isnull
.
-
-
Method Detail
-
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:
AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy.getConverter()
-
-