Class ObjectTableSorter
-
- All Implemented Interfaces:
public class ObjectTableSorter extends RowSorter<M>
Implementation of a RowSorter for ObjectTableModel
- Since:
3.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classObjectTableSorter.RowView row with model mapping. All data relates to model.
-
Field Summary
Fields Modifier and Type Field Description public final ObjectTableModelmodelpublic Comparator<ObjectTableSorter.Row>primaryComparatorpublic Comparator<ObjectTableSorter.Row>fallbackComparator
-
Constructor Summary
Constructors Constructor Description ObjectTableSorter(ObjectTableModel model)
-
Method Summary
Modifier and Type Method Description ObjectTableModelgetModel()Comparator<ObjectTableSorter.Row>getPrimaryComparator()Returns Comparator used prior to sorted columns. ObjectTableSortersetPrimaryComparator(Comparator<ObjectTableSorter.Row> primaryComparator)Comparator used prior to sorted columns. Comparator<ObjectTableSorter.Row>getFallbackComparator()Returns Comparator if all sorted columns matches. ObjectTableSortersetFallbackComparator(Comparator<ObjectTableSorter.Row> comparator)Sets a fallback comparator (defaults to model index comparison) if none primary, neither column value comparators can make differences between two rows. Comparator<out Object>getValueComparator(int column)Returns Comparator used on column. ObjectTableSorterfixLastRow()Sets primary comparator to one that don't sort last row. ObjectTableSortersetValueComparator(int column, Comparator<out Object> comparator)Assign comparator to given column, if nulla getDefaultComparator(int) default one is used instead.voidtoggleSortOrder(int column)intconvertRowIndexToModel(int index)intconvertRowIndexToView(int index)voidsetSortKeys(List<out RowSorter.SortKey> keys)voidsetSortKey(RowSorter.SortKey sortkey)List<out RowSorter.SortKey>getSortKeys()intgetViewRowCount()intgetModelRowCount()voidmodelStructureChanged()voidallRowsChanged()voidrowsInserted(int firstRow, int endRow)voidrowsDeleted(int firstRow, int endRow)voidrowsUpdated(int firstRow, int endRow)voidrowsUpdated(int firstRow, int endRow, int column)-
-
Constructor Detail
-
ObjectTableSorter
ObjectTableSorter(ObjectTableModel model)
-
-
Method Detail
-
getModel
ObjectTableModel getModel()
-
getPrimaryComparator
Comparator<ObjectTableSorter.Row> getPrimaryComparator()
Returns Comparator used prior to sorted columns.
- Returns:
Comparator used prior to sorted columns.
-
setPrimaryComparator
ObjectTableSorter setPrimaryComparator(Comparator<ObjectTableSorter.Row> primaryComparator)
Comparator used prior to sorted columns.
- Parameters:
primaryComparator- Comparator to be used first- Returns:
this
-
getFallbackComparator
Comparator<ObjectTableSorter.Row> getFallbackComparator()
Returns Comparator if all sorted columns matches. Defaults to model index comparison.
- Returns:
Comparator if all sorted columns matches. Defaults to model index comparison.
-
setFallbackComparator
ObjectTableSorter setFallbackComparator(Comparator<ObjectTableSorter.Row> comparator)
Sets a fallback comparator (defaults to model index comparison) if none primary, neither column value comparators can make differences between two rows.
- Parameters:
comparator- to be used, when all other Comparators can't see a difference- Returns:
this
-
getValueComparator
Comparator<out Object> getValueComparator(int column)
Returns Comparator used on column.
- Parameters:
column- to be compared- Returns:
Comparator used on column.
-
fixLastRow
ObjectTableSorter fixLastRow()
Sets primary comparator to one that don't sort last row.
- Returns:
this
-
setValueComparator
ObjectTableSorter setValueComparator(int column, Comparator<out Object> comparator)
Assign comparator to given column, if
nulla getDefaultComparator(int) default one is used instead.- Parameters:
column- Model column index.comparator- Column value comparator.- Returns:
this
-
toggleSortOrder
void toggleSortOrder(int column)
-
convertRowIndexToModel
int convertRowIndexToModel(int index)
-
convertRowIndexToView
int convertRowIndexToView(int index)
-
setSortKeys
void setSortKeys(List<out RowSorter.SortKey> keys)
-
setSortKey
void setSortKey(RowSorter.SortKey sortkey)
-
getSortKeys
List<out RowSorter.SortKey> getSortKeys()
-
getViewRowCount
int getViewRowCount()
-
getModelRowCount
int getModelRowCount()
-
modelStructureChanged
void modelStructureChanged()
-
allRowsChanged
void allRowsChanged()
-
rowsInserted
void rowsInserted(int firstRow, int endRow)
-
rowsDeleted
void rowsDeleted(int firstRow, int endRow)
-
rowsUpdated
void rowsUpdated(int firstRow, int endRow)
-
rowsUpdated
void rowsUpdated(int firstRow, int endRow, int column)
-
-
-
-