Class Index | File Index

Classes


Class zwt.ui.table.RowSorter


Extends zwt.Object.

A row sorter provides default sorting using a table model. Basically a table requires a row sorter to map the row indices from the data model to the view.

This class provides the basis for sorting, you must override this class to provide a concrete table sorting support. Refer to zwt.ui.table.DefaultRowSorter for a concrete implementation.


Defined in: RowSorter.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Construct a row sorter.
Method Summary
Method Attributes Method Name and Description
 
convertRowIndexToModel(int_viewIndex)
Convert the specified index in the view to the index in the underlying model.
 
convertRowIndexToView(int_modelIndex)
Convert the specified index in the underlying model to the index in the view.
 
getComparator(int_column)
Return the comparator associated to the specified column.
 
Return the row sorter event manager attached to the model.
 
Return the current sort keys.
 
isSortable(int_column)
Determine whether the specified column is sortable.
 
onEvent(zwt_ui_table_RowSorterEvent_event)
Dispatch the specified row sorter event to the appropriate event manager.
 
rowDeleted(int_firstRow, int_lastRow)
Invoked when rows have been deleted from the underlying model in the specified range (inclusive).
 
rowInserted(int_firstRow, int_lastRow)
Invoked when rows have been inserted from the underlying model in the specified range (inclusive).
 
rowUpdated(int_firstRow, int_lastRow)
Invoked when rows have been updated from the underlying model in the specified range (inclusive).
 
setComparator(int_column, zwt_Comparator_comparator)
Set the comparator for the specified column.
 
setSortKeys(array_sortKeys)
Set the sort keys and trigger a sort.
 
sort()
Sort the rows in the view based on the sort keys of the columns being sorted.
 
toggleSortOrder(int_column)
Reverse the sort order from ascending to descending (or descending to ascending) for the specified column.
Class Detail
zwt.ui.table.RowSorter()
Construct a row sorter.
Author: Jeremy KUHN.
See:
zwt.ui.table.DefaultRowSorter
zwt.ui.table.Table
zwt.ui.table.TableModel
Method Detail
{Integer} convertRowIndexToModel(int_viewIndex)
Convert the specified index in the view to the index in the underlying model.
Parameters:
{Integer} int_viewIndex
The index of a row in the view
Returns:
The index of the row in the model

{Integer} convertRowIndexToView(int_modelIndex)
Convert the specified index in the underlying model to the index in the view.
Parameters:
{Integer} int_modelIndex
The index of a row in the model
Returns:
The index of the row in the view

{zwt.Comparator} getComparator(int_column)
Return the comparator associated to the specified column.

Comparators are used during the sorting operation to compare cell values in columns.

Parameters:
{Integer} int_column
The index of the column in the underlying model
Returns:
The Comparator.

{zwt.ui.table.RowSorterEventManager} getRowSorterEventManager()
Return the row sorter event manager attached to the model.
Returns:
The row sorter event manager

{zwt.ui.table.RowSorter.SortKey[]} getSortKeys()
Return the current sort keys.
Returns:
The sort keys

{Boolean} isSortable(int_column)
Determine whether the specified column is sortable.

In this implementation, a column is sortable if a Comparator has been provided for this column.

Parameters:
{Integer} int_column
The column to check
Returns:
true if the column is sortable, false otherwise

onEvent(zwt_ui_table_RowSorterEvent_event)
Dispatch the specified row sorter event to the appropriate event manager.
Parameters:
{zwt.ui.table.RowSorterEvent} zwt_ui_table_RowSorterEvent_event
The row sorter event to dispatch

rowDeleted(int_firstRow, int_lastRow)
Invoked when rows have been deleted from the underlying model in the specified range (inclusive).

The arguments give the affected range in the model before the change.

Parameters:
{Integer} int_firstRow
The first deleted row
{Integer} int_lastRow
The last deleted row

rowInserted(int_firstRow, int_lastRow)
Invoked when rows have been inserted from the underlying model in the specified range (inclusive).

The arguments give the affected range in the model after the change.

Parameters:
{Integer} int_firstRow
The first inserted row
{Integer} int_lastRow
The last inserted row

rowUpdated(int_firstRow, int_lastRow)
Invoked when rows have been updated from the underlying model in the specified range (inclusive).
Parameters:
{Integer} int_firstRow
The first updated row
{Integer} int_lastRow
The last updated row

setComparator(int_column, zwt_Comparator_comparator)
Set the comparator for the specified column.
Parameters:
{Integer} int_column
The index of the column in the underlying model
{zwt.Comparator} zwt_Comparator_comparator
The comparator to set

setSortKeys(array_sortKeys)
Set the sort keys and trigger a sort.

This creates a copy of the specified array, further changes to this array will have no effects on the sorter.

Parameters:
{zwt.ui.table.RowSorter.SortKey[]} array_sortKeys
The array of sort keys to set

sort()
Sort the rows in the view based on the sort keys of the columns being sorted. An empty list of sort keys indicates the view should be unsorted, the same as the model.

toggleSortOrder(int_column)
Reverse the sort order from ascending to descending (or descending to ascending) for the specified column.

If the specified column is not the primary sorted column, makes it the primary sorted column with an ascending sort order if it is currently unsorted or with an ascending or descending sort order depending on its initial state.

Parameters:
{Integer} int_column
The index of the column in the underlying model to make the primary sorted column.

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Jan 12 2012 02:07:54 GMT+0100 (CET)