org.openide.explorer 6.5.22 1

org.openide.explorer.view
Class NodeRenderer

java.lang.Object
  extended by org.openide.explorer.view.NodeRenderer
All Implemented Interfaces:
ListCellRenderer, TreeCellRenderer

public class NodeRenderer
extends Object
implements TreeCellRenderer, ListCellRenderer

Default renderer for nodes. Can paint either Nodes directly or can be used to paint objects produced by NodeTreeModel, etc.

See Also:
Node

Constructor Summary
NodeRenderer()
          Creates default renderer.
NodeRenderer(boolean bigIcons)
          Deprecated. bigIcons was only used by IconView, and not used by that anymore. NodeRenderer will automatically detect if the view it's rendering for is an instance of IconView.
 
Method Summary
 Component getListCellRendererComponent(JList list, Object value, int index, boolean sel, 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()
          Deprecated. This method no longer returns a shared instance, as it caused problems with one view setting properties (such as enabled state) on the renderer and the renderer then being used in its altered state by a different view. Views should create their own instance of NodeRenderer instead.
 
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)
Deprecated. bigIcons was only used by IconView, and not used by that anymore. NodeRenderer will automatically detect if the view it's rendering for is an instance of IconView.

Creates renderer.

Parameters:
bigIcons - use big icons if possible
Method Detail

sharedInstance

public static NodeRenderer sharedInstance()
Deprecated. This method no longer returns a shared instance, as it caused problems with one view setting properties (such as enabled state) on the renderer and the renderer then being used in its altered state by a different view. Views should create their own instance of NodeRenderer instead.

Get the singleton instance used by all explorer views.


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 sel,
                                              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

org.openide.explorer 6.5.22 1

Built on July 11 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.