y.view.hierarchy
Class HierarchyTreeCellRenderer

java.lang.Object
  |
  +--y.view.hierarchy.HierarchyTreeCellRenderer
All Implemented Interfaces:
TreeCellRenderer

public class HierarchyTreeCellRenderer
extends Object
implements TreeCellRenderer

Default TreeCellRenderer to visualize elements within HierarchyTreeModel.

This renderer uses an alternative value to render the root graph of the graph hierarchy. Node elements will be passed unchanged to a delegate tree cell renderer.


Constructor Summary
HierarchyTreeCellRenderer()
          Creates a new instance of HierarchyTreeCellRenderer.
HierarchyTreeCellRenderer(TreeCellRenderer delegateRenderer)
          Creates a new instance of HierarchyTreeCellRenderer.
 
Method Summary
 Object getRootValue()
          Returns the value used to render the root graph of the hierarchy.
 Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
           
 void setRootValue(Object value)
          Sets the value used to render the root graph of the hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HierarchyTreeCellRenderer

public HierarchyTreeCellRenderer()
Creates a new instance of HierarchyTreeCellRenderer. The renderer will use DefaultTreeCellRenderer as its delegate. Therefore nodes will be visualized by their string representation.


HierarchyTreeCellRenderer

public HierarchyTreeCellRenderer(TreeCellRenderer delegateRenderer)
Creates a new instance of HierarchyTreeCellRenderer. The renderer will use the given TreeCellRenderer as its delegate.

Method Detail

getRootValue

public Object getRootValue()
Returns the value used to render the root graph of the hierarchy.

By default the String "Root" will be returned.


setRootValue

public void setRootValue(Object value)
Sets the value used to render the root graph of the hierarchy.


getTreeCellRendererComponent

public Component getTreeCellRendererComponent(JTree tree,
                                              Object value,
                                              boolean sel,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus)
Specified by:
getTreeCellRendererComponent in interface TreeCellRenderer

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003