org.gnu.gtk
Class TreePath

java.lang.Object
  |
  +--org.gnu.glib.Boxed
        |
        +--org.gnu.gtk.TreePath

public class TreePath
extends Boxed

A path refers to a single row in a TreeStore. In this respect, it is similar to a TreeIter, however a path also contains details of the structure of the tree (TreeIter is a generic object for the entire TreeView family, including flat lists and tables.)


Constructor Summary
TreePath()
          Constructs a new path.
TreePath(java.lang.String path)
          Creates a new TreePath initialized to path.
 
Method Summary
 java.lang.Object clone()
          Creates a copy of the path
 int compare(TreePath other)
          Compares the path with another path.
 void down()
          Moves path to point to the first child of the current path.
 int getDepth()
          Returns the current depth of path.
 boolean isAncestor(TreePath descendant)
          Returns TRUE if descendant is a descendant of path.
 boolean isDescendant(TreePath ancestor)
          Returns TRUE if path is a descendant of ancestor.
 void next()
          Moves the path to point to the next node at the current depth.
 boolean previous()
          Moves the path to point to the previous node at the current depth, if it exists.
 java.lang.String toString()
          Generates a string representation of the path.
 boolean up()
          Moves the path to point to it's parent node, if it has a parent.
 
Methods inherited from class org.gnu.glib.Boxed
equals, getHandle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreePath

public TreePath()
Constructs a new path.


TreePath

public TreePath(java.lang.String path)
Creates a new TreePath initialized to path. path is expected to be a colon separated list of numbers. For example, the string "10:4:0" would create a path of depth 3 pointing to the 11th child of the root node, the 5th child of that 11th child, and the 1st child of that 5th child. If an invalid path string is passed in, NULL is returned. TODO: throw an exception on null response.

Method Detail

toString

public java.lang.String toString()
Generates a string representation of the path. This string is a ':' separated list of numbers. For example, "4:10:0:3" would be an acceptable return value for this string.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the path.

getDepth

public int getDepth()
Returns the current depth of path.


clone

public java.lang.Object clone()
Creates a copy of the path

Overrides:
clone in class java.lang.Object

compare

public int compare(TreePath other)
Compares the path with another path. If the other path appears before this one in a tree, then -1 is returned. If this one appears before the other, then 1 is returned. If the two nodes are equal, then 0 is returned.


next

public void next()
Moves the path to point to the next node at the current depth.


previous

public boolean previous()
Moves the path to point to the previous node at the current depth, if it exists.

Returns:
TRUE if path has a previous node, and the move was made.

up

public boolean up()
Moves the path to point to it's parent node, if it has a parent.

Returns:
TRUE if path has a parent, and the move was made.

down

public void down()
Moves path to point to the first child of the current path.


isAncestor

public boolean isAncestor(TreePath descendant)
Returns TRUE if descendant is a descendant of path.

Parameters:
descendant - Another TreePath
Returns:
TRUE if descendant is contained inside path

isDescendant

public boolean isDescendant(TreePath ancestor)
Returns TRUE if path is a descendant of ancestor.

Parameters:
ancestor - Another TreePath
Returns:
TRUE if ancestor contains path somewhere below it

Please send any bug reports, comments, or suggestions for the API or documentation to java-gnome-developer@lists.sf.net