|
EchoPoint 2.1.0rc5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnextapp.echo2.app.Component
nextapp.echo2.app.Label
echopointng.tree.DefaultTreeCellRenderer
public class DefaultTreeCellRenderer
Used to display an entry in a tree. If the tree cell value is a DefaultMutableTreeNode and its user object is a Component then the DefaultTreeCellRenderer will return null on getTreeCellRenderText and return the Component in getTreeCellRendererComponent.
Otherwise it will "cast" the cell value to a String via toString() and return a LabelEx via the getTreeCellRenderText method. It uses the Tree's TreeIcon object to obtain an icon for "parent" and "leaf" nodes.
You can derived your own TreeCellRendererclass from this one and
specify your own icons for each node if you wish.
Note that this class also has Style support so you can set appearance attributes via a Style object or the EchoPoint CSS support.
The standard LabelEx background, foreground and font properties are used for non selected tree cell nodes. The selectedBackground, selectedForeground and selectedFont properties are used for selected tree cell nodes.
| Field Summary | |
|---|---|
static Font |
DEFAULT_FONT
The default Tree Cell Font |
static Color |
DEFAULT_SELECTED_BACKGROUND
The default Selected Tree Cell Background |
static Font |
DEFAULT_SELECTED_FONT
The default Selected Tree Cell Font |
static Color |
DEFAULT_SELECTED_FOREGROUND
The default Selected Tree Cell FOREGROUND |
static String |
PROPERTY_SELECTED_BACKGROUND
|
static String |
PROPERTY_SELECTED_FONT
|
static String |
PROPERTY_SELECTED_FOREGROUND
|
static Font.Typeface |
TYPEFACE
|
| Fields inherited from class nextapp.echo2.app.Label |
|---|
PROPERTY_ICON, PROPERTY_ICON_TEXT_MARGIN, PROPERTY_LINE_WRAP, PROPERTY_TEXT, PROPERTY_TEXT_ALIGNMENT, PROPERTY_TEXT_POSITION, PROPERTY_TOOL_TIP_TEXT |
| Constructor Summary | |
|---|---|
DefaultTreeCellRenderer()
Creates a new instance of DefaultTreeCellRenderer. |
|
| Method Summary | |
|---|---|
Color |
getSelectedBackground()
|
Font |
getSelectedFont()
|
Color |
getSelectedForeground()
|
Component |
getTreeCellRendererComponent(Tree tree,
Object node,
boolean selected,
boolean expanded,
boolean leaf)
Returns a Component that will be rendered as a Tree cell. |
Label |
getTreeCellRendererText(Tree tree,
Object node,
boolean sel,
boolean expanded,
boolean leaf)
Configures the renderer based on the passed in parameters. |
XhtmlFragment |
getTreeCellRendererXhtml(Tree tree,
Object node,
boolean selected,
boolean expanded,
boolean leaf)
Returns a XhtmlFragment that will be rendered as a Tree
cell. |
void |
setBackground(Color newValue)
|
void |
setFont(Font newValue)
|
void |
setForeground(Color newValue)
|
void |
setSelectedBackground(Color newValue)
Sets the background color to be used for selected tree cell nodes. |
void |
setSelectedFont(Font newValue)
Sets the font to be used for selected tree cell nodes. |
void |
setSelectedForeground(Color newValue)
Sets the foreground color to be used for selected tree cell nodes. |
| Methods inherited from class nextapp.echo2.app.Label |
|---|
getIcon, getIconTextMargin, getText, getTextAlignment, getTextPosition, getToolTipText, isLineWrap, isValidChild, setIcon, setIconTextMargin, setLineWrap, setText, setTextAlignment, setTextPosition, setToolTipText |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Font.Typeface TYPEFACE
public static final Font DEFAULT_FONT
public static final Color DEFAULT_SELECTED_BACKGROUND
public static final Color DEFAULT_SELECTED_FOREGROUND
public static final Font DEFAULT_SELECTED_FONT
public static final String PROPERTY_SELECTED_BACKGROUND
public static final String PROPERTY_SELECTED_FOREGROUND
public static final String PROPERTY_SELECTED_FONT
| Constructor Detail |
|---|
public DefaultTreeCellRenderer()
| Method Detail |
|---|
public Color getSelectedBackground()
public Color getSelectedForeground()
public Font getSelectedFont()
public void setSelectedBackground(Color newValue)
newValue - - The newValue to set.public void setSelectedForeground(Color newValue)
newValue - - The newValue to set.public void setSelectedFont(Font newValue)
newValue - - The newValue to set.public void setBackground(Color newValue)
setBackground in class ComponentComponent.setBackground(nextapp.echo2.app.Color)public void setForeground(Color newValue)
setForeground in class ComponentComponent.setForeground(nextapp.echo2.app.Color)public void setFont(Font newValue)
setFont in class ComponentComponent.setFont(nextapp.echo2.app.Font)
public Component getTreeCellRendererComponent(Tree tree,
Object node,
boolean selected,
boolean expanded,
boolean leaf)
TreeCellRenderer
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.
getTreeCellRendererComponent in interface TreeCellRendererTreeCellRenderer.getTreeCellRendererComponent(Tree, Object, boolean, boolean, boolean)
public XhtmlFragment getTreeCellRendererXhtml(Tree tree,
Object node,
boolean selected,
boolean expanded,
boolean leaf)
TreeCellRendererXhtmlFragment 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.
getTreeCellRendererXhtml in interface TreeCellRendererTreeCellRenderer.getTreeCellRendererXhtml(echopointng.Tree, java.lang.Object, boolean, boolean, boolean)
public Label getTreeCellRendererText(Tree tree,
Object node,
boolean sel,
boolean expanded,
boolean leaf)
The foreground color of the LabelEx is set based on the selection while
the icon is set based on on leaf and expanded.
The same LabelEx object is returned for each call to this method. The Tree rendering code uses only the public properties of the return LabelEx. In fact since DefaultTreeCellRenderer is derived from LabelEx it simply returns itself.
getTreeCellRendererText in interface TreeCellRendererTreeCellRenderer.getTreeCellRendererText(Tree, Object, boolean, boolean, boolean)
|
EchoPoint 2.1.0rc5 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||