net.sf.jzeno.echo.components
Class DynaTreeCellRenderer

java.lang.Object
  extended by net.sf.jzeno.echo.components.DynaTreeCellRenderer
All Implemented Interfaces:
TreeCellRenderer

public class DynaTreeCellRenderer
extends java.lang.Object
implements TreeCellRenderer


Nested Class Summary
static class DynaTreeCellRenderer.CacheEntry
           
 
Constructor Summary
DynaTreeCellRenderer()
           
 
Method Summary
 void clearCache()
           
 Component getTreeCellRendererComponent(Tree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf)
          Returns a Component that will be rendered as a Tree cell.
 Label getTreeCellRendererText(Tree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf)
          Returns a Label that will be used to render a Tree cell.
 void setModel(DynaTreeModel model)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynaTreeCellRenderer

public DynaTreeCellRenderer()
Method Detail

setModel

public void setModel(DynaTreeModel model)

getTreeCellRendererComponent

public Component getTreeCellRendererComponent(Tree tree,
                                              java.lang.Object value,
                                              boolean selected,
                                              boolean expanded,
                                              boolean leaf)
Description copied from interface: TreeCellRenderer
Returns a Component that will be rendered as a Tree cell.

If selected is true, the cell will be drawn as if selected. If expanded is true the node is currently expanded and if leaf is true the node represets a leaf tree is the Tree the receiver is being configured for.

This method is called second by the tree rendering code, and only after the getTreeCellRendererText method has returned null.

The returned Component MUST be a unqiue Component since it will be rendered as the Tree cell.

Specified by:
getTreeCellRendererComponent in interface TreeCellRenderer
Returns:
Component that is used to draw the value.

getTreeCellRendererText

public Label getTreeCellRendererText(Tree tree,
                                     java.lang.Object value,
                                     boolean selected,
                                     boolean expanded,
                                     boolean leaf)
Description copied from interface: TreeCellRenderer
Returns a Label that will be used to render a Tree cell. The following attributes are used to render the Tree cell.

If selected is true, the cell will be drawn as if selected. If expanded is true the node is currently expanded and if leaf is true the node represets a leaf tree is the Tree the receiver is being configured for.

This method is called first by the tree rendering code. If this returns null, then the getTreeCellRendererComponent method is then invoked.

The returned Label does NOT have to be a unqiue Component since only the public values of the Label are used by the the Tree rendering code. Therefore it does NOT have to be a Component in the Echo heirarchy nor does it have to be a unique Label object.

You could return the same Label object back each time this method is called, only changing the background, forground, font and icon as appropriate.

Returns the Label that is used to draw the Tree cell.

Specified by:
getTreeCellRendererText in interface TreeCellRenderer
Returns:
Label that is used to draw the Tree cell.

clearCache

public void clearCache()