org.gnu.gtk
Class TreeRowReference
Boxed
org.gnu.gtk.TreeRowReference
public class TreeRowReference
extends Boxed
A TreeRowReference behaves similar to a null in that
it is a reference to a node in a null. 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()
TreeRowReference
public TreeRowReference(TreeModel model,
TreePath path)
throws 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.
model
- The model the reference will usepath
- Valid TreePath to the node to keep a reference to
getModel
public TreeModel getModel()
- the model which reference is monitoring in order to appropriately
modify the path.
getPath
public TreePath getPath()
- 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()
- TRUE if the reference refers to a current valid path.