EchoPoint
2.1.0rc5

echopointng.tree
Interface TreeCellRenderer

All Known Implementing Classes:
DefaultTreeCellRenderer

public interface TreeCellRenderer

The TreeCellRender is responsible for returning Components used to render a Tree node. In the most general form the getTreeCellRendererText method will be called to return a LabelEx component that contains the tree node's :

A more specific case is when a Component is to be returned as the Tree cell. In this case the getTreeCellRendererComponent method will be called to provide the component for the Tree cell.


Method Summary
 Component getTreeCellRendererComponent(Tree tree, Object value, boolean selected, boolean expanded, boolean leaf)
          Returns a Component that will be rendered as a Tree cell.
 Label getTreeCellRendererText(Tree tree, Object value, boolean selected, boolean expanded, boolean leaf)
          Returns a LabelEx that will be used to render a Tree cell.
 XhtmlFragment getTreeCellRendererXhtml(Tree tree, Object value, boolean selected, boolean expanded, boolean leaf)
          Returns a XhtmlFragment that will be rendered as a Tree cell.
 

Method Detail

getTreeCellRendererComponent

Component getTreeCellRendererComponent(Tree tree,
                                       Object value,
                                       boolean selected,
                                       boolean expanded,
                                       boolean leaf)
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.

Returns:
Component that is used to draw the value.

getTreeCellRendererText

Label getTreeCellRendererText(Tree tree,
                              Object value,
                              boolean selected,
                              boolean expanded,
                              boolean leaf)
Returns a LabelEx 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 LabelEx does NOT have to be a unique Component since only the public values of the LabelEx are used by the the Tree rendering code. Therefore it does NOT have to be a Component in the Echo hierarchy nor does it have to be a unique LabelEx object.

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

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

Returns:
LabelEx that is used to draw the Tree cell.

getTreeCellRendererXhtml

XhtmlFragment getTreeCellRendererXhtml(Tree tree,
                                       Object value,
                                       boolean selected,
                                       boolean expanded,
                                       boolean leaf)
Returns a XhtmlFragment 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 third by the Tree rendering code, and only after the getTreeCellRendererText and getTreeCellRendererComponent method have returned null.

Returns:
the XhtmlFragment that is used to draw the cell value.

EchoPoint
2.1.0rc5