|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.gnu.glib.GObject | +--org.gnu.gtk.TreeSelection
The TreeSelection object is a helper object to manage the selection for a
TreeView
widget. The TreeSelection object is automatically created
when a newTreeView widget is created, and cannot exist independentally of
this widget. The primary reason the TreeSelection objects exists is for
cleanliness of code and API. That is, there is no conceptual reason all
these functions could not be methods on the TreeView widget instead of a
separate function.
The TreeSelection object is gotten from a TreeView by calling
TreeView.getSelection()
. It can be manipulated to check the
selection status of the tree, as well as select and deselect individual
rows. Selection is done completely view side. As a result, multiple views
of the same model can have completely different selections. Additionally,
you cannot change the selection of a row on the model that is not currently
displayed by the view without expanding its parents first.
One of the important things to remember when monitoring the selection of a view is that the "changed" event is mostly a hint. That is, it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a "changed" event when nothing has happened (mostly as a result of programmers calling selectRow on an already selected row).
TreeView
Method Summary | |
void |
addListener(TreeSelectionListener listener)
Register an object to handle Selection change events which are emitted whenever the selection has (possibly) changed |
void |
forEachSelected(TreeSelectionForEach implementor)
Calls the forEach method of the specified class for every selected value. |
java.lang.Class |
getEventListenerClass(java.lang.String signal)
|
GtkEventType |
getEventType(java.lang.String signal)
|
boolean |
getSelected(TreeIter iter)
Returns TRUE if the row pointed to by iter is currently selected. |
boolean |
getSelected(TreePath path)
Returns TRUE if the row pointed to by path is currently selected. |
TreeView |
getTreeView()
Returns the TreeView associated with the selection. |
static Type |
getType()
Retrieve the runtime type used by the GLib library. |
void |
removeListener(TreeSelectionListener listener)
Removes a listener |
void |
select(TreeIter iter)
Selects the specified iterator. |
void |
select(TreePath path)
Select the row at path. |
void |
select(TreePath startPath,
TreePath endPath)
Selects a range of nodes, determined by startPath and endPath inclusive. |
void |
selectAll()
Selects all the nodes. |
void |
setMode(SelectionMode mode)
Sets the selection mode of the selection. |
void |
unselect(TreeIter iter)
Unselects the specified iterator. |
void |
unselect(TreePath path)
Unselects the row at path. |
void |
unselectAll()
Unselects all the nodes. |
Methods inherited from class org.gnu.glib.GObject |
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, equals, getData, getHandle, removeEventHandler, setData |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void forEachSelected(TreeSelectionForEach implementor)
public void setMode(SelectionMode mode)
mode
- The selection mode to use.public TreeView getTreeView()
TreeView
associated with the selection.
public void select(TreePath path)
path
- The path to be selected.public void unselect(TreePath path)
path
- The path to be deselectedpublic boolean getSelected(TreePath path)
path
- A patch to check the selection on
public void select(TreeIter iter)
iter
- The TreeIter
to be selected.public void unselect(TreeIter iter)
iter
- The TreeIter
to be unselected.public boolean getSelected(TreeIter iter)
iter
- The iter to test the selection of
public void selectAll()
public void unselectAll()
public void select(TreePath startPath, TreePath endPath)
startPath
- The initial node of the range.endPath
- The final node of the range.public void addListener(TreeSelectionListener listener)
TreeSelectionListener
public void removeListener(TreeSelectionListener listener)
addListener(TreeSelectionListener)
public java.lang.Class getEventListenerClass(java.lang.String signal)
public GtkEventType getEventType(java.lang.String signal)
public static Type getType()
|
Please send any bug reports, comments, or suggestions for the API or documentation to java-gnome-developer@lists.sf.net | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |