org.gnu.gtk

Class TreeModelSort

Implemented Interfaces:
TreeSortable

public class TreeModelSort
extends TreeModel
implements TreeSortable

Class for sorting the rows of a base TreeModel. The underlying TreeModel us sorted using a comparison function. The comparison function is set with the setSortMethod(TreeIterComparison,DataColumn) method.

Constructor Summary

TreeModelSort(TreeModel model)
Create a new TreeModelSort using the given TreeModel as the underlying data model.

Method Summary

TreeModel
getModel()
Return the underlying data model.
DataColumn
getSortColumn()
Get a DataColumn object representing the currently sorted column.
SortType
getSortOrder()
Get the current sorting order of the store.
static Type
getType()
Retrieve the runtime type used by the GLib library.
int
handleCompareFunc(Handle model, Handle aIter, Handle bIter, int col)
Call-back method invoked by the JNI code when sorting is required.
void
setSortColumn(DataColumn column, SortType order)
Set the column in the list to sort on.
void
setSortMethod(TreeIterComparison method, DataColumn column)
Set the class used to sort the list according to the values stored in the given DataColumn.

Methods inherited from class org.gnu.gtk.TreeModel

addListener, getColumnCount, getDataBlockCount, getEventListenerClass, getEventType, getFirstIter, getIter, getIter, getType, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, removeListener

Methods inherited from class org.gnu.glib.GObject

addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify

Constructor Details

TreeModelSort

public TreeModelSort(TreeModel model)
Create a new TreeModelSort using the given TreeModel as the underlying data model.

Method Details

getModel

public TreeModel getModel()
Return the underlying data model.

getSortColumn

public DataColumn getSortColumn()
Get a DataColumn object representing the currently sorted column. This is not the same DataColumn used to create the store. It is only of type DataColumn (not DataColumnString, etc). It can be compared with another DataColumn object using the DataColumn.equals(DataColumn) method.
Specified by:
getSortColumn in interface TreeSortable
Returns:
A DataColumn object representing the currently sorted column or null if there is no column currently sorted.

getSortOrder

public SortType getSortOrder()
Get the current sorting order of the store.
Specified by:
getSortOrder in interface TreeSortable
Returns:
A SortType object defining the current sorting order of the store or null if there is no current sort order.

getType

public static Type getType()
Retrieve the runtime type used by the GLib library.

handleCompareFunc

public int handleCompareFunc(Handle model,
                             Handle aIter,
                             Handle bIter,
                             int col)
Call-back method invoked by the JNI code when sorting is required. This is for internal use only.
Specified by:
handleCompareFunc in interface TreeSortable

setSortColumn

public void setSortColumn(DataColumn column,
                          SortType order)
Set the column in the list to sort on.
Specified by:
setSortColumn in interface TreeSortable

setSortMethod

public void setSortMethod(TreeIterComparison method,
                          DataColumn column)
Set the class used to sort the list according to the values stored in the given DataColumn.
Specified by:
setSortMethod in interface TreeSortable