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 abstractRowSorter
for tables that use aBeanTableModel
.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
modelToView
protected java.util.List<V>
viewToModel
-
Constructor Summary
Constructors Modifier Constructor Description protected
BeanModelRowSorter(DecoratedTable<BEAN,MODEL> table, TableRowComparator<BEAN,V> comparator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
allRowsChanged()
int
convertRowIndexToModel(int index)
int
convertRowIndexToView(int index)
protected java.util.function.Predicate<V>
createViewFilter(java.util.function.Predicate<BEAN> rowFilter)
protected BEAN
getBean(int rowIndex)
MODEL
getModel()
int
getModelRowCount()
java.util.List<? extends javax.swing.RowSorter.SortKey>
getSortKeys()
int
getViewRowCount()
protected boolean
isVisible(int modelRow)
void
modelStructureChanged()
protected abstract java.util.List<V>
newModelRows(int firstRow, int lastRow)
Create a list of view/model mappings.protected abstract void
postSort()
protected void
reset()
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)
void
setRowFilter(java.util.function.Predicate<BEAN> rowFilter)
void
setSortKeys(java.util.List<? extends javax.swing.RowSorter.SortKey> keys)
void
toggleSortOrder(int column)
protected void
updateModelIndex(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:
getModel
in 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:
toggleSortOrder
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
convertRowIndexToModel
public int convertRowIndexToModel(int index)
- Specified by:
convertRowIndexToModel
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
convertRowIndexToView
public int convertRowIndexToView(int index)
- Specified by:
convertRowIndexToView
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
setSortKeys
public void setSortKeys(java.util.List<? extends javax.swing.RowSorter.SortKey> keys)
- Specified by:
setSortKeys
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getSortKeys
public java.util.List<? extends javax.swing.RowSorter.SortKey> getSortKeys()
- Specified by:
getSortKeys
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getViewRowCount
public int getViewRowCount()
- Specified by:
getViewRowCount
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getModelRowCount
public int getModelRowCount()
- Specified by:
getModelRowCount
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
modelStructureChanged
public void modelStructureChanged()
- Specified by:
modelStructureChanged
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
reset
protected void reset()
-
allRowsChanged
public void allRowsChanged()
- Specified by:
allRowsChanged
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
rowsInserted
public void rowsInserted(int firstRow, int endRow)
- Specified by:
rowsInserted
in 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:
rowsDeleted
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
rowsUpdated
public void rowsUpdated(int firstRow, int endRow)
- Specified by:
rowsUpdated
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
rowsUpdated
public void rowsUpdated(int firstRow, int endRow, int column)
- Specified by:
rowsUpdated
in classjavax.swing.RowSorter<MODEL extends BeanTableModel<BEAN>>
-
getBean
protected BEAN getBean(int rowIndex)
-
postSort
protected abstract void postSort()
-
-