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:
-
Constructor Summary
ConstructorDescriptionDefaultValueRepresentationStrategy
(Converter<V, String> converter) Converter constructor.DefaultValueRepresentationStrategy
(Class<V> valueClass) Value class constructor with a default converter. -
Method Summary
Modifier and TypeMethodDescriptioncreateComponent
(TreeControl treeControl, TreeModel model, TreeNodeModel<N> treeNode, boolean editable, boolean selected, boolean focused) Creates a component to represent the given tree node.
-
Constructor Details
-
DefaultValueRepresentationStrategy
Value class constructor with a default converter. This implementation uses aDefaultStringLiteralConverter
.- Parameters:
valueClass
- The class indicating the type of value to convert.- Throws:
NullPointerException
- if the given value class isnull
.
-
DefaultValueRepresentationStrategy
Converter constructor.- Parameters:
converter
- The converter to use for displaying the value as a string.- Throws:
NullPointerException
- if the given converter isnull
.
-
-
Method Details
-
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.
-