public final class DataColumnReference<T> extends DataColumn
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 and Description |
---|
DataColumnReference() |