Package io.guise.framework.component
Class TreeControl.DefaultValueRepresentationStrategy<V>
- java.lang.Object
-
- io.guise.framework.component.TreeControl.AbstractTreeNodeRepresentationStrategy<V>
-
- io.guise.framework.component.TreeControl.DefaultValueRepresentationStrategy<V>
-
- Type Parameters:
V
- The type of value the strategy is to represent.
- All Implemented Interfaces:
TreeControl.TreeNodeRepresentationStrategy<V>
- Enclosing class:
- TreeControl
public static class TreeControl.DefaultValueRepresentationStrategy<V> extends TreeControl.AbstractTreeNodeRepresentationStrategy<V>
A default tree node representation strategy. 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<V,java.lang.String> converter)
Converter constructor.DefaultValueRepresentationStrategy(java.lang.Class<V> valueClass)
Value class constructor with a default converter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <N extends V>
ComponentcreateComponent(TreeControl treeControl, TreeModel model, TreeNodeModel<N> treeNode, boolean editable, boolean selected, boolean focused)
Creates a component to represent the given tree node.Converter<V,java.lang.String>
getConverter()
-
-
-
Constructor Detail
-
DefaultValueRepresentationStrategy
public DefaultValueRepresentationStrategy(java.lang.Class<V> 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
-
getConverter
public Converter<V,java.lang.String> getConverter()
- Returns:
- The converter to use for displaying the value as a string.
-
createComponent
public <N extends V> Component createComponent(TreeControl treeControl, TreeModel model, TreeNodeModel<N> treeNode, boolean editable, boolean selected, boolean focused)
Creates a component to represent the given tree node.This implementation returns a label with string value of the given value using the object's
toString()
method.- Type Parameters:
N
- The type of value contained in the node.- Parameters:
treeControl
- The component containing the model.model
- The model containing the value.treeNode
- The node containing the value.editable
- Whether values in this column are editable.selected
-true
if the value is selected.focused
-true
if the value has the focus.- Returns:
- A new component to represent the given value.
-
-