Package io.guise.framework.component
Class AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>
- java.lang.Object
-
- io.guise.framework.component.AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>
-
- Type Parameters:
VV
- The type of value the strategy is to represent.
- All Implemented Interfaces:
ListSelectControl.ValueRepresentationStrategy<VV>
- Direct Known Subclasses:
AbstractListSelectControl.DefaultValueRepresentationStrategy
- Enclosing class:
- AbstractListSelectControl<V>
public static class AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV> extends java.lang.Object implements ListSelectControl.ValueRepresentationStrategy<VV>
A list select value representation strategy that creates a component by converting the value to a info model. The specified component class must have a constructor that takes a singleInfoModel
as an argument.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description ConverterInfoModelValueRepresentationStrategy(java.lang.Class<? extends Component> componentClass, Converter<VV,java.lang.String> converter)
Converter constructor.ConverterInfoModelValueRepresentationStrategy(java.lang.Class<VV> valueClass, java.lang.Class<? extends Component> componentClass)
Value class constructor with a default converter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Component
createComponent(ListSelectModel<VV> model, VV value, int index, boolean selected, boolean focused)
Creates a component for the given list value.Converter<VV,java.lang.String>
getConverter()
-
-
-
Constructor Detail
-
ConverterInfoModelValueRepresentationStrategy
public ConverterInfoModelValueRepresentationStrategy(java.lang.Class<VV> valueClass, java.lang.Class<? extends Component> componentClass)
Value class constructor with a default converter. This implementation uses aDefaultStringLiteralConverter
.- Parameters:
valueClass
- The class indicating the type of value to convert.componentClass
- The class of component to create.- Throws:
java.lang.NullPointerException
- if the given value class and/or component class isnull
.java.lang.IllegalArgumentException
- if the given component class does not have a constructor with a singleInfoModel
constructor.
-
ConverterInfoModelValueRepresentationStrategy
public ConverterInfoModelValueRepresentationStrategy(java.lang.Class<? extends Component> componentClass, Converter<VV,java.lang.String> converter)
Converter constructor.- Parameters:
converter
- The converter to use for displaying the value as a string.componentClass
- The class of component to create.- Throws:
java.lang.NullPointerException
- if the given converter isnull
.java.lang.IllegalArgumentException
- if the given component class does not have a constructor with a singleInfoModel
constructor.
-
-
Method Detail
-
getConverter
public Converter<VV,java.lang.String> getConverter()
- Returns:
- The converter to use for displaying the value as a string.
-
createComponent
public Component 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.- Specified by:
createComponent
in interfaceListSelectControl.ValueRepresentationStrategy<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:
getConverter()
-
-