Skip navigation links


com.essbase.eas.ui.tree
Class StandardTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.essbase.eas.ui.tree.StandardTreeNode

All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.event.CellEditorListener, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
SettingsTreeNode

public abstract class StandardTreeNode
extends javax.swing.tree.DefaultMutableTreeNode
implements javax.swing.event.CellEditorListener

extension of DefaultMutableTreeNode that provides some additional functionality. Consists of two parts: label and optional value; if the node is editable and the value can be modified, stores the horizontal position where the label ends and the value begins. This can be used by editor classes and responders to handle click vs. double click actions.

Version:
1.00, 04/04/2002
Author:
Hank Cox
See Also:
Serialized Form

Field Summary
protected  boolean editable
          used to indicate whether this node is editable or not.
protected  java.awt.Component editorComponent
          tracks the current editor component for this node; this field is non-null only when this node is being edited.
protected  int editStartPosition
          this field stores information about where the edit part of a node starts.
protected  javax.swing.Icon icon
          an icon the standard renderer can access.
protected  boolean labelOnly
          indicates whether this is a label only node.
protected  java.lang.String labelText
          the label text to use for this node.
protected  boolean modified
          indicates whether this node has been modified or not.
protected  java.lang.String valueText
          the value text to user for this node.

 

Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject

 

Constructor Summary
StandardTreeNode()
           
StandardTreeNode(java.lang.Object userObject)
           
StandardTreeNode(java.lang.Object userObject, boolean allowsChildren)
           

 

Method Summary
 void editingCanceled(javax.swing.event.ChangeEvent e)
           
 void editingStopped(javax.swing.event.ChangeEvent e)
           
 boolean getEditable()
           
 int getEditStartPosition()
           
 javax.swing.Icon getIcon()
           
 java.lang.String getLabelText()
          derived classes can override this method to dynamically retrieve the label portion of the node.
 java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
          returns an editing compenent for this object; derived classes can override this method in order to provide a specialized editor.
 java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
          returns a rendering component for this object; derived classes can override this class in order to provide a specialized renderer.
 java.lang.Object getUserObjectAs(java.lang.Class c)
          returns this node's user object in a form that is castable to the class requested.
 java.lang.String getValueText()
          derived classes can override this method to dynamically retrieve the value portion of the node.
 boolean isEditable()
           
 boolean isLabelOnly()
           
 boolean isModified()
           
protected  void labelTextNeeded()
          derived classes must override this method in order to retrieve the label text the first time it is needed.
 void release()
           
 void setEditable(boolean value)
           
 void setEditStartPosition(int value)
           
 void setIcon(javax.swing.Icon value)
           
 void setLabelOnly(boolean value)
           
 void setLabelText(java.lang.String value)
           
 void setModified(boolean value)
           
 void setValueText(java.lang.String value)
           

 

Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

icon

protected javax.swing.Icon icon
an icon the standard renderer can access.

editStartPosition

protected int editStartPosition
this field stores information about where the edit part of a node starts. A renderer can update this field when rendering a StandardTreeNode. This information can then be used by a tree's mouse event handling to determine whether clicking on the node places the tree into edit mode.

editable

protected boolean editable
used to indicate whether this node is editable or not.

modified

protected boolean modified
indicates whether this node has been modified or not.

labelText

protected java.lang.String labelText
the label text to use for this node.

labelOnly

protected boolean labelOnly
indicates whether this is a label only node.

valueText

protected java.lang.String valueText
the value text to user for this node.

editorComponent

protected java.awt.Component editorComponent
tracks the current editor component for this node; this field is non-null only when this node is being edited.

Constructor Detail

StandardTreeNode

public StandardTreeNode()

StandardTreeNode

public StandardTreeNode(java.lang.Object userObject)

StandardTreeNode

public StandardTreeNode(java.lang.Object userObject,
                        boolean allowsChildren)

Method Detail

getIcon

public javax.swing.Icon getIcon()

setIcon

public void setIcon(javax.swing.Icon value)

getEditStartPosition

public int getEditStartPosition()

setEditStartPosition

public void setEditStartPosition(int value)

getEditable

public final boolean getEditable()

isEditable

public final boolean isEditable()

setEditable

public final void setEditable(boolean value)

isModified

public boolean isModified()

setModified

public void setModified(boolean value)

setLabelOnly

public void setLabelOnly(boolean value)

isLabelOnly

public boolean isLabelOnly()

getTreeCellRendererComponent

public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree,
                                                       java.lang.Object value,
                                                       boolean sel,
                                                       boolean expanded,
                                                       boolean leaf,
                                                       int row,
                                                       boolean hasFocus)
returns a rendering component for this object; derived classes can override this class in order to provide a specialized renderer.

getTreeCellEditorComponent

public java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree,
                                                     java.lang.Object value,
                                                     boolean isSelected,
                                                     boolean expanded,
                                                     boolean leaf,
                                                     int row)
returns an editing compenent for this object; derived classes can override this method in order to provide a specialized editor.

getLabelText

public java.lang.String getLabelText()
derived classes can override this method to dynamically retrieve the label portion of the node.

setLabelText

public void setLabelText(java.lang.String value)

getValueText

public java.lang.String getValueText()
derived classes can override this method to dynamically retrieve the value portion of the node.

setValueText

public void setValueText(java.lang.String value)

getUserObjectAs

public java.lang.Object getUserObjectAs(java.lang.Class c)
returns this node's user object in a form that is castable to the class requested. If the user object isn't of that class, then returns null. To use this method, call in the following manner:

MyObject theObject = (MyObject) node.getUserObjectAs(MyObject.class);

if (theObject != null) {

... do whatever

}

This is intended to be a short cut for the following: Object obj = node.getUserObject();

if ((obj != null) && (obj instanceof MyObject)) {

MyObject theObject = (MyObject) obj;

... do whatever

}


labelTextNeeded

protected void labelTextNeeded()
derived classes must override this method in order to retrieve the label text the first time it is needed.

editingStopped

public void editingStopped(javax.swing.event.ChangeEvent e)
Specified by:
editingStopped in interface javax.swing.event.CellEditorListener

editingCanceled

public void editingCanceled(javax.swing.event.ChangeEvent e)
Specified by:
editingCanceled in interface javax.swing.event.CellEditorListener

release

public void release()

Skip navigation links


Copyright © 2001, 2012, Oracle. All rights reserved.