Package org.apache.jorphan.gui
Class ObjectTableSorter
Implementation of a 
RowSorter for ObjectTableModel- Since:
- 3.2
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classclassView row with model mapping.Nested classes/interfaces inherited from class javax.swing.RowSorterRowSorter.SortKey
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidintconvertRowIndexToModel(int index) intconvertRowIndexToView(int index) Setsprimary comparatorto one that don't sort last row.protected Comparator<ObjectTableSorter.Row>protected Comparator<?>getDefaultComparator(int column) Builds a default comparator based on model column class.Returns Comparator if all sorted columns matches.getModel()intReturns Comparator used prior to sorted columns.List<? extends RowSorter.SortKey>Comparator<?>getValueComparator(int column) Returns Comparator used on column.intprotected voidprotected booleanisSortable(int column) protected booleanisSorted()protected booleanisSorted(int column) voidprotected voidrowsChanged(int firstRow, int endRow, boolean deleted, boolean inserted) voidrowsDeleted(int firstRow, int endRow) voidrowsInserted(int firstRow, int endRow) voidrowsUpdated(int firstRow, int endRow) voidrowsUpdated(int firstRow, int endRow, int column) setFallbackComparator(Comparator<ObjectTableSorter.Row> comparator) Sets a fallback comparator (defaults to model index comparison) if noneprimary, neithercolumn value comparatorscan make differences between two rows.setPrimaryComparator(Comparator<ObjectTableSorter.Row> primaryComparator) Comparator used prior to sorted columns.voidsetSortKey(RowSorter.SortKey sortkey) voidsetSortKeys(List<? extends RowSorter.SortKey> keys) setValueComparator(int column, Comparator<?> comparator) Assign comparator to given column, ifnulla getDefaultComparator(int) default one is used instead.protected voidsort()Sort tablevoidtoggleSortOrder(int column) protected voidfill in modelToView list with index of viewprotected voidvalidate()Methods inherited from class javax.swing.RowSorteraddRowSorterListener, fireRowSorterChanged, fireSortOrderChanged, removeRowSorterListener
- 
Constructor Details- 
ObjectTableSorter
 
- 
- 
Method Details- 
getPrimaryComparatorReturns Comparator used prior to sorted columns.- Returns:
- Comparator used prior to sorted columns.
 
- 
getValueComparatorReturns Comparator used on column.- Parameters:
- column- to be compared
- Returns:
- Comparator used on column.
 
- 
getFallbackComparatorReturns Comparator if all sorted columns matches. Defaults to model index comparison.- Returns:
- Comparator if all sorted columns matches. Defaults to model index comparison.
 
- 
setPrimaryComparatorComparator used prior to sorted columns.- Parameters:
- primaryComparator-- Comparatorto be used first
- Returns:
- this
 
- 
fixLastRowSetsprimary comparatorto one that don't sort last row.- Returns:
- this
 
- 
setValueComparatorAssign comparator to given column, ifnulla getDefaultComparator(int) default one is used instead.- Parameters:
- column- Model column index.
- comparator- Column value comparator.
- Returns:
- this
 
- 
getDefaultComparatorBuilds a default comparator based on model column class.Collator.getInstance()forString,natural orderforComparable, no sort support for others.- Parameters:
- column- Model column index.
- Returns:
- default Comparator
 
- 
setFallbackComparatorSets a fallback comparator (defaults to model index comparison) if noneprimary, neithercolumn value comparatorscan make differences between two rows.- Parameters:
- comparator- to be used, when all other- Comparators can't see a difference
- Returns:
- this
 
- 
getModel- Specified by:
- getModelin class- RowSorter<ObjectTableModel>
 
- 
toggleSortOrderpublic void toggleSortOrder(int column) - Specified by:
- toggleSortOrderin class- RowSorter<ObjectTableModel>
 
- 
convertRowIndexToModelpublic int convertRowIndexToModel(int index) - Specified by:
- convertRowIndexToModelin class- RowSorter<ObjectTableModel>
 
- 
convertRowIndexToViewpublic int convertRowIndexToView(int index) - Specified by:
- convertRowIndexToViewin class- RowSorter<ObjectTableModel>
 
- 
setSortKeys- Specified by:
- setSortKeysin class- RowSorter<ObjectTableModel>
 
- 
setSortKey
- 
getSortKeys- Specified by:
- getSortKeysin class- RowSorter<ObjectTableModel>
 
- 
getViewRowCountpublic int getViewRowCount()- Specified by:
- getViewRowCountin class- RowSorter<ObjectTableModel>
 
- 
getModelRowCountpublic int getModelRowCount()- Specified by:
- getModelRowCountin class- RowSorter<ObjectTableModel>
 
- 
modelStructureChangedpublic void modelStructureChanged()- Specified by:
- modelStructureChangedin class- RowSorter<ObjectTableModel>
 
- 
allRowsChangedpublic void allRowsChanged()- Specified by:
- allRowsChangedin class- RowSorter<ObjectTableModel>
 
- 
rowsInsertedpublic void rowsInserted(int firstRow, int endRow) - Specified by:
- rowsInsertedin class- RowSorter<ObjectTableModel>
 
- 
rowsDeletedpublic void rowsDeleted(int firstRow, int endRow) - Specified by:
- rowsDeletedin class- RowSorter<ObjectTableModel>
 
- 
rowsUpdatedpublic void rowsUpdated(int firstRow, int endRow) - Specified by:
- rowsUpdatedin class- RowSorter<ObjectTableModel>
 
- 
rowsChangedprotected void rowsChanged(int firstRow, int endRow, boolean deleted, boolean inserted) 
- 
rowsUpdatedpublic void rowsUpdated(int firstRow, int endRow, int column) - Specified by:
- rowsUpdatedin class- RowSorter<ObjectTableModel>
 
- 
isSortableprotected boolean isSortable(int column) 
- 
isSortedprotected boolean isSorted(int column) 
- 
isSortedprotected boolean isSorted()
- 
invalidateprotected void invalidate()
- 
validateprotected void validate()
- 
getComparatorFromSortKey
- 
sortprotected void sort()Sort table
- 
updateModelToViewprotected void updateModelToView()fill in modelToView list with index of view
 
-