org.gnu.gtk

Class TreeModelSort

public class TreeModelSort extends TreeModel implements TreeSortable

Class for sorting the rows of a base {@link TreeModel}. The underlying TreeModel us sorted using a comparison function. The comparison function is set with the {@link #setSortMethod} method.
Constructor Summary
TreeModelSort(TreeModel model)
Create a new TreeModelSort using the given TreeModel as the underlying data model.
Method Summary
TreePathconvertChildPathToPath(TreePath childPath)
Converts childPath to a path relative to the TreeModelSort.
TreePathconvertPathToChildPath(TreePath sortedPath)
Converts sortedPath to a path on the child model of the TreeModelSort.
TreeModelgetModel()
Return the underlying data model.
DataColumngetSortColumn()
Get a DataColumn object representing the currently sorted column.
SortTypegetSortOrder()
Get the current sorting order of the store.
static TypegetType()
Retrieve the runtime type used by the GLib library.
inthandleCompareFunc(Handle model, Handle aIter, Handle bIter, int col)
Call-back method invoked by the JNI code when sorting is required.
voidsetSortColumn(DataColumn column, SortType order)
Set the column in the list to sort on.
voidsetSortMethod(TreeIterComparison method, DataColumn column)
Set the class used to sort the list according to the values stored in the given DataColumn.

Constructor Detail

TreeModelSort

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

Method Detail

convertChildPathToPath

public TreePath convertChildPathToPath(TreePath childPath)
Converts childPath to a path relative to the TreeModelSort. That is, childPath points to a path in the child model. The returned path will point to the same row in the sorted model. If childPath isn't a valid path on the child model, then NULL is returned.

Parameters: childPath A TreePath to convert.

Returns: TreePath, or NULL

convertPathToChildPath

public TreePath convertPathToChildPath(TreePath sortedPath)
Converts sortedPath to a path on the child model of the TreeModelSort. That is, sortedPath points to a location in the TreeModelSort. The returned path will point to the same location in the model not being sorted. If sortedPath does not point to a location in the child model, NULL is returned.

Parameters: sortedPath A TreePath to convert.

Returns: A GtkTreePath, or NULL

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 {@link DataColumn#equals} method.

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.

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.

setSortColumn

public void setSortColumn(DataColumn column, SortType order)
Set the column in the list to sort on.

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.