Class HeardStationsTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.HeardStationsTableModel
All Implemented Interfaces:
WindowListener, Serializable, EventListener, TableModel, TrackerListener, FastComparableTableModel

public class HeardStationsTableModel extends AbstractTableModel implements TrackerListener, FastComparableTableModel, WindowListener
This class defines a dynamic table model for reporting traffic rates from different stations seen by this station. The table columns consist of the following fixed columns:
  • station identifier
  • station symbol
followed by a variable number of columns indicating 15-minute time slices starting with the current quarter hour and going back as far as the oldest message of the oldest station.

The variable column headings will be updated every quarter hour on the quarter hour boundary. The counts will be updated as new messages are received.

Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Details

    • HeardStationsTableModel

      public HeardStationsTableModel()
  • Method Details

    • setUsingTable

      public void setUsingTable(JTable usingTable)
    • getColumnClass

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

      public int compareRows(int rowIndex1, int rowIndex2, int columnIndex)
      Compare the selected column of the two rows.
      Specified by:
      compareRows in interface FastComparableTableModel
      Parameters:
      rowIndex1 - zero-based model row index of first row to compare
      rowIndex2 - zero-based model row index of second row to compare
      columnIndex - 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
    • getColumnName

      public String getColumnName(int column)
      Returns a name for the column.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AbstractTableModel
      Parameters:
      column - the column being queried
      Returns:
      a string containing the name of column
    • 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:
    • getRowCount

      public int getRowCount()
      Returns the number of rows in the model. A JTable uses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.
      Specified by:
      getRowCount in interface TableModel
      Returns:
      the number of rows in the model
      See Also:
    • getRow

      public StationState getRow(int rowIndex)
      Returns the value for the cell at columnIndex and rowIndex.
      Parameters:
      rowIndex - the row whose value is to be queried
      Returns:
      the value Object at the specified row
    • 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
    • removeTableModelListener

      public void removeTableModelListener(TableModelListener l)
      Removes a listener from the list that's notified each time a change to the data model occurs.
      Specified by:
      removeTableModelListener in interface TableModel
      Overrides:
      removeTableModelListener in class AbstractTableModel
      Parameters:
      l - the TableModelListener
    • messageAdded

      public void messageAdded(StationState ss, int msgIndex, AX25Message msg)
      Called when a Message is added to the history for a station in the tracker.
      Specified by:
      messageAdded in interface TrackerListener
      Parameters:
      ss - StationState containing the station's information
      msgIndex - zero-based index of the message added to the StationState object
      msg - APRS Message object being added to the tracker; note that non-APRS packets that can still be decoded (such as OpenTRAC) will also be passed here; AX25Frames that cannot be decoded will pass null here
    • messageDeleted

      public void messageDeleted(StationState ss, int index, AX25Message msg)
      Called when a AX25Message is deleted from the history for a station in the tracker.
      Specified by:
      messageDeleted in interface TrackerListener
      Parameters:
      ss - StationState containing the station's information; the AX25Message will already be removed from the StationState object
      index - zero-based index of the message removed from the StationState object
      msg - APRS Message object being removed from the tracker; note that non-APRS packets that can still be decoded (such as OpenTRAC) will also be passed here; AX25Frames that cannot be decoded will pass null here
    • stationAdded

      public void stationAdded(StationState ss, int index)
      Called when a new station is initially added to the tracker.
      Specified by:
      stationAdded in interface TrackerListener
      Parameters:
      ss - StationState containing the station's information; the initial Message will not yet be stored within the StationState object
      index - zero-based integer sequence number for this station in the StationTracker
    • stationUpdated

      public void stationUpdated(StationState ss)
      Called when an existing station is updated with new information in the tracker.
      Specified by:
      stationUpdated in interface TrackerListener
      Parameters:
      ss - StationState containing the station's information; the new Message will not yet be stored within the StationState object
    • stationDeleted

      public void stationDeleted(StationState ss, int index)
      Called when an existing station is deleted from the tracker.
      Specified by:
      stationDeleted in interface TrackerListener
      Parameters:
      ss - StationState containing the station's information
      index - zero-based integer sequence number for this station in the StationTracker
    • windowActivated

      public void windowActivated(WindowEvent e)
      Invoked when the Window is set to be the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
      Specified by:
      windowActivated in interface WindowListener
    • windowOpened

      public void windowOpened(WindowEvent e)
      Invoked the first time a window is made visible.
      Specified by:
      windowOpened in interface WindowListener
    • windowClosing

      public void windowClosing(WindowEvent e)
      Invoked when the user attempts to close the window from the window's system menu.
      Specified by:
      windowClosing in interface WindowListener
    • windowClosed

      public void windowClosed(WindowEvent e)
      Invoked when a window has been closed as the result of calling dispose on the window.
      Specified by:
      windowClosed in interface WindowListener
    • windowIconified

      public void windowIconified(WindowEvent e)
      Invoked when a window is changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property.
      Specified by:
      windowIconified in interface WindowListener
      See Also:
    • windowDeiconified

      public void windowDeiconified(WindowEvent e)
      Invoked when a window is changed from a minimized to a normal state.
      Specified by:
      windowDeiconified in interface WindowListener
    • windowDeactivated

      public void windowDeactivated(WindowEvent e)
      Invoked when a Window is no longer the active Window. Only a Frame or a Dialog can be the active Window. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
      Specified by:
      windowDeactivated in interface WindowListener