|
java-gnome version 4.0.19 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.gnome.gtk.DataColumn
org.gnome.gtk.DataColumnReference<T>
public final class DataColumnReference<T>
A column containing references back to Java objects in a TreeModel.
If your TreeView is a GUI representation of a List of Account objects, say, and someone selects one of the rows, you quite reasonably want to know which Account was selected. While you could extract the account name or some other text field displayed in the TextView and attempt to use that to look up the Account object back on the Java side, a much better solution is to merely store a reference to the object that was the source of the data in that row in the first place. That's what DataColumnReference is for.
Simply call getValue()
with the TreeIter the selection gave you and the
DataColumnReference indicating the column you stashed your object in, and
then ta-da you have the Account which was selected, allowing you to carry
on with your application logic in your application's domain model's terms.
Beyond this, see DataColumn
for the full discussion of the role of
these classes and examples of how to employ them.
Don't try to use this in an attempt to somehow magically render a Java object in a TreeView! That's not what this is for; 99.9% of the time DataColumnString driving a TreeViewColumn with a CellRendererText, or a DataColumnPixbuf driving a TreeViewColumn containing a CellRendererPixbuf will more than handle the job for you.
Constructor Summary | |
---|---|
DataColumnReference()
|
Method Summary |
---|
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataColumnReference()
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |