org.gnu.gtk
Class TreeRowReference
java.lang.Object
org.gnu.glib.Struct
org.gnu.glib.Boxed
org.gnu.gtk.TreeRowReference
public class TreeRowReference
- extends Boxed
A TreeRowReference behaves similar to a TreeIter
in that
it is a reference to a node in a javax.swing.tree.TreeModel
. With a
TreeRowReference however you don't need to worry about it becoming
invalidated when the underlying model changes. TreeRowReferences listen to
signals emitted by the model and modifies their state accordingly.
To create a TreeRowReference you need a reference to a
TreeModel
and a TreePath
:
TreeRowReference ref = new TreeRowReference(model, path)
You can then accesss the model and path stored in the reference by using
TreeModel model = ref.getModel();
TreePath path = ref.getPath();
TreeRowReferences can become invalidated if the node they are pointing to no
longer exists, you should check for this by using
ref.isValid()
Methods inherited from class org.gnu.glib.Struct |
getHandle, getNullHandle |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, toString, wait, wait, wait |
TreeRowReference
public TreeRowReference(TreeModel model,
TreePath path)
throws java.lang.IllegalArgumentException
- Creates a row reference based on path. This reference will keep pointing
to the node pointed to by path, so long as it exists. It listens to all
signals emitted by model, and updates its path appropriately. If path
isn't a valid path in model, an IllegalArgumentException is thrown.
- Parameters:
model
- The model the reference will usepath
- Valid TreePath to the node to keep a reference to
- Throws:
java.lang.IllegalArgumentException
getModel
public TreeModel getModel()
- Returns:
- the model which reference is monitoring in order to appropriately
modify the path.
getPath
public TreePath getPath()
- Returns:
- Returns a path that the row reference currently points to, or
NULL if the path pointed to is no longer valid.
isValid
public boolean isValid()
- Returns:
- TRUE if the reference refers to a current valid path.