org.openide.explorer.view
Class NodeRenderer

java.lang.Object
  |
  +--org.openide.explorer.view.NodeRenderer
All Implemented Interfaces:
ListCellRenderer, TreeCellRenderer

public class NodeRenderer
extends Object
implements TreeCellRenderer, ListCellRenderer

Default renderer for nodes. Accepts values either Nodes directly or VisualizerNodes.

See Also:
Node, VisualizerNode

Constructor Summary
NodeRenderer()
          Creates default renderer.
NodeRenderer(boolean bigIcons)
          Creates renderer.
 
Method Summary
 Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
          This is the only method defined by ListCellRenderer.
 Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
          Finds the component that is capable of drawing the cell in a tree.
static NodeRenderer sharedInstance()
          Gets for one singleton sharedInstance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeRenderer

public NodeRenderer()
Creates default renderer.

NodeRenderer

public NodeRenderer(boolean bigIcons)
Creates renderer.
Parameters:
bigIcons - use big icons if possible
Method Detail

sharedInstance

public static NodeRenderer sharedInstance()
Gets for one singleton sharedInstance.

getTreeCellRendererComponent

public Component getTreeCellRendererComponent(JTree tree,
                                              Object value,
                                              boolean sel,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus)
Finds the component that is capable of drawing the cell in a tree.
Specified by:
getTreeCellRendererComponent in interface TreeCellRenderer
Parameters:
value - value can be either Node or a VisualizerNode.
Returns:
component to draw the value

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
This is the only method defined by ListCellRenderer. We just reconfigure the Jlabel each time we're called.
Specified by:
getListCellRendererComponent in interface ListCellRenderer


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.