public class ObjectTableSorter extends RowSorter<ObjectTableModel>
RowSorter for ObjectTableModel| Modifier and Type | Class and Description |
|---|---|
protected class |
ObjectTableSorter.PreserveLastRowComparator |
class |
ObjectTableSorter.Row
View row with model mapping.
|
RowSorter.SortKey| Constructor and Description |
|---|
ObjectTableSorter(ObjectTableModel model) |
| Modifier and Type | Method and Description |
|---|---|
void |
allRowsChanged() |
int |
convertRowIndexToModel(int index) |
int |
convertRowIndexToView(int index) |
ObjectTableSorter |
fixLastRow()
Sets
primary comparator to one that don't sort last row. |
protected Comparator<ObjectTableSorter.Row> |
getComparatorFromSortKey(RowSorter.SortKey sortkey) |
protected Comparator<?> |
getDefaultComparator(int column)
Builds a default comparator based on model column class.
|
Comparator<ObjectTableSorter.Row> |
getFallbackComparator()
Returns Comparator if all sorted columns matches.
|
ObjectTableModel |
getModel() |
int |
getModelRowCount() |
Comparator<ObjectTableSorter.Row> |
getPrimaryComparator()
Returns Comparator used prior to sorted columns.
|
List<? extends RowSorter.SortKey> |
getSortKeys() |
Comparator<?> |
getValueComparator(int column)
Returns Comparator used on column.
|
int |
getViewRowCount() |
protected void |
invalidate() |
protected boolean |
isSortable(int column) |
protected boolean |
isSorted() |
protected boolean |
isSorted(int column) |
void |
modelStructureChanged() |
protected void |
rowsChanged(int firstRow,
int endRow,
boolean deleted,
boolean inserted) |
void |
rowsDeleted(int firstRow,
int endRow) |
void |
rowsInserted(int firstRow,
int endRow) |
void |
rowsUpdated(int firstRow,
int endRow) |
void |
rowsUpdated(int firstRow,
int endRow,
int column) |
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. |
ObjectTableSorter |
setPrimaryComparator(Comparator<ObjectTableSorter.Row> primaryComparator)
Comparator used prior to sorted columns.
|
void |
setSortKey(RowSorter.SortKey sortkey) |
void |
setSortKeys(List<? extends RowSorter.SortKey> keys) |
ObjectTableSorter |
setValueComparator(int column,
Comparator<?> comparator)
Assign comparator to given column, if
null a getDefaultComparator(int) default one is used instead. |
protected void |
sort()
Sort table
|
void |
toggleSortOrder(int column) |
protected void |
updateModelToView()
fill in modelToView list with index of view
|
protected void |
validate() |
addRowSorterListener, fireRowSorterChanged, fireSortOrderChanged, removeRowSorterListenerpublic ObjectTableSorter(ObjectTableModel model)
public Comparator<ObjectTableSorter.Row> getPrimaryComparator()
public Comparator<?> getValueComparator(int column)
column - to be comparedpublic Comparator<ObjectTableSorter.Row> getFallbackComparator()
public ObjectTableSorter setPrimaryComparator(Comparator<ObjectTableSorter.Row> primaryComparator)
primaryComparator - Comparator to be used firstthispublic ObjectTableSorter fixLastRow()
primary comparator to one that don't sort last row.thispublic ObjectTableSorter setValueComparator(int column, Comparator<?> comparator)
null a getDefaultComparator(int) default one is used instead.column - Model column index.comparator - Column value comparator.thisprotected Comparator<?> getDefaultComparator(int column)
Collator.getInstance() for String,
natural order for Comparable, no sort support for others.column - Model column index.Comparatorpublic ObjectTableSorter setFallbackComparator(Comparator<ObjectTableSorter.Row> comparator)
primary, neither
column value comparators can make
differences between two rows.comparator - to be used, when all other Comparators can't see a
differencethispublic ObjectTableModel getModel()
getModel in class RowSorter<ObjectTableModel>public void toggleSortOrder(int column)
toggleSortOrder in class RowSorter<ObjectTableModel>public int convertRowIndexToModel(int index)
convertRowIndexToModel in class RowSorter<ObjectTableModel>public int convertRowIndexToView(int index)
convertRowIndexToView in class RowSorter<ObjectTableModel>public void setSortKeys(List<? extends RowSorter.SortKey> keys)
setSortKeys in class RowSorter<ObjectTableModel>public void setSortKey(RowSorter.SortKey sortkey)
public List<? extends RowSorter.SortKey> getSortKeys()
getSortKeys in class RowSorter<ObjectTableModel>public int getViewRowCount()
getViewRowCount in class RowSorter<ObjectTableModel>public int getModelRowCount()
getModelRowCount in class RowSorter<ObjectTableModel>public void modelStructureChanged()
modelStructureChanged in class RowSorter<ObjectTableModel>public void allRowsChanged()
allRowsChanged in class RowSorter<ObjectTableModel>public void rowsInserted(int firstRow,
int endRow)
rowsInserted in class RowSorter<ObjectTableModel>public void rowsDeleted(int firstRow,
int endRow)
rowsDeleted in class RowSorter<ObjectTableModel>public void rowsUpdated(int firstRow,
int endRow)
rowsUpdated in class RowSorter<ObjectTableModel>protected void rowsChanged(int firstRow,
int endRow,
boolean deleted,
boolean inserted)
public void rowsUpdated(int firstRow,
int endRow,
int column)
rowsUpdated in class RowSorter<ObjectTableModel>protected boolean isSortable(int column)
protected boolean isSorted(int column)
protected boolean isSorted()
protected void invalidate()
protected void validate()
protected Comparator<ObjectTableSorter.Row> getComparatorFromSortKey(RowSorter.SortKey sortkey)
protected void sort()
protected void updateModelToView()
Copyright © 1998-2021 Apache Software Foundation. All Rights Reserved.