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 Details

    • fmtMonitorFreq

      protected static final DecimalFormat fmtMonitorFreq
      Format string for APRS-standard frequency format.
  • Constructor Details

    • KenwoodMessageListTableModel

      public KenwoodMessageListTableModel(MainGui gui)
      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 interface TableModel
      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 interface TableModel
      Returns:
      the number of columns in the model
      See Also:
    • getSortedRow

      public AX25Message getSortedRow(int rowIndex)
      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

      public Object getValueAt(int rowIndex, int columnIndex)
      Returns the value for the cell at columnIndex and rowIndex.
      Specified by:
      getValueAt in interface TableModel
      Parameters:
      rowIndex - the row whose value is to be queried
      columnIndex - the column whose value is to be queried
      Returns:
      the value Object at the specified cell
    • getColumnClass

      public Class<?> getColumnClass(int columnIndex)
      Returns the data Class for the specified column.
      Specified by:
      getColumnClass in interface TableModel
      Parameters:
      columnIndex - the column being queried
      Returns:
      the Class object for the column's data
    • getColumnName

      public String getColumnName(int column)
      Returns an empty name for the column (because the Kenwood D710 control head doesn't display column headers).
      Specified by:
      getColumnName in interface TableModel
      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 interface ColumnSizingTableModel
      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 interface ColumnSizingTableModel
      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 interface DuplicateCheckedAX25Listener
      Parameters:
      msg - decoded APRS message if the AX.25 frame contains an APRS packet, or null if the frame is not a recognized protocol
      frame - received AX25Frame
      connector - the PortConnector over which the frame was received
      isDuplicate - 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 at rowIndex and columnIndex is editable. Otherwise, setValueAt on the cell will not change the value of that cell.
      Specified by:
      isCellEditable in interface TableModel
      Parameters:
      rowIndex - the row whose value to be queried
      columnIndex - the column whose value to be queried
      Returns:
      true if the cell is editable
      See Also:
    • setValueAt

      public void setValueAt(Object aValue, int rowIndex, int columnIndex)
      Sets the value in the cell at columnIndex and rowIndex to aValue.
      Specified by:
      setValueAt in interface TableModel
      Parameters:
      aValue - the new value
      rowIndex - the row whose value is to be changed
      columnIndex - the column whose value is to be changed
      See Also:
    • addTableModelListener

      public void addTableModelListener(TableModelListener l)
      Adds a listener to the list that is notified each time a change to the data model occurs.
      Specified by:
      addTableModelListener in interface TableModel
      Parameters:
      l - the TableModelListener
    • removeTableModelListener

      public void removeTableModelListener(TableModelListener l)
      Removes a listener from the list that is notified each time a change to the data model occurs.
      Specified by:
      removeTableModelListener in interface TableModel
      Parameters:
      l - the TableModelListener