com.guiseframework.component
Class TreeControl.DefaultValueRepresentationStrategy<V>

java.lang.Object
  extended by com.guiseframework.component.TreeControl.AbstractTreeNodeRepresentationStrategy<V>
      extended by com.guiseframework.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
TreeControl.DefaultValueRepresentationStrategy(java.lang.Class<V> valueClass)
          Value class constructor with a default converter.
TreeControl.DefaultValueRepresentationStrategy(Converter<V,java.lang.String> converter)
          Converter constructor.
 
Method Summary
<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.
 Converter<V,java.lang.String> getConverter()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeControl.DefaultValueRepresentationStrategy

public TreeControl.DefaultValueRepresentationStrategy(java.lang.Class<V> valueClass)
Value class constructor with a default converter. This implementation uses a DefaultStringLiteralConverter.

Parameters:
valueClass - The class indicating the type of value to convert.
Throws:
java.lang.NullPointerException - if the given value class is null.

TreeControl.DefaultValueRepresentationStrategy

public TreeControl.DefaultValueRepresentationStrategy(Converter<V,java.lang.String> converter)
Converter constructor.

Parameters:
converter - The converter to use for displaying the value as a string.
Throws:
java.lang.NullPointerException - if the given converter is null.
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.


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