|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.grid.SortItemSupport
public class SortItemSupport
TableModel used by SortableTable.
Nested Class Summary | |
---|---|
static interface |
SortItemSupport.SortOrderHandler
A handler to handle the toggling of sort order. |
Field Summary | |
---|---|
protected List<ISortableTableModel.SortItem> |
_sortingColumns
The List that keeps the list of SortItem(s). |
Constructor Summary | |
---|---|
SortItemSupport()
Creates a SortableTableModel from any table model. |
Method Summary | |
---|---|
protected void |
addSortItem(ISortableTableModel.SortItem sortItem)
|
int |
getColumnSortRank(int column)
In the case of sort by multiple columns, this method will return the rank of this column within all sorted columns. |
int |
getMasterSortColumnIndex(int column)
|
int[] |
getMasterSortColumns()
Gets the master sort columns. |
int |
getMaximumSortColumns()
Gets the maximum columns can be sorted at once. |
List<ISortableTableModel.SortItem> |
getSortingColumns()
Gets the sorting columns. |
SortItemSupport.SortOrderHandler |
getSortOrderHandler()
Gets the SortOrderHandler. |
int |
getSortPriority()
Gets the sort priority. |
boolean |
isColumnAscending(int column)
Checks if the column is sorted ascendingly. |
boolean |
isColumnSorted(int column)
Checks if the column is sorted. |
protected boolean |
isEmpty()
|
boolean |
isMultiColumnSortable()
Does this table allow sort by multiple columns. |
boolean |
isSortable()
Checks if the sortable table model is sortable. |
boolean |
reset()
Resets. |
boolean |
reverseColumnSortOrder(int column)
Reverses the sort order of the column. |
void |
setMasterSortColumns(int[] masterSortColumns)
Sets the master sort column. |
void |
setMaximumSortColumns(int maximumSortColumns)
Set the maximum number of columns that can be sorted at once. |
void |
setMultiColumnSortable(boolean multiColumnSortable)
Set the value if this table allows sort by multiple columns. |
void |
setSortable(boolean sortable)
Sets the table model sortable. |
void |
setSortingColumns(List<ISortableTableModel.SortItem> list)
Sets the soring columns. |
void |
setSortOrderHandler(SortItemSupport.SortOrderHandler sortOrderHandler)
Sets the SortOrderHandler. |
void |
setSortPriority(int sortPriority)
Sets the sort priority. |
boolean |
sortColumn(int column)
Sort the column, equals to sortColumn(column, false). |
boolean |
sortColumn(int column,
boolean reset)
If reset is true, it will remove all existing sort-by columns and only sorts by column . |
boolean |
sortColumn(int column,
boolean reset,
boolean ascending)
Sorts a column. |
void |
toggleSortOrder(int column,
boolean extend)
Toggles the sort order on the specified column. |
boolean |
unsortColumn(int column)
Unsort column. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<ISortableTableModel.SortItem> _sortingColumns
Constructor Detail |
---|
public SortItemSupport()
Method Detail |
---|
public int[] getMasterSortColumns()
public void setMasterSortColumns(int[] masterSortColumns)
masterSortColumns
- the new master sort columns.public int getMasterSortColumnIndex(int column)
protected void addSortItem(ISortableTableModel.SortItem sortItem)
public boolean sortColumn(int column)
column
- column to be sorted
public boolean sortColumn(int column, boolean reset)
column
. If reset is
false, it will keep existing sort-by columns and add the column
as a new sort-by column.
column
- the column index.reset
- true to reset all existing sorting columns before sorting the new column.
public boolean unsortColumn(int column)
column
- column to be removed from sort-by columns
public boolean reverseColumnSortOrder(int column)
column
- the column index.
public boolean sortColumn(int column, boolean reset, boolean ascending)
column
- the column index.reset
- true to reset all existing sorting columns before sorting the new column.ascending
- true to sort ascending. False to sort descending.
public boolean isColumnSorted(int column)
column
- the column index.
public boolean isColumnAscending(int column)
column
- the column index.
public boolean reset()
protected boolean isEmpty()
public List<ISortableTableModel.SortItem> getSortingColumns()
public void setSortingColumns(List<ISortableTableModel.SortItem> list)
list
- a list of SortItems.public int getColumnSortRank(int column)
column
- the column index.
public boolean isMultiColumnSortable()
public void setMultiColumnSortable(boolean multiColumnSortable)
multiColumnSortable
- pass in true if this you want this table allows sort by multiple columnspublic boolean isSortable()
public void setSortable(boolean sortable)
toggleSortOrder(int,boolean)
will have no
effect.
sortable
- true or false.public int getSortPriority()
ISortableTableModel.SORT_PRIORITY_FILO
(the default) or ISortableTableModel.SORT_PRIORITY_FIFO
.public void setSortPriority(int sortPriority)
sortPriority
- must be one the following value: SORT_PRIORITY_FILO (the default), or SORT_PRIORITY_FIFOpublic int getMaximumSortColumns()
getSortPriority()
, the behavior is different. If sort priority is FILO,
nothing will happen when user tries to sort one column. If FIFO, it will push the column with the largest sort
rank out.
public void setMaximumSortColumns(int maximumSortColumns)
maximumSortColumns
- the maximum number of columns that can be sorted at once.public SortItemSupport.SortOrderHandler getSortOrderHandler()
public void setSortOrderHandler(SortItemSupport.SortOrderHandler sortOrderHandler)
sortOrderHandler
- a new SortOrderHandler.toggleSortOrder(int,boolean)
public void toggleSortOrder(int column, boolean extend)
See default implementation below.
if (isMultiColumnSortable() && extend) {
if (!isColumnSorted(column))
sortColumn(column, false, true);
else if (isColumnAscending(column))
reverseColumnSortOrder(column);
else
unsortColumn(column);
}
else {
if (!isColumnSorted(column))
sortColumn(column, true, true);
else if (isColumnAscending(column))
reverseColumnSortOrder(column);
else
reset();
}
column
- the column index.extend
- if true, extend the current sort to add more sorted columns.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |