Class BeanModelRowSorter<BEAN,MODEL extends BeanTableModel<BEAN>,V extends ViewToModel<BEAN>>
- java.lang.Object
-
- javax.swing.RowSorter<MODEL>
-
- io.github.jonestimd.swing.table.sort.BeanModelRowSorter<BEAN,MODEL,V>
-
- Type Parameters:
BEAN- the class of the beans in the tableMODEL- the class of the table modelV- the class of the view/model mappings
- Direct Known Subclasses:
HeaderDetailTableRowSorter,SectionTableRowSorter
public abstract class BeanModelRowSorter<BEAN,MODEL extends BeanTableModel<BEAN>,V extends ViewToModel<BEAN>> extends javax.swing.RowSorter<MODEL>An abstractRowSorterfor tables that use aBeanTableModel.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]modelToViewprotected java.util.List<V>viewToModel
-
Constructor Summary
Constructors Modifier Constructor Description protectedBeanModelRowSorter(DecoratedTable<BEAN,MODEL> table, TableRowComparator<BEAN,V> comparator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidallRowsChanged()intconvertRowIndexToModel(int index)intconvertRowIndexToView(int index)protected java.util.function.Predicate<V>createViewFilter(java.util.function.Predicate<BEAN> rowFilter)protected BEANgetBean(int rowIndex)MODELgetModel()intgetModelRowCount()java.util.List<? extends javax.swing.RowSorter.SortKey>getSortKeys()intgetViewRowCount()protected booleanisVisible(int modelRow)voidmodelStructureChanged()protected abstract java.util.List<V>newModelRows(int firstRow, int lastRow)Create a list of view/model mappings.protected abstract voidpostSort()protected voidreset()voidrowsDeleted(int firstRow, int endRow)voidrowsInserted(int firstRow, int endRow)voidrowsUpdated(int firstRow, int endRow)voidrowsUpdated(int firstRow, int endRow, int column)voidsetRowFilter(java.util.function.Predicate<BEAN> rowFilter)voidsetSortKeys(java.util.List<? extends javax.swing.RowSorter.SortKey> keys)voidtoggleSortOrder(int column)protected voidupdateModelIndex(int firstRow, int deltaRows)
-
-
-
Field Detail
-
viewToModel
protected java.util.List<V extends ViewToModel<BEAN>> viewToModel
-
modelToView
protected int[] modelToView
-
-
Constructor Detail
-
BeanModelRowSorter
protected BeanModelRowSorter(DecoratedTable<BEAN,MODEL> table, TableRowComparator<BEAN,V> comparator)
-
-
Method Detail
-
getModel
public MODEL getModel()
- Specified by:
getModelin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
setRowFilter
public void setRowFilter(java.util.function.Predicate<BEAN> rowFilter)
-
createViewFilter
protected java.util.function.Predicate<V> createViewFilter(java.util.function.Predicate<BEAN> rowFilter)
-
toggleSortOrder
public void toggleSortOrder(int column)
- Specified by:
toggleSortOrderin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
convertRowIndexToModel
public int convertRowIndexToModel(int index)
- Specified by:
convertRowIndexToModelin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
convertRowIndexToView
public int convertRowIndexToView(int index)
- Specified by:
convertRowIndexToViewin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
setSortKeys
public void setSortKeys(java.util.List<? extends javax.swing.RowSorter.SortKey> keys)
- Specified by:
setSortKeysin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getSortKeys
public java.util.List<? extends javax.swing.RowSorter.SortKey> getSortKeys()
- Specified by:
getSortKeysin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getViewRowCount
public int getViewRowCount()
- Specified by:
getViewRowCountin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getModelRowCount
public int getModelRowCount()
- Specified by:
getModelRowCountin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
modelStructureChanged
public void modelStructureChanged()
- Specified by:
modelStructureChangedin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
reset
protected void reset()
-
allRowsChanged
public void allRowsChanged()
- Specified by:
allRowsChangedin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
rowsInserted
public void rowsInserted(int firstRow, int endRow)- Specified by:
rowsInsertedin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
newModelRows
protected abstract java.util.List<V> newModelRows(int firstRow, int lastRow)
Create a list of view/model mappings.- Parameters:
firstRow- the starting model index (inclusive)lastRow- the ending model index (inclusive)- Returns:
- a new list of view/model mappings
-
updateModelIndex
protected void updateModelIndex(int firstRow, int deltaRows)
-
isVisible
protected boolean isVisible(int modelRow)
-
rowsDeleted
public void rowsDeleted(int firstRow, int endRow)- Specified by:
rowsDeletedin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
rowsUpdated
public void rowsUpdated(int firstRow, int endRow)- Specified by:
rowsUpdatedin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
rowsUpdated
public void rowsUpdated(int firstRow, int endRow, int column)- Specified by:
rowsUpdatedin classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getBean
protected BEAN getBean(int rowIndex)
-
postSort
protected abstract void postSort()
-
-