Package com.tagtraum.beatunes.filter
Class TableModelSorter
- java.lang.Object
-
- javax.swing.RowSorter<AbstractSongTableModel>
-
- com.tagtraum.beatunes.filter.SongTableRowSorter
-
- com.tagtraum.beatunes.filter.TableModelSorter
-
- All Implemented Interfaces:
SyncTempoAware
public class TableModelSorter extends SongTableRowSorter implements SyncTempoAware
RowSorter
for in-memory tables like they are offered bySimpleSongTable
.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.RowSorter
RowSorter.SortKey
-
-
Constructor Summary
Constructors Constructor Description TableModelSorter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allRowsChanged()
int
convertRowIndexToModel(int viewIndex)
int
convertRowIndexToView(int modelIndex)
AbstractSongTableModel
getModel()
int
getModelRowCount()
SubstringRowFilter
getRowFilter()
Return row filter.List<? extends RowSorter.SortKey>
getSortKeys()
com.tagtraum.audiokern.bpm.Tempo
getSyncTempo()
int
getViewRowCount()
void
modelStructureChanged()
void
nextSortConfig(int column)
Changes theSongTableColumn.SortConfig
that is used for a given model.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
setModel(AbstractSongTableModel model)
Sets the underlying unsorted, unfiltered model.void
setRowFilter(SubstringRowFilter rowFilter)
Sets row filter.void
setSortKeys(List<? extends RowSorter.SortKey> keys)
void
setSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)
When a target tempo is set, thekey
comparator is modified to reflect the BPM-sync adjustment.void
toggleSortOrder(int column)
-
Methods inherited from class com.tagtraum.beatunes.filter.SongTableRowSorter
fireRowSorterChanged, fireSortOrderChanged
-
Methods inherited from class javax.swing.RowSorter
addRowSorterListener, removeRowSorterListener
-
-
-
-
Method Detail
-
getSyncTempo
public com.tagtraum.audiokern.bpm.Tempo getSyncTempo()
-
setSyncTempo
public void setSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)
When a target tempo is set, thekey
comparator is modified to reflect the BPM-sync adjustment.- Specified by:
setSyncTempo
in interfaceSyncTempoAware
- Parameters:
syncTempo
- target tempo
-
setRowFilter
public void setRowFilter(SubstringRowFilter rowFilter)
Description copied from class:SongTableRowSorter
Sets row filter.- Specified by:
setRowFilter
in classSongTableRowSorter
- Parameters:
rowFilter
- filter
-
getRowFilter
public SubstringRowFilter getRowFilter()
Description copied from class:SongTableRowSorter
Return row filter.- Specified by:
getRowFilter
in classSongTableRowSorter
- Returns:
- filter
-
setModel
public void setModel(AbstractSongTableModel model)
Description copied from class:SongTableRowSorter
Sets the underlying unsorted, unfiltered model.- Specified by:
setModel
in classSongTableRowSorter
- Parameters:
model
- table model
-
getModel
public AbstractSongTableModel getModel()
- Specified by:
getModel
in classRowSorter<AbstractSongTableModel>
-
nextSortConfig
public void nextSortConfig(int column)
Description copied from class:SongTableRowSorter
Changes theSongTableColumn.SortConfig
that is used for a given model.- Specified by:
nextSortConfig
in classSongTableRowSorter
- Parameters:
column
- column index- See Also:
SortableTableColumn.ColumnDescriptor.nextSortConfig()
-
toggleSortOrder
public void toggleSortOrder(int column)
- Specified by:
toggleSortOrder
in classRowSorter<AbstractSongTableModel>
-
convertRowIndexToModel
public int convertRowIndexToModel(int viewIndex)
- Specified by:
convertRowIndexToModel
in classRowSorter<AbstractSongTableModel>
-
convertRowIndexToView
public int convertRowIndexToView(int modelIndex)
- Specified by:
convertRowIndexToView
in classRowSorter<AbstractSongTableModel>
-
setSortKeys
public void setSortKeys(List<? extends RowSorter.SortKey> keys)
- Specified by:
setSortKeys
in classRowSorter<AbstractSongTableModel>
-
getSortKeys
public List<? extends RowSorter.SortKey> getSortKeys()
- Specified by:
getSortKeys
in classRowSorter<AbstractSongTableModel>
-
getViewRowCount
public int getViewRowCount()
- Specified by:
getViewRowCount
in classRowSorter<AbstractSongTableModel>
-
getModelRowCount
public int getModelRowCount()
- Specified by:
getModelRowCount
in classRowSorter<AbstractSongTableModel>
-
modelStructureChanged
public void modelStructureChanged()
- Specified by:
modelStructureChanged
in classRowSorter<AbstractSongTableModel>
-
allRowsChanged
public void allRowsChanged()
- Specified by:
allRowsChanged
in classRowSorter<AbstractSongTableModel>
-
rowsInserted
public void rowsInserted(int firstRow, int endRow)
- Specified by:
rowsInserted
in classRowSorter<AbstractSongTableModel>
-
rowsDeleted
public void rowsDeleted(int firstRow, int endRow)
- Specified by:
rowsDeleted
in classRowSorter<AbstractSongTableModel>
-
rowsUpdated
public void rowsUpdated(int firstRow, int endRow)
- Specified by:
rowsUpdated
in classRowSorter<AbstractSongTableModel>
-
rowsUpdated
public void rowsUpdated(int firstRow, int endRow, int column)
- Specified by:
rowsUpdated
in classRowSorter<AbstractSongTableModel>
-
-