EchoPoint
2.1.0rc5

echopointng
Class Tree

java.lang.Object
  extended by nextapp.echo2.app.Component
      extended by echopointng.ComponentEx
          extended by echopointng.AbleComponent
              extended by echopointng.Tree
All Implemented Interfaces:
AccessKeyable, Attributeable, Borderable, Delegateable, Heightable, Insetable, MouseCursorable, Sizeable, ToolTipable, Widthable, Serializable, RenderIdSupport

public class Tree
extends AbleComponent

The Tree component displays data in a hierarchial manner. The API for this Component has based heavily on the Swing JTree class.

A Tree only renders the visible nodes and an event is generated to expand or collapse nodes as well as when the user clicks on a node. This allows the application to insert more nodes as necessary or on a "just in time" basis.

Tree also supports node selection via its TreeSelectionModel.

The Tree component supports "bubbling up" actions.

If the objects placed in the Tree implement TreeNode then an action command can be identified with each node. When a node is pressed, the associated action command will be raised with any ActionListeners of the Tree. If no action command is associated with a TreeNode then the path to the ancestors will be followed to look for an action command. If no action command can be found, then the action command of the tree itself will be used.

If you call setNullActionCommandsRaiseEvents(false) then action events will not be raised for TreeNodes that have null action commands. It is TRUE by default.

See Also:
TreeModel, DefaultTreeModel, TreeCellRenderer, DefaultTreeCellRenderer, TreeNode, MutableTreeNode, DefaultMutableTreeNode, Serialized Form

Nested Class Summary
protected  class Tree.TreeModelHandler
          Listens to the model and updates the expandedState accordingly when nodes are removed, or changed.
protected  class Tree.TreeRowMapper
          Handles the RowMapper interface for the tree
protected  class Tree.TreeSelectionForwarder
          Handles creating a new TreeSelectionEvent with the Tree as the source and passing it off to all the listeners.
 
Field Summary
static Style DEFAULT_STYLE
           
static String INPUT_SELECT
          Used as an INPUT name to indicate that a node is to be selected
static String INPUT_TOGGLE
          Used as an INPUT name to indicate that a node is to be toggled, ie expanded or contracted
static String MODEL_STRUCTURE_CHANGED_PROPERTY
           
static String NODE_CHANGED_PROPERTY
           
static String PROPERTY_ACTION_COMMAND
           
static String PROPERTY_CELL_RENDERER
           
static String PROPERTY_CELL_WIDTH_CONTRAINED
           
static String PROPERTY_LINES_DRAWN
           
static String PROPERTY_MODEL
           
static String PROPERTY_NULL_ACTION_COMMANDS_RAISE_EVENTS
           
static String PROPERTY_PARTIAL_UPDATE_SUPPORT
           
static String PROPERTY_ROOT_AUTO_EXPANDED
           
static String PROPERTY_ROOT_VISIBLE
           
static String PROPERTY_ROW_HEIGHT
           
static String PROPERTY_SCROLL_INTO_VIEW_USED
           
static String PROPERTY_SELECTION_INCLUDES_ICON
           
static String PROPERTY_SELECTION_MODEL
           
static String PROPERTY_SHOWS_ROOT_HANDLES
           
static String PROPERTY_TREE_ICONS
           
 
Fields inherited from class echopointng.ComponentEx
PROPERTY_HIDDEN
 
Fields inherited from class nextapp.echo2.app.Component
CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopointng.able.AccessKeyable
PROPERTY_ACCESS_KEY
 
Fields inherited from interface echopointng.able.Borderable
PROPERTY_BORDER
 
Fields inherited from interface echopointng.able.MouseCursorable
CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, PROPERTY_MOUSE_CURSOR, PROPERTY_MOUSE_CURSOR_URI
 
Fields inherited from interface echopointng.able.Insetable
DEFAULT_INSETS, DEFAULT_OUTSETS, PROPERTY_INSETS, PROPERTY_OUTSETS
 
Fields inherited from interface echopointng.able.Widthable
PROPERTY_WIDTH
 
Fields inherited from interface echopointng.able.Heightable
PROPERTY_HEIGHT
 
Fields inherited from interface echopointng.able.ToolTipable
PROPERTY_TOOL_TIP_TEXT
 
Constructor Summary
Tree()
          Returns a Tree with a DefaultMutableTreeNode as its root, which displays the root node.
Tree(TreeModel newModel)
          Returns an instance of a Tree which displays the root node and is created using the specified data model.
Tree(TreeNode root)
          Returns a Tree with the specified TreeNode as its root, which displays the root node.
Tree(TreeNode root, boolean asksAllowsChildren)
          Returns a Tree with the specified TreeNode as its root, which displays the root node and which decides whether a node is a leaf node in the specified manner.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds an ActionListener.
 void addSelectionPath(TreePath path)
          Adds the node identified by the specified TreePath to the current selection.
 void addSelectionPaths(TreePath[] paths)
          Adds each path in the array of paths to the current selection.
 void addTreeExpansionListener(TreeExpansionListener tel)
          Adds a listener for TreeExpansion events.
 void addTreeSelectionListener(TreeSelectionListener tsl)
          Adds a listener for TreeSelection events.
 void addTreeWillExpandListener(TreeWillExpandListener tel)
          Adds a listener for TreeWillExpand events.
protected  void clearToggledPaths()
          Clears the cache of toggled tree paths.
 void collapseAll()
          Ensures that all the nodes in the tree are collapsed
 void collapsePath(TreePath path)
          Ensures that the node identified by the specified path is collapsed and viewable.
 void collapseRow(int row)
          Ensures that the node in the specified row is collapsed.
protected  TreeModelListener createTreeModelListener()
          Creates and returns an instance of TreeModelListener.
 void expandAll()
          Ensures that all the nodes are expanded and viewable.
 void expandPath(TreePath path)
          Ensures that the node identified by the specified path is expanded and viewable.
 void expandRow(int row)
          Ensures that the node in the specified row is expanded and viewable.
 void fireActionPerformed(ActionEvent e)
          Notifies all listeners that have registered for this event type.
 void fireTreeCollapsed(TreePath path)
          Notify all listeners that have registered interest for notification on this event type.
 void fireTreeExpanded(TreePath path)
          Notify all listeners that have registered interest for notification on this event type.
 void fireTreeWillCollapse(TreePath path)
          Notify all listeners that have registered interest for notification on this event type.
 void fireTreeWillExpand(TreePath path)
          Notify all listeners that have registered interest for notification on this event type.
protected  void fireValueChanged(TreeSelectionEvent e)
          Notify all listeners that have registered interest for notification on this event type.
 String getActionCommand()
          Returns the action command string of the Tree
 TreeCellRenderer getCellRenderer()
          Returns the current TreeCellRenderer that is rendering each cell.
 Component getComponent(Object treeNode)
          Returns the Component that will be used to render the provided tree node.
protected  Enumeration getDescendantToggledPaths(TreePath parent)
          Returns an Enumeration of TreePaths that have been expanded that are descendants of parent.
 Collection getDirtyPaths()
           
 Enumeration getExpandedDescendants(TreePath parent)
          Returns an Enumeration of the descendants of path that are currently expanded.
 Collection getLastExpandedPaths()
          This will return a collection of TresePath that have expanded within the Tree.
 Object getLastSelectedPathComponent()
          Returns the last path component in the first node of the current selection.
 TreePath getLeadSelectionPath()
          Returns the path of the last node added to the selection.
 TreeModel getModel()
          Returns the TreeModel that is providing the data.
 boolean getPartialUpdateSupport()
          Returns true if the partial update support is currently enabled.
 TreePath getPathForRow(int row)
          Returns the path for the specified row.
 int getRowCount()
          Returns the number of rows that are currently being displayed in the Tree.
 int getRowForPath(TreePath path)
          Returns the row that the TreePath path is being displayed at.
 int getRowHeight()
          Returns the row height to be used for each row within the Tree.
 int[] getRowsForPaths(TreePath[] paths)
          Returns the rows that the TreePath instances in path are being displayed at.
 int getSelectionCount()
          Returns the number of nodes selected.
 TreeSelectionModel getSelectionModel()
          Returns the model for selections.
 TreePath getSelectionPath()
          Returns the path to the first selected node.
 TreePath[] getSelectionPaths()
          Returns the paths of all selected values.
 boolean getShowsRootHandles()
          Returns true if handles for the root nodes are displayed.
 TreeIcons getTreeIcons()
          Returns the TreeIcons being used by the Tree
 boolean hasEverBeenExpanded(TreePath path)
          Returns true if the node identified by the path has ever been expanded.
 void invalidate()
          Marks the Tree as needing to be re-rendered.
 boolean isCellWidthConstrained()
          Returns true if the Tree cells use as much UI width as possible or false if the cells try to contrain their UI width.
 boolean isCollapsed(int row)
          Returns true if the node at the specified display row is collapsed.
 boolean isCollapsed(TreePath path)
          Returns true if the value identified by path is currently collapsed, this will return false if any of the values in path are currently not being displayed.
 boolean isExpanded(int row)
          Returns true if the node at the specified display row is currently expanded.
 boolean isExpanded(TreePath path)
          Returns true if the node identified by the path is currently expanded,
 boolean isLinesDrawn()
          Returns true if lines are drawn between tree nodes.
 boolean isNullActionCommandsRaiseEvents()
          Returns TRUE of TreeNode's with 'null' action commands will still raise events by bubbling up the Tree.
 boolean isPathSelected(TreePath path)
          Returns true if the item identified by the path is currently selected.
 boolean isRootAutoExpanded()
          Returns true if the root node of the tree is expanded when the TreeModel is first set.
 boolean isRootVisible()
          Returns true if the root node of the tree is displayed.
 boolean isScrollIntoViewUsed()
           
 boolean isSelectionEmpty()
          Returns true if the selection is currently empty.
 boolean isSelectionIncludesIcon()
           
 boolean isVisible(TreePath path)
          Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are exapnded , Otherwise, this method returns false.
 void makeVisible(TreePath path)
          Ensures that the node identified by path is currently viewable.
 void processInput(String name, Object value)
           
 void removeActionListener(ActionListener l)
          Removes an ActionListener.
protected  void removeDescendantToggledPaths(Enumeration toRemove)
          Removes any descendants of the TreePaths in toRemove that have been expanded.
 void removeSelectionPath(TreePath path)
          Removes the node identified by the specified path from the current selection.
 void removeSelectionPaths(TreePath[] paths)
          Removes the nodes identified by the specified paths from the current selection.
 void removeTreeExpansionListener(TreeExpansionListener tel)
          Removes a listener for TreeExpansion events.
 void removeTreeSelectionListener(TreeSelectionListener tsl)
          Removes a TreeSelection listener.
 void removeTreeWillExpandListener(TreeWillExpandListener tel)
          Removes a listener for TreeWillExpand events.
 void setActionCommand(String newActionCommand)
          Sets the action command string of the Tree.
 void setCellRenderer(TreeCellRenderer newCellRenderer)
          Sets the TreeCellRenderer that will be used to draw each cell.
 void setCellWidthConstrained(boolean newValue)
          Set to true if the Tree cells use as much UI width as possible or false if the cells try to contrain their UI width.
 void setEnabled(boolean newValue)
           
protected  void setExpandedState(TreePath path, boolean state)
          Sets the expanded state of the path.
 void setLinesDrawn(boolean newDrawLines)
          Sets whether lines are drawn between tree nodes
 void setModel(TreeModel newTreeModel)
          Sets the TreeModel that will provide the data.
 void setNullActionCommandsRaiseEvents(boolean newValue)
          Sets whether TreeNode null action commands will cause an event to be raised.
 void setPartialUpdateSupport(boolean newValue)
          If this is set to true, the Tree rendering code is given a hint on whether it can perform partial updates to speed up visual performance.
 void setRootAutoExpanded(boolean rootExpanded)
          Determines whether or not the root node from the TreeModel is automatically expanded when the model is set into the Tree.
 void setRootVisible(boolean rootVisible)
          Determines whether or not the root node from the TreeModel is visible.
 void setRowHeight(int newRowHeight)
          Sets the row height to be used for each row within the Tree.
 void setScrollIntoViewUsed(boolean newValue)
          Tree has the ability to "scroll" a peer or child into view when a node is expanded.
 void setSelectionIncludesIcon(boolean newValue)
          Set to true if the selection of a tree node includes the area around the node icon or false if it does not.
 void setSelectionModel(TreeSelectionModel newSelectionModel)
          Sets the tree's selection model.
 void setSelectionPath(TreePath path)
          Selects the node identified by the specified path.
 void setSelectionPaths(TreePath[] paths)
          Selects the nodes identified by the specified array of paths.
 void setShowsRootHandles(boolean newValue)
          Determines whether the node handles are to be displayed.
 void setTreeIcons(TreeIcons newTreeIcons)
          Sets the TreeIcons being used by the Tree
 void setVisible(boolean newValue)
           
 void toggleAllNodes(TreePath parentPath, boolean expand)
          Toggles all nodes as expanded or collapsed depending on expand starting from parentPath.
 void validate()
          Called just before the tree is rendered.
 
Methods inherited from class echopointng.AbleComponent
getAccessKey, getBorder, getHeight, getInsets, getMouseCursor, getMouseCursorUri, getOutsets, getToolTipText, getWidth, setAccessKey, setBorder, setHeight, setInsets, setMouseCursor, setMouseCursorUri, setOutsets, setToolTipText, setWidth
 
Methods inherited from class echopointng.ComponentEx
getAttribute, getAttributeNames, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, getRenderProperty, isHidden, setAttribute, setHidden, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty
 
Methods inherited from class nextapp.echo2.app.Component
add, add, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidChild, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, setBackground, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setRenderId, setStyle, setStyleName, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 
Methods inherited from interface echopointng.able.Delegateable
getRenderProperty, getRenderProperty
 

Field Detail

INPUT_TOGGLE

public static final String INPUT_TOGGLE
Used as an INPUT name to indicate that a node is to be toggled, ie expanded or contracted

See Also:
Constant Field Values

INPUT_SELECT

public static final String INPUT_SELECT
Used as an INPUT name to indicate that a node is to be selected

See Also:
Constant Field Values

PROPERTY_ACTION_COMMAND

public static final String PROPERTY_ACTION_COMMAND
See Also:
Constant Field Values

PROPERTY_CELL_RENDERER

public static final String PROPERTY_CELL_RENDERER
See Also:
Constant Field Values

PROPERTY_LINES_DRAWN

public static final String PROPERTY_LINES_DRAWN
See Also:
Constant Field Values

PROPERTY_NULL_ACTION_COMMANDS_RAISE_EVENTS

public static final String PROPERTY_NULL_ACTION_COMMANDS_RAISE_EVENTS
See Also:
Constant Field Values

PROPERTY_ROOT_VISIBLE

public static final String PROPERTY_ROOT_VISIBLE
See Also:
Constant Field Values

PROPERTY_ROW_HEIGHT

public static final String PROPERTY_ROW_HEIGHT
See Also:
Constant Field Values

PROPERTY_SELECTION_MODEL

public static final String PROPERTY_SELECTION_MODEL
See Also:
Constant Field Values

PROPERTY_SHOWS_ROOT_HANDLES

public static final String PROPERTY_SHOWS_ROOT_HANDLES
See Also:
Constant Field Values

PROPERTY_TREE_ICONS

public static final String PROPERTY_TREE_ICONS
See Also:
Constant Field Values

PROPERTY_MODEL

public static final String PROPERTY_MODEL
See Also:
Constant Field Values

PROPERTY_ROOT_AUTO_EXPANDED

public static final String PROPERTY_ROOT_AUTO_EXPANDED
See Also:
Constant Field Values

PROPERTY_PARTIAL_UPDATE_SUPPORT

public static final String PROPERTY_PARTIAL_UPDATE_SUPPORT
See Also:
Constant Field Values

PROPERTY_CELL_WIDTH_CONTRAINED

public static final String PROPERTY_CELL_WIDTH_CONTRAINED
See Also:
Constant Field Values

PROPERTY_SELECTION_INCLUDES_ICON

public static final String PROPERTY_SELECTION_INCLUDES_ICON
See Also:
Constant Field Values

PROPERTY_SCROLL_INTO_VIEW_USED

public static final String PROPERTY_SCROLL_INTO_VIEW_USED
See Also:
Constant Field Values

NODE_CHANGED_PROPERTY

public static final String NODE_CHANGED_PROPERTY
See Also:
Constant Field Values

MODEL_STRUCTURE_CHANGED_PROPERTY

public static final String MODEL_STRUCTURE_CHANGED_PROPERTY
See Also:
Constant Field Values

DEFAULT_STYLE

public static final Style DEFAULT_STYLE
Constructor Detail

Tree

public Tree()
Returns a Tree with a DefaultMutableTreeNode as its root, which displays the root node.


Tree

public Tree(TreeNode root)
Returns a Tree with the specified TreeNode as its root, which displays the root node.


Tree

public Tree(TreeNode root,
            boolean asksAllowsChildren)
Returns a Tree with the specified TreeNode as its root, which displays the root node and which decides whether a node is a leaf node in the specified manner.


Tree

public Tree(TreeModel newModel)
Returns an instance of a Tree which displays the root node and is created using the specified data model.

Method Detail

processInput

public void processInput(String name,
                         Object value)
Overrides:
processInput in class Component
See Also:
Component.processInput(java.lang.String, java.lang.Object)

addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener.

Parameters:
l - The ActionListener to be added.

addSelectionPath

public void addSelectionPath(TreePath path)
Adds the node identified by the specified TreePath to the current selection. If any component of the path isn't viewable, it is made viewable.

Parameters:
path - the TreePath to add

addSelectionPaths

public void addSelectionPaths(TreePath[] paths)
Adds each path in the array of paths to the current selection. If any component of any of the paths isn't viewable, it is made viewable.

Parameters:
paths - an array of TreePath objects that specifies the nodes to add

addTreeExpansionListener

public void addTreeExpansionListener(TreeExpansionListener tel)
Adds a listener for TreeExpansion events.

Parameters:
tel - a TreeExpansionListener that will be notified when a tree node is expanded or collapsed (a "negative expansion")

addTreeSelectionListener

public void addTreeSelectionListener(TreeSelectionListener tsl)
Adds a listener for TreeSelection events.

Parameters:
tsl - the TreeSelectionListener that will be notified when a node is selected or deselected (a "negative selection")

addTreeWillExpandListener

public void addTreeWillExpandListener(TreeWillExpandListener tel)
Adds a listener for TreeWillExpand events.

Parameters:
tel - a TreeWillExpandListener that will be notified when a tree node will be expanded or collapsed (a "negative expansion")

collapseAll

public void collapseAll()
Ensures that all the nodes in the tree are collapsed


collapsePath

public void collapsePath(TreePath path)
Ensures that the node identified by the specified path is collapsed and viewable.

Parameters:
path - the TreePath identifying a node

expandAll

public void expandAll()
Ensures that all the nodes are expanded and viewable.


expandPath

public void expandPath(TreePath path)
Ensures that the node identified by the specified path is expanded and viewable.

Parameters:
path - the TreePath identifying a node

fireActionPerformed

public void fireActionPerformed(ActionEvent e)
Notifies all listeners that have registered for this event type.

Parameters:
e - The ActionEvent to send.

fireTreeCollapsed

public void fireTreeCollapsed(TreePath path)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
path - the TreePath indicating the node that was collapsed

fireTreeExpanded

public void fireTreeExpanded(TreePath path)
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
path - the TreePath indicating the node that was expanded

fireTreeWillCollapse

public void fireTreeWillCollapse(TreePath path)
                          throws ExpandVetoException
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
path - the TreePath indicating the node that was expanded
Throws:
ExpandVetoException

fireTreeWillExpand

public void fireTreeWillExpand(TreePath path)
                        throws ExpandVetoException
Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.

Parameters:
path - the TreePath indicating the node that was expanded
Throws:
ExpandVetoException

getActionCommand

public String getActionCommand()
Returns the action command string of the Tree

Returns:
java.lang.String

getCellRenderer

public TreeCellRenderer getCellRenderer()
Returns the current TreeCellRenderer that is rendering each cell.

Returns:
the TreeCellRenderer that is rendering each cell
See Also:
TreeCellRenderer

getComponent

public Component getComponent(Object treeNode)
Returns the Component that will be used to render the provided tree node. If this method returns null, then no Component has been associated with a specified tree node and the TreeCellRenderer.getTreeCellRendererText() method will be used to render the Tree cell.

This method is primarily for use by the Tree UI peer rendering code. You should call the "invalidate" and then "validate" methods first before calling this method to ensure that all child Components are known and are valid.

Parameters:
treeNode - - the tree node in question
Returns:
- a component for the node or null
See Also:
TreeCellRenderer.getTreeCellRendererText(Tree, Object, boolean, boolean, boolean)

getExpandedDescendants

public Enumeration getExpandedDescendants(TreePath parent)
Returns an Enumeration of the descendants of path that are currently expanded. If path is not currently expanded, this will return null. If you expand/collapse nodes while iterating over the returned Enumeration this may not return all the expanded paths, or may return paths that are no longer expanded.


getLastSelectedPathComponent

public Object getLastSelectedPathComponent()
Returns the last path component in the first node of the current selection.

Returns:
the last Object in the first selected node's TreePath, or null if nothing is selected

getLeadSelectionPath

public TreePath getLeadSelectionPath()
Returns the path of the last node added to the selection.

Returns:
the TreePath of the last node added to the selection.

getModel

public TreeModel getModel()
Returns the TreeModel that is providing the data.

Returns:
the TreeModel that is providing the data

getLastExpandedPaths

public Collection getLastExpandedPaths()
This will return a collection of TresePath that have expanded within the Tree. This will be automatically cleared each time a Tree is rendered so dont rely on it.

Returns:
a collection of TresePath that have expanded within the Tree.

getRowForPath

public int getRowForPath(TreePath path)
Returns the row that the TreePath path is being displayed at. If the TreePath in path is not valid it will be set to -1.


getRowsForPaths

public int[] getRowsForPaths(TreePath[] paths)
Returns the rows that the TreePath instances in path are being displayed at. The returned array is an array of the same length as that passed in, and if one of the TreePaths in path is not valid its entry in the array should be set to -1.


getRowHeight

public int getRowHeight()
Returns the row height to be used for each row within the Tree. If this value is 0 or less, then no row height will be used.

Returns:
int

getSelectionCount

public int getSelectionCount()
Returns the number of nodes selected.

Returns:
the number of nodes selected