Package org.ka2ddo.yaac.gui
Class TMWeather
java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.TMWeather
- All Implemented Interfaces:
Serializable
,TableModel
,HealthMonitorGui.MonitoredStationGettingModel
,MonitoredStationListener
public class TMWeather
extends AbstractTableModel
implements MonitoredStationListener, HealthMonitorGui.MonitoredStationGettingModel
TableModel reporting the most recent weather information reported by configured
weather stations.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
A TableCellRenderer specific to the needs of the Station Health monitoring table. -
Field Summary
Modifier and TypeFieldDescriptionFilter for health monitor Weather table.Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
ConstructorDescriptionCreate a new instance of the weather station monitoring table model. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Shut down the asynchronous update listeners in this table model.Create a StringCellRenderer for the weather data.static String
generateWeatherValue
(AX25Message msg, int columnIndex, boolean showRawValues) Produce the displayable text of a weather attribute,Class<?>
getColumnClass
(int columnIndex) Get the data type of the values for the specified column,int
Get the number of columns defined in this table model.getColumnName
(int column) Get the title to be displayed for the specified column.int
Get the number of rows in the table model (effectively, the number of monitored stations).getStation
(int rowIndex) Get the station associated with the specified row.Color[]
getTableCellColoring
(JTable table, boolean isSelected, int modelRow, int column) Get the foreground and background colors for rendering the values in the specified cell.getValueAt
(int rowIndex, int columnIndex) Get the display value for the specified table cell.getWeatherMessageAt
(int rowIndex, int nthCopy) Get the Nth historical weather message for the specified table cell.void
setShowRawValues
(boolean showRawValues) Specify whether the weather values should be displayed as raw APRS or OpenTRAC values, or formatted into human-expected units.void
stationAdded
(int index, MonitoredStation station) Tell the listener that a new station has been added to the MonitoredStationList.void
stationRemoved
(int index, MonitoredStation station) Tell the listener that a station is no longer being monitored.void
stationUpdated
(int index, MonitoredStation station) Tell the listener that data about a MonitoredStation has changed.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
-
Field Details
-
FILTER
Filter for health monitor Weather table.
-
-
Constructor Details
-
TMWeather
public TMWeather()Create a new instance of the weather station monitoring table model.
-
-
Method Details
-
generateWeatherValue
Produce the displayable text of a weather attribute,- Parameters:
msg
- AX25Message containing the weather datacolumnIndex
- column index according to the layout in the TMWeather table modelshowRawValues
- boolean true if the raw numeric values from the APRS or OpenTRAC message should be displayed, false if the appropriately scaled value should be displayed in the user-configured units- Returns:
- displayable String, or null if no value for this column in this message
-
getRowCount
public int getRowCount()Get the number of rows in the table model (effectively, the number of monitored stations).- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- number of monitored stations
-
getColumnCount
public int getColumnCount()Get the number of columns defined in this table model.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- column count
-
getColumnClass
Get the data type of the values for the specified column,- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- zero-based number of the column to query- Returns:
- Class defining the column's data type
-
getColumnName
Get the title to be displayed for the specified column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- zero-based number of the column- Returns:
- column header localized String
-
getValueAt
Get the display value for the specified table cell.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
rowIndex
- zero-based row numbercolumnIndex
- zero-based column number- Returns:
- value to display
-
getWeatherMessageAt
Get the Nth historical weather message for the specified table cell.- Parameters:
rowIndex
- zero-based row numbernthCopy
- how many more-recent weather messages should be skipped to get to the desired record- Returns:
- historical weather message
-
stationAdded
Tell the listener that a new station has been added to the MonitoredStationList.- Specified by:
stationAdded
in interfaceMonitoredStationListener
- Parameters:
index
- int zero-based position in the list where the station has been addedstation
- MonitoredStation object to add
-
stationUpdated
Tell the listener that data about a MonitoredStation has changed.- Specified by:
stationUpdated
in interfaceMonitoredStationListener
- Parameters:
index
- zero-based index of the station in the MonitoredStationListstation
- MonitoredStation whose data has been updated
-
stationRemoved
Tell the listener that a station is no longer being monitored.- Specified by:
stationRemoved
in interfaceMonitoredStationListener
- Parameters:
index
- int zero-based position in the MonitoredStationList where the station used to bestation
- MonitoredStation being removed
-
getStation
Get the station associated with the specified row.- Specified by:
getStation
in interfaceHealthMonitorGui.MonitoredStationGettingModel
- Parameters:
rowIndex
- the zero-based row index for the desired station- Returns:
- MonitoredStation at the specified row
-
setShowRawValues
public void setShowRawValues(boolean showRawValues) Specify whether the weather values should be displayed as raw APRS or OpenTRAC values, or formatted into human-expected units.- Parameters:
showRawValues
- boolean true if weather values should be reported as-is in the protocol message
-
close
public void close()Shut down the asynchronous update listeners in this table model. -
getTableCellColoring
Get the foreground and background colors for rendering the values in the specified cell.- Parameters:
table
- JTable being renderedisSelected
- boolean true if table cell is selectedmodelRow
- zero-based row number in the table modelcolumn
- zero-based column number in the table model- Returns:
- array of two Colors (background and foreground)
-
createStringCellRenderer
Create a StringCellRenderer for the weather data.- Returns:
- StringCellRenderer
-