java-gnome version 4.0.19

org.gnome.gtk
Class TreeRowReference

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.gnome.glib.Boxed
          extended by org.gnome.gtk.TreeRowReference

public final class TreeRowReference
extends Boxed

A stable reference to a specific row in a TreeModel. A TreeRowReference listens to all changes made to the model (be they insertions, deletions, sorting being applied, etc) and adjusts itself internally so that the same row is pointed at by the instance regardless.

This class is primarily necessary because a TreeIter instance is no longer usable if the model changes. Neither are TreePaths for that matter; if you change the sorting order then the row pointed at by TreePath "2" will [likely] be different before and after the sort.

Typical usage of this is from a TreeIter as follows:

 TreeModel source;
 TreePath path;
 TreeIter row;
 TreeRowReference ref;
 ...
 
 path = source.getPath(row);
 ref = new TreeRowReference(source, path);
 

Since:
4.0.6
Author:
Andrew Cowie

Constructor Summary
TreeRowReference(TreeModel model, TreePath path)
          Construct a new TreeRowReference for the given TreePath into the given Model.
 
Method Summary
 TreePath getPath()
          Get a TreePath representing the row that this TreeRowReference is currently pointing at.
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TreeRowReference

public TreeRowReference(TreeModel model,
                        TreePath path)
Construct a new TreeRowReference for the given TreePath into the given Model.

Since:
4.0.6
Method Detail

getPath

public TreePath getPath()
Get a TreePath representing the row that this TreeRowReference is currently pointing at.

Returns:
You'll get null back if the TreeRowReference is no longer valid, which would happen if the row has been deleted.
Since:
4.0.6


java-gnome