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 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 single
InfoModel
as an argument.- Author:
- Garret Wilson
-
Constructor Summary
ConstructorsConstructorDescriptionConverterInfoModelValueRepresentationStrategy
(Class<? extends Component> componentClass, Converter<VV, String> converter) Converter constructor.ConverterInfoModelValueRepresentationStrategy
(Class<VV> valueClass, Class<? extends Component> componentClass) 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.
-
Constructor Details
-
ConverterInfoModelValueRepresentationStrategy
public ConverterInfoModelValueRepresentationStrategy(Class<VV> valueClass, 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:
NullPointerException
- if the given value class and/or component class isnull
.IllegalArgumentException
- if the given component class does not have a constructor with a singleInfoModel
constructor.
-
ConverterInfoModelValueRepresentationStrategy
public ConverterInfoModelValueRepresentationStrategy(Class<? extends Component> componentClass, Converter<VV, 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:
NullPointerException
- if the given converter isnull
.IllegalArgumentException
- if the given component class does not have a constructor with a singleInfoModel
constructor.
-
-
Method Details
-
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:
-