public class NoteHistoryTableModel extends MidicaTableModel
This class represents the data model of the note history in the channel details.
Each row represents a played note.
Modifier and Type | Field and Description |
---|---|
private byte |
channel |
private static long |
serialVersionUID |
private java.util.ArrayList<java.lang.Long[]> |
tableData
note number – velocity – tick – 0=past,1=future
|
columnClasses, columnNames, sortableColumns
Constructor and Description |
---|
NoteHistoryTableModel(byte channel)
Creates a new instance of a note history table data model.
|
Modifier and Type | Method and Description |
---|---|
void |
fireTableDataChanged()
Refreshes the model’s data with the note history obtained by the
SequenceAnalyzer . |
byte |
getChannel()
Returns the channel number.
|
int |
getColumnCount()
Returns the number of columns in the table.
|
java.lang.String |
getColumnName(int index)
Returns the column name according to the given index.
|
int |
getRowCount()
Returns the number of rows in the table.
|
java.lang.Object |
getValueAt(int rowIndex,
int colIndex)
Returns the value to be written into the specified table cell.
|
boolean |
isFuture(int rowIndex)
Determines if the given table row consists a note from the future or from the past.
|
getCategorizedHashMapRows, getCategorizedRows, getColumnClass, getHeaderTooltip, isCellEditable, isSortable, setHeaderToolTip
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
private static final long serialVersionUID
private byte channel
private java.util.ArrayList<java.lang.Long[]> tableData
note number – velocity – tick – 0=past,1=future
public NoteHistoryTableModel(byte channel)
Creates a new instance of a note history table data model.
Announces itself as a channel observer to the MidiDevices
class.
channel
- MIDI channel associated with this model.public java.lang.String getColumnName(int index)
Returns the column name according to the given index.
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class MidicaTableModel
index
- Table column index.public int getColumnCount()
Returns the number of columns in the table.
getColumnCount
in interface javax.swing.table.TableModel
getColumnCount
in class MidicaTableModel
public int getRowCount()
Returns the number of rows in the table. That is the same as the number of entries in the note history ring buffer of the model’s channel.
getRowCount
in interface javax.swing.table.TableModel
getRowCount
in class MidicaTableModel
public java.lang.Object getValueAt(int rowIndex, int colIndex)
Returns the value to be written into the specified table cell.
getValueAt
in interface javax.swing.table.TableModel
getValueAt
in class MidicaTableModel
rowIndex
- Queried table row index.colIndex
- Queried table column index.public void fireTableDataChanged()
Refreshes the model’s data with the note history obtained by the SequenceAnalyzer
.
Then: calls the overridden method to inform the parent class about the data change.
This method is called whenever a note in the model’s channel is played.
fireTableDataChanged
in class javax.swing.table.AbstractTableModel
public boolean isFuture(int rowIndex)
Determines if the given table row consists a note from the future or from the past.
This is called by the cell renderer for choosing the right background color.
rowIndex
- Table row index.public byte getChannel()
Returns the channel number.
This is called by the cell renderer for choosing the right tooltip for percussion IDs.