Class SortedColumnList
- All Implemented Interfaces:
Serializable
This class maintains an ordered list of SortedColumn entries representing the
current multi-column sort, where the first entry has the highest precedence. The size of
the list is limited by max.
The property getToBeSortedLevel() indicates how many leading sort levels must be
(re)applied during the current request. It is increased when the sort order changes and reset by
sorted() after the data has been processed.
New sort requests move the affected column to the front of the list; repeating the request on the same column toggles its direction.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSortedColumnList(int max) Creates a new sort state with a maximum number of tracked sort levels. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated, for removal: This API element is subject to removal in a future version.Only for backward compatibility of deprecated functions.voidclear()Removes allSortedColumnentries from this list.get(int index) Returns theSortedColumnat the given position.getFirst()Returns the primary sort column, if any.intNumber of levels (columns) which are still to be sorted.intReturns the index of a column with the given identifier.booleanisEmpty()Returns whether no sort order is currently defined.booleanIfmax > 1the UI may show sort order numbers, which can be queried.voidsetToBeSortedLevel(int toBeSortedLevel) Deprecated, for removal: This API element is subject to removal in a future version.Please usesorted()intsize()Returns the number of active sort levels currently stored.voidsorted()Indicates that every column is sorted and a SortActionEvent is not executed in this request.voidupdateSortState(String columnId) Updates the current sort state for the given column identifier.
-
Constructor Details
-
SortedColumnList
public SortedColumnList(int max) Creates a new sort state with a maximum number of tracked sort levels.The list will keep at most
maxentries. Ifmaxis less than1, it will be normalized to1. Whenmax > 1,isShowNumbers()will betrueso that the UI can optionally display sort order numbers.- Parameters:
max- the maximum number of columns to consider for multi-column sorting
-
-
Method Details
-
isEmpty
public boolean isEmpty()Returns whether no sort order is currently defined. -
getFirst
Returns the primary sort column, if any. -
updateSortState
Updates the current sort state for the given column identifier.If the column is already the primary sort key, its direction is toggled and at least the first level is marked to be re-sorted. Otherwise, the column is moved/inserted to the front as ascending, previous occurrence (if any) is removed, and the number of levels to be sorted is adjusted. The list size is then normalized to the configured maximum.
- Parameters:
columnId- the technical identifier of the column to sort by
-
add
Deprecated, for removal: This API element is subject to removal in a future version.Only for backward compatibility of deprecated functions. UseupdateSortState(String)instead.Adds a sorted column entry to the end of the list.- Parameters:
columnId- the technical identifier of the columnascending-truefor ascending order,falsefor descending
-
get
Returns theSortedColumnat the given position.- Parameters:
index- zero-based index into the current sort list- Returns:
- the
SortedColumnat the given index
-
size
public int size()Returns the number of active sort levels currently stored.- Returns:
- the size of the internal list of
SortedColumnentries
-
clear
public void clear()Removes allSortedColumnentries from this list. -
sorted
public void sorted()Indicates that every column is sorted and a SortActionEvent is not executed in this request. -
indexOf
Returns the index of a column with the given identifier.- Parameters:
id- the technical identifier of the column to look up
-
isShowNumbers
public boolean isShowNumbers()If
max > 1the UI may show sort order numbers, which can be queried.Method is used internally by the Tobago sorting component.
-
getToBeSortedLevel
public int getToBeSortedLevel()Number of levels (columns) which are still to be sorted. Is smaller or equals the size of
list(columns to sort by).Method is used internally by the Tobago sorting component.
- Returns:
- the number of levels (columns) which must be sorted this request
-
setToBeSortedLevel
Deprecated, for removal: This API element is subject to removal in a future version.Please usesorted()
-