charvax.swing.tree
Class TreePath
java.lang.Object
charvax.swing.tree.TreePath
public class TreePath
extends java.lang.Object
Represents a path to a node. A TreePath is an array of Objects that are vended
from a TreeModel. The elements of the array are ordered such that the root is
always the first element (index 0) of the array.
TreePath() - Primarily provided for subclasses that represent paths in a
different manner.
|
TreePath(Object singlePath) - Constructs a TreePath containing only a single element.
|
TreePath(Object[] path) - Constructs a path from an array of Objects, uniquely identifying
the path from the root of the tree to a specific node, as returned
by the tree's data model.
|
TreePath(Object[] path, int length) - Constructs a new TreePath with the identified path components
of length length.
|
TreePath(TreePath parent, Object lastElement) - Constructs a new TreePath, which is the path identified by parent
ending in lastElement.
|
boolean | equals(Object o) - Tests two TreePaths for equality by checking each element of the
paths for equality.
|
Object | getLastPathComponent() - Returns the last component of this path.
|
TreePath | getParentPath() - Returns a path containing all the elements of this object,
except the last path component.
|
Object[] | getPath() - Returns an ordered array of Objects containing the components
of this TreePath.
|
Object | getPathComponent(int element) - Returns the path component at the specified index.
|
int | getPathCount() - Returns the number of elements in the path.
|
int | hashCode() - Returns the hashCode for the object.
|
boolean | isDescendant(TreePath aTreePath) - Returns true if aTreePath is a descendant of this TreePath.
|
TreePath | pathByAddingChild(Object child) - Returns a new path containing all the elements of this
object plus child.
|
String | toString() - Returns a string that displays and identifies this object's
properties.
|
TreePath
protected TreePath()
Primarily provided for subclasses that represent paths in a
different manner.
TreePath
public TreePath(Object singlePath)
Constructs a TreePath containing only a single element.
TreePath
public TreePath(Object[] path)
Constructs a path from an array of Objects, uniquely identifying
the path from the root of the tree to a specific node, as returned
by the tree's data model.
TreePath
protected TreePath(Object[] path,
int length)
Constructs a new TreePath with the identified path components
of length length.
TreePath
protected TreePath(TreePath parent,
Object lastElement)
Constructs a new TreePath, which is the path identified by parent
ending in lastElement.
equals
public boolean equals(Object o)
Tests two TreePaths for equality by checking each element of the
paths for equality.
getLastPathComponent
public Object getLastPathComponent()
Returns the last component of this path.
getParentPath
public TreePath getParentPath()
Returns a path containing all the elements of this object,
except the last path component.
getPath
public Object[] getPath()
Returns an ordered array of Objects containing the components
of this TreePath.
getPathComponent
public Object getPathComponent(int element)
Returns the path component at the specified index.
getPathCount
public int getPathCount()
Returns the number of elements in the path.
hashCode
public int hashCode()
Returns the hashCode for the object.
isDescendant
public boolean isDescendant(TreePath aTreePath)
Returns true if aTreePath is a descendant of this TreePath.
A TreePath P1 is a descendent of a TreePath P2 if P1 contains
all of the components that make up P2's path. For example,
if this object has the path [a, b], and aTreePath has the path
[a, b, c], then aTreePath is a descendant of this object.
However, if aTreePath has the path [a], then it is not a descendant
of this object.
- true if aTreePath is a descendant of this path.
pathByAddingChild
public TreePath pathByAddingChild(Object child)
Returns a new path containing all the elements of this
object plus child.
toString
public String toString()
Returns a string that displays and identifies this object's
properties.