com.guiseframework.component
Class AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy<VV>

java.lang.Object
  extended by com.guiseframework.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 single InfoModel as an argument.

Author:
Garret Wilson

Constructor Summary
AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy(java.lang.Class<? extends Component> componentClass, Converter<VV,java.lang.String> converter)
          Converter constructor.
AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy(java.lang.Class<VV> valueClass, java.lang.Class<? extends Component> componentClass)
          Value class constructor with a default converter.
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy

public AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy(java.lang.Class<VV> valueClass,
                                                                               java.lang.Class<? extends Component> componentClass)
Value class constructor with a default converter. This implementation uses a DefaultStringLiteralConverter.

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 is null.
java.lang.IllegalArgumentException - if the given component class does not have a constructor with a single InfoModel constructor.

AbstractListSelectControl.ConverterInfoModelValueRepresentationStrategy

public AbstractListSelectControl.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 is null.
java.lang.IllegalArgumentException - if the given component class does not have a constructor with a single InfoModel 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 interface ListSelectControl.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()


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.