Package org.ka2ddo.yaac.gui
Class DXTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.DXTableModel
- All Implemented Interfaces:
Serializable
,Runnable
,TableModel
,AprsMessageListener
,PurgeListener
,ColumnSizingTableModel
,FastComparableTableModel
,ClearableTableModel
public class DXTableModel
extends AbstractTableModel
implements AprsMessageListener, ColumnSizingTableModel, FastComparableTableModel, ClearableTableModel, PurgeListener, Runnable
This class implements a table model for tracking incoming DX reports.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ka2ddo.yaac.util.ClearableTableModel
ClearableTableModel.ClearType
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Delivers the next message received by YAAC that is an APRS message.int
compareRows
(int rowIndex1, int rowIndex2, int columnIndex) Compare the selected column of the two rows.int
deleteAllRows
(ClearableTableModel.ClearType clearType) Delete all rows from this table.Class<?>
getColumnClass
(int columnIndex) Returns the class of data in the column.int
Returns the number of columns in the model.getColumnName
(int column) Returns the localized name for the column.int
getColumnWidth
(int columnIndex) Specifies the default initial width of a column from this model.static DXTableModel
Get the shareable singleton instance of DXTableModel.int
Returns the number of rows in the model.getValueAt
(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndex
androwIndex
.boolean
isSizeToFit
(int columnIndex) Specifies whether setWidthToFit() should be enabled on this columnvoid
pruneOccurred
(long oldestToBeKept, boolean msgsWereDeleted, boolean stationsWereDeleted) Called whenStationTracker
has finished its pruning.void
run()
DO NOT CALL.boolean
Identifies whether this table can contain playback (historical) data.boolean
Identifies whether this table can contain realtime data.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
-
Method Details
-
getInstance
Get the shareable singleton instance of DXTableModel.- Returns:
- the instance of DXTableModel.
-
aprsMessageReceived
Delivers the next message received by YAAC that is an APRS message.- Specified by:
aprsMessageReceived
in interfaceAprsMessageListener
- Parameters:
msg
- some subclass of Message containing the message contents; the message should have an AX25Frame connected to it- See Also:
-
getRowCount
public int getRowCount()Returns the number of rows in the model.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of rows in the model
- See Also:
-
getColumnCount
public int getColumnCount()Returns the number of columns in the model.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- the number of columns in the model
- See Also:
-
getValueAt
Returns the value for the cell atcolumnIndex
androwIndex
.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried- Returns:
- the value Object at the specified cell
-
getColumnName
Returns the localized name for the column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column being queried- Returns:
- a string containing the name of
column
-
getColumnClass
Returns the class of data in the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the column being queried- Returns:
- the Object.class
-
getColumnWidth
public int getColumnWidth(int columnIndex) Specifies the default initial width of a column from this model. Should only be queried at table creation time.- Specified by:
getColumnWidth
in interfaceColumnSizingTableModel
- Parameters:
columnIndex
- int index of the model's column whose width should be obtained- Returns:
- the width, in the same units used by the TableColumn class's setWidth() method, or -1 to indicate the width should not be forced
-
isSizeToFit
public boolean isSizeToFit(int columnIndex) Specifies whether setWidthToFit() should be enabled on this column- Specified by:
isSizeToFit
in interfaceColumnSizingTableModel
- Parameters:
columnIndex
- int index of the model's column whose width should be obtained- Returns:
- boolean true if sizeWidthToFit() should be called on this column
-
compareRows
public int compareRows(int rowIndex1, int rowIndex2, int columnIndex) Compare the selected column of the two rows.- Specified by:
compareRows
in interfaceFastComparableTableModel
- Parameters:
rowIndex1
- zero-based model row index of first row to comparerowIndex2
- zero-based model row index of second row to comparecolumnIndex
- zero-based model column index of column to compare- Returns:
- +1 if the 1st row's column is after the 2nd row's column, -1 if before, or 0 if equal precedence
-
deleteAllRows
Delete all rows from this table.- Specified by:
deleteAllRows
in interfaceClearableTableModel
- Parameters:
clearType
- type of records to delete- Returns:
- number of rows deleted
-
tableCanContainPlayback
public boolean tableCanContainPlayback()Identifies whether this table can contain playback (historical) data.- Specified by:
tableCanContainPlayback
in interfaceClearableTableModel
- Returns:
- boolean true if table can contain playback data.
-
tableCanContainRealtime
public boolean tableCanContainRealtime()Identifies whether this table can contain realtime data.- Specified by:
tableCanContainRealtime
in interfaceClearableTableModel
- Returns:
- boolean true if table can contain realtime data.
-
pruneOccurred
public void pruneOccurred(long oldestToBeKept, boolean msgsWereDeleted, boolean stationsWereDeleted) Called whenStationTracker
has finished its pruning.- Specified by:
pruneOccurred
in interfacePurgeListener
- Parameters:
oldestToBeKept
- Unix time in milliseconds since midnight Jan 1 1970 UTC of the oldest realtime information that should be keptmsgsWereDeleted
- boolean true if any packets were purgedstationsWereDeleted
- boolean true if any stations or objects were purged
-
run
public void run()DO NOT CALL. AWT thread executor for pruning.
-