|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nextapp.echo.Component nextapp.echo.Label echopoint.tree.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 Label 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 TreeCellRenderer
class 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.
Nested Class Summary | |
static class |
DefaultTreeCellRenderer.NestedStyleInfo
Nested public static StyleInfo class. |
Field Summary | |
static java.lang.String |
STYLE_BACKGROUND_NON_SELECTION_COLOR
A style constant for the Background Non Selection Color property. |
static java.lang.String |
STYLE_BACKGROUND_SELECTION_COLOR
A style constant for the Background Selection Color property. |
static java.lang.String |
STYLE_TEXT_NON_SELECTION_COLOR
A style constant for the Text Non Selection Color property. |
static java.lang.String |
STYLE_TEXT_SELECTION_COLOR
A style constant for the Text Selection Color property. |
Fields inherited from class nextapp.echo.Label |
HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, ICON_TEXT_MARGIN_CHANGED_PROPERTY, STYLE_HORIZONTAL_ALIGNMENT, STYLE_HORIZONTAL_TEXT_POSITION, STYLE_ICON_TEXT_MARGIN, STYLE_VERTICAL_ALIGNMENT, STYLE_VERTICAL_TEXT_POSITION, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY |
Fields inherited from class nextapp.echo.Component |
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY |
Constructor Summary | |
DefaultTreeCellRenderer()
Creates a new instance of DefaultTreeCellRenderer. |
Method Summary | |
void |
applyStyle(nextapp.echo.Style style)
|
nextapp.echo.Color |
getBackgroundNonSelectionColor()
Returns the background color to be used for non selected nodes. |
nextapp.echo.Color |
getBackgroundSelectionColor()
Returns the color to use for the background if node is selected. |
nextapp.echo.Color |
getTextNonSelectionColor()
Returns the color the text is drawn with when the node isn't selected. |
nextapp.echo.Color |
getTextSelectionColor()
Returns the color the text is drawn with when the node is selected. |
nextapp.echo.Component |
getTreeCellRendererComponent(Tree tree,
java.lang.Object node,
boolean selected,
boolean expanded,
boolean leaf)
If the value is a Component then it will be returned as is, otherwise it returns null. |
nextapp.echo.Label |
getTreeCellRendererText(Tree tree,
java.lang.Object node,
boolean sel,
boolean expanded,
boolean leaf)
Configures the renderer based on the passed in parameters. |
java.lang.Object |
set(java.lang.reflect.Field field,
java.lang.Object newValue)
Called to save the old value of a field, set in a new value and return the old value of a field. |
void |
setBackgroundNonSelectionColor(nextapp.echo.Color newColor)
Sets the background color to be used for non selected nodes. |
void |
setBackgroundSelectionColor(nextapp.echo.Color newColor)
Sets the color to use for the background if node is selected. |
void |
setTextNonSelectionColor(nextapp.echo.Color newColor)
Sets the color the text is drawn with when the node isn't selected. |
void |
setTextSelectionColor(nextapp.echo.Color newColor)
Sets the color the text is drawn with when the node is selected. |
Methods inherited from class nextapp.echo.Label |
getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextMargin, getText, getVerticalAlignment, getVerticalTextPosition, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextMargin, setText, setVerticalAlignment, setVerticalTextPosition |
Methods inherited from class nextapp.echo.Component |
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String STYLE_BACKGROUND_NON_SELECTION_COLOR
nextapp.echo.Color.
public static final java.lang.String STYLE_BACKGROUND_SELECTION_COLOR
nextapp.echo.Color.
public static final java.lang.String STYLE_TEXT_NON_SELECTION_COLOR
nextapp.echo.Color.
public static final java.lang.String STYLE_TEXT_SELECTION_COLOR
nextapp.echo.Color.
Constructor Detail |
public DefaultTreeCellRenderer()
Method Detail |
public void applyStyle(nextapp.echo.Style style)
Component.applyStyle(nextapp.echo.Style)
public nextapp.echo.Color getBackgroundNonSelectionColor()
public nextapp.echo.Color getBackgroundSelectionColor()
public nextapp.echo.Color getTextNonSelectionColor()
public nextapp.echo.Color getTextSelectionColor()
public nextapp.echo.Component getTreeCellRendererComponent(Tree tree, java.lang.Object node, boolean selected, boolean expanded, boolean leaf)
getTreeCellRendererComponent
in interface TreeCellRenderer
public nextapp.echo.Label getTreeCellRendererText(Tree tree, java.lang.Object node, boolean sel, boolean expanded, boolean leaf)
leaf
and expanded
.
The same Label object is returned for each call to this method. The Tree rendering code uses only the public properties of the return Label. In fact since DefaultTreeCellRenderer is derived from Label it simply returns itself.
getTreeCellRendererText
in interface TreeCellRenderer
public void setBackgroundNonSelectionColor(nextapp.echo.Color newColor)
public void setBackgroundSelectionColor(nextapp.echo.Color newColor)
public void setTextNonSelectionColor(nextapp.echo.Color newColor)
public void setTextSelectionColor(nextapp.echo.Color newColor)
public java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue) throws java.lang.Exception
ReflectionSetter
public Object set(Field f, Object newValue) throws Exception { Object oldValue = f.get(this); f.set(this,newValue); return oldValue; }
set
in interface ReflectionSetter
field
- - the field to be setnewValue
- - the new value to be set
java.lang.Exception
ReflectionSetter.set(Field, Object)
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |