org.jdesktop.swingx.renderer
Class DefaultTreeRenderer

java.lang.Object
  extended by org.jdesktop.swingx.renderer.DefaultTreeRenderer
All Implemented Interfaces:
Serializable, TreeCellRenderer, RolloverRenderer

public class DefaultTreeRenderer
extends Object
implements TreeCellRenderer, RolloverRenderer, Serializable

Adapter to glue SwingX renderer support to core api.

See Also:
Serialized Form

Field Summary
protected  ComponentProvider componentController
           
 
Constructor Summary
DefaultTreeRenderer()
          Instantiates a default tree renderer with the default component controller.
DefaultTreeRenderer(ComponentProvider componentController)
          Instantiates a default tree renderer with the given componentController.
DefaultTreeRenderer(StringValue converter)
          Instantiates a default table renderer with a default component controller using the given converter.
 
Method Summary
 void doClick()
          Same as AbstractButton.doClick().
 Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
          Returns a configured component, appropriate to render the given tree cell.
 boolean isEnabled()
          
 void setBackground(Color background)
           
 void setForeground(Color foreground)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

componentController

protected ComponentProvider componentController
Constructor Detail

DefaultTreeRenderer

public DefaultTreeRenderer()
Instantiates a default tree renderer with the default component controller.


DefaultTreeRenderer

public DefaultTreeRenderer(ComponentProvider componentController)
Instantiates a default tree renderer with the given componentController. If the controller is null, creates and uses a default. The default controller is of type WrappingProvider.

Parameters:
componentController - the provider of the configured component to use for cell rendering

DefaultTreeRenderer

public DefaultTreeRenderer(StringValue converter)
Instantiates a default table renderer with a default component controller using the given converter.

Parameters:
converter - the converter to use for mapping the content value to a String representation.
Method Detail

getTreeCellRendererComponent

public Component getTreeCellRendererComponent(JTree tree,
                                              Object value,
                                              boolean selected,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus)
Returns a configured component, appropriate to render the given tree cell.

Specified by:
getTreeCellRendererComponent in interface TreeCellRenderer
Parameters:
tree - the JTree
value - the value to assign to the cell
selected - true if cell is selected
expanded - true if the cell is expanded
leaf - true if the cell is a leaf
hasFocus - true if cell has focus
row - the row of the cell to render
Returns:
a component to render the given list cell.

setBackground

public void setBackground(Color background)
Parameters:
background -

setForeground

public void setForeground(Color foreground)
Parameters:
foreground -

doClick

public void doClick()
Same as AbstractButton.doClick(). It's up to client code to prepare the renderer's component before calling this method.

Specified by:
doClick in interface RolloverRenderer

isEnabled

public boolean isEnabled()

Specified by:
isEnabled in interface RolloverRenderer
Returns:
true if rollover effects are on and clickable.