Package org.ka2ddo.yaac.gui
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
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:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareRows
(int rowIndex1, int rowIndex2, int columnIndex) Compare the selected column of the two rows.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 a name for the column.getRow
(int rowIndex) Returns the value for the cell atcolumnIndex
androwIndex
.int
Returns the number of rows in the model.getValueAt
(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndex
androwIndex
.void
messageAdded
(StationState ss, int msgIndex, AX25Message msg) Called when a Message is added to the history for a station in the tracker.void
messageDeleted
(StationState ss, int index, AX25Message msg) Called when a AX25Message is deleted from the history for a station in the tracker.void
Removes a listener from the list that's notified each time a change to the data model occurs.void
setUsingTable
(JTable usingTable) void
stationAdded
(StationState ss, int index) Called when a new station is initially added to the tracker.void
stationDeleted
(StationState ss, int index) Called when an existing station is deleted from the tracker.void
Called when an existing station is updated with new information in the tracker.void
Invoked when the Window is set to be the active Window.void
Invoked when a window has been closed as the result of calling dispose on the window.void
Invoked when the user attempts to close the window from the window's system menu.void
Invoked when a Window is no longer the active Window.void
Invoked when a window is changed from a minimized to a normal state.void
Invoked when a window is changed from a normal to a minimized state.void
Invoked the first time a window is made visible.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, 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, setValueAt
-
Constructor Details
-
HeardStationsTableModel
public HeardStationsTableModel()
-
-
Method Details
-
setUsingTable
-
getColumnClass
Returns the data Class for the specified column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- 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 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
-
getColumnName
Returns a 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
-
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:
-
getRowCount
public int getRowCount()Returns the number of rows in the model. AJTable
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 interfaceTableModel
- Returns:
- the number of rows in the model
- See Also:
-
getRow
Returns the value for the cell atcolumnIndex
androwIndex
.- Parameters:
rowIndex
- the row whose value is to be queried- Returns:
- the value Object at the specified row
-
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
-
removeTableModelListener
Removes a listener from the list that's notified each time a change to the data model occurs.- Specified by:
removeTableModelListener
in interfaceTableModel
- Overrides:
removeTableModelListener
in classAbstractTableModel
- Parameters:
l
- the TableModelListener
-
messageAdded
Called when a Message is added to the history for a station in the tracker.- Specified by:
messageAdded
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's informationmsgIndex
- zero-based index of the message added to the StationState objectmsg
- 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
Called when a AX25Message is deleted from the history for a station in the tracker.- Specified by:
messageDeleted
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's information; the AX25Message will already be removed from the StationState objectindex
- zero-based index of the message removed from the StationState objectmsg
- 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
Called when a new station is initially added to the tracker.- Specified by:
stationAdded
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's information; the initial Message will not yet be stored within the StationState objectindex
- zero-based integer sequence number for this station in the StationTracker
-
stationUpdated
Called when an existing station is updated with new information in the tracker.- Specified by:
stationUpdated
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's information; the new Message will not yet be stored within the StationState object
-
stationDeleted
Called when an existing station is deleted from the tracker.- Specified by:
stationDeleted
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's informationindex
- zero-based integer sequence number for this station in the StationTracker
-
windowActivated
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 interfaceWindowListener
-
windowOpened
Invoked the first time a window is made visible.- Specified by:
windowOpened
in interfaceWindowListener
-
windowClosing
Invoked when the user attempts to close the window from the window's system menu.- Specified by:
windowClosing
in interfaceWindowListener
-
windowClosed
Invoked when a window has been closed as the result of calling dispose on the window.- Specified by:
windowClosed
in interfaceWindowListener
-
windowIconified
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 interfaceWindowListener
- See Also:
-
windowDeiconified
Invoked when a window is changed from a minimized to a normal state.- Specified by:
windowDeiconified
in interfaceWindowListener
-
windowDeactivated
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 interfaceWindowListener
-