org.gnu.gtk

Class TreeRowReference

public class TreeRowReference extends Boxed

A TreeRowReference behaves similar to a {@see org.gnu.gtk.TreeIter} in that it is a reference to a node in a {@see 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 {@link org.gnu.gtk.TreeModel} and a {@link org.gnu.gtk.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()
 

Constructor Summary
TreeRowReference(TreeModel model, TreePath path)
Creates a row reference based on path.
Method Summary
TreeModelgetModel()
TreePathgetPath()
booleanisValid()

Constructor Detail

TreeRowReference

public TreeRowReference(TreeModel model, TreePath path)
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 use path Valid TreePath to the node to keep a reference to

Method Detail

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.