Package org.ka2ddo.yaac.gui
Class KenwoodMessageListTableModel
java.lang.Object
org.ka2ddo.yaac.gui.KenwoodMessageListTableModel
- All Implemented Interfaces:
TableModel
,DuplicateCheckedAX25Listener
,ColumnSizingTableModel
public class KenwoodMessageListTableModel
extends Object
implements TableModel, ColumnSizingTableModel, DuplicateCheckedAX25Listener
This provides a sortable, filterable situational status display, attempting to emulate the Kenwood D710 control
head's LIST view, as a backing TableModel for a JTable view.
- Author:
- Andrew Pavlin, KA2DDO
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final DecimalFormat
Format string for APRS-standard frequency format. -
Constructor Summary
ConstructorDescriptionCreate a KenwoodMessageListTableModel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener to the list that is notified each time a change to the data model occurs.void
consumeAX25Frame
(AX25Message msg, AX25Frame frame, Connector connector, boolean isDuplicate) Called when a AX.25 frame is received.Class<?>
getColumnClass
(int columnIndex) Returns the data Class for the specified column.int
Returns the number of columns in the model.getColumnName
(int column) Returns an empty name for the column (because the Kenwood D710 control head doesn't display column headers).int
getColumnWidth
(int columnIndex) Specifies the default initial width of a column from this model.int
Returns the number of rows in the model.getSortedRow
(int rowIndex) Return the object state record for the specified index into the sorted list of objects that is backing the table model.getValueAt
(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndex
androwIndex
.boolean
isCellEditable
(int rowIndex, int columnIndex) Returns true if the cell atrowIndex
andcolumnIndex
is editable.boolean
isSizeToFit
(int columnIndex) Specifies whether setWidthToFit() should be enabled on this columnvoid
Removes a listener from the list that is notified each time a change to the data model occurs.void
setValueAt
(Object aValue, int rowIndex, int columnIndex) Sets the value in the cell atcolumnIndex
androwIndex
toaValue
.
-
Field Details
-
fmtMonitorFreq
Format string for APRS-standard frequency format.
-
-
Constructor Details
-
KenwoodMessageListTableModel
Create a KenwoodMessageListTableModel.- Parameters:
gui
- MainGui object parenting this model
-
-
Method Details
-
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:
-
getSortedRow
Return the object state record for the specified index into the sorted list of objects that is backing the table model.- Parameters:
rowIndex
- zero-based row index- Returns:
- StationState record describing the Object or Item
-
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
-
getColumnClass
Returns the data Class for the specified column.- Specified by:
getColumnClass
in interfaceTableModel
- Parameters:
columnIndex
- the column being queried- Returns:
- the Class object for the column's data
-
getColumnName
Returns an empty name for the column (because the Kenwood D710 control head doesn't display column headers).- Specified by:
getColumnName
in interfaceTableModel
- Parameters:
column
- the column being queried- Returns:
- a string containing the default name of
column
-
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
-
consumeAX25Frame
public void consumeAX25Frame(AX25Message msg, AX25Frame frame, Connector connector, boolean isDuplicate) Called when a AX.25 frame is received.- Specified by:
consumeAX25Frame
in interfaceDuplicateCheckedAX25Listener
- Parameters:
msg
- decoded APRS message if the AX.25 frame contains an APRS packet, or null if the frame is not a recognized protocolframe
- received AX25Frameconnector
- the PortConnector over which the frame was receivedisDuplicate
- boolean true if this is a duplicate message (possibly received over a different digipeater path)
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) Returns true if the cell atrowIndex
andcolumnIndex
is editable. Otherwise,setValueAt
on the cell will not change the value of that cell.- Specified by:
isCellEditable
in interfaceTableModel
- Parameters:
rowIndex
- the row whose value to be queriedcolumnIndex
- the column whose value to be queried- Returns:
- true if the cell is editable
- See Also:
-
setValueAt
Sets the value in the cell atcolumnIndex
androwIndex
toaValue
.- Specified by:
setValueAt
in interfaceTableModel
- Parameters:
aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changed- See Also:
-
addTableModelListener
Adds a listener to the list that is notified each time a change to the data model occurs.- Specified by:
addTableModelListener
in interfaceTableModel
- Parameters:
l
- the TableModelListener
-
removeTableModelListener
Removes a listener from the list that is notified each time a change to the data model occurs.- Specified by:
removeTableModelListener
in interfaceTableModel
- Parameters:
l
- the TableModelListener
-