Package org.ka2ddo.yaac.gui
Class BulletinBoard
java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.BulletinBoard
- All Implemented Interfaces:
Serializable
,TableModel
,TrackerListener
,ColumnSizingTableModel
,FontChangeListener
,FastComparableTableModel
,ClearableTableModel
public class BulletinBoard
extends AbstractTableModel
implements ColumnSizingTableModel, FontChangeListener, FastComparableTableModel, ClearableTableModel, TrackerListener
This class implements a bulletin board display of all the bulletins and NWS notices
currently outstanding on the network. The bulletins are updated as new messages come in.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ka2ddo.yaac.util.ClearableTableModel
ClearableTableModel.ClearType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final List<RowSorter.SortKey>
Default sort order for Bulletin Board table.Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Method Summary
Modifier and TypeMethodDescriptionint
compareRows
(int rowIndex1, int rowIndex2, int columnIndex) Compare the selected column of the two rows.int
deleteAllRows
(ClearableTableModel.ClearType clearType) Delete all rows from this table.void
fontChanged
(String category, Font newFont) Report that the font choice for the specified category has changed.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 the localized name for the column.int
getColumnWidth
(int columnIndex) Specifies the default initial width of a column from this model.static BulletinBoard
Get the BulletinBoard model instance.int
Returns the number of rows in the model.getValueAt
(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndex
androwIndex
.boolean
isCellEditable
(int rowIndex, int columnIndex) boolean
isSizeToFit
(int columnIndex) Specifies whether setWidthToFit() should be enabled on this columnvoid
messageAdded
(StationState ss, int index, AX25Message msg) Called when a AX25Message 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.static void
Display the BulletinBoard window.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.boolean
Identifies whether this table can contain playback (historical) data.boolean
Identifies whether this table can contain realtime data.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, 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, removeTableModelListener, setValueAt
-
Field Details
-
DEFAULT_SORT_KEYS
Default sort order for Bulletin Board table.
-
-
Method Details
-
getInstance
Get the BulletinBoard model instance.- Returns:
- singleton BulletinBoard
-
showBulletinBoard
public static void showBulletinBoard()Display the BulletinBoard window. -
messageAdded
Called when a AX25Message is added to the history for a station in the tracker.- Specified by:
messageAdded
in interfaceTrackerListener
- Parameters:
ss
- StationState containing the station's informationindex
- 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
-
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 AX25Message 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
-
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
-
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
-
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:
-
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:
-
getColumnName
Returns the localized 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
-
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
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) - Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
-
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
-
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
-
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
-
fontChanged
Report that the font choice for the specified category has changed.- Specified by:
fontChanged
in interfaceFontChangeListener
- Parameters:
category
- String font family name (as defined by Font class)newFont
- actual font instance
-
deleteAllRows
Delete all rows from this table.- Specified by:
deleteAllRows
in interfaceClearableTableModel
- Parameters:
clearType
- type of records to delete- Returns:
- number of rows deleted
-
tableCanContainPlayback
public boolean tableCanContainPlayback()Identifies whether this table can contain playback (historical) data.- Specified by:
tableCanContainPlayback
in interfaceClearableTableModel
- Returns:
- boolean true if table can contain playback data.
-
tableCanContainRealtime
public boolean tableCanContainRealtime()Identifies whether this table can contain realtime data.- Specified by:
tableCanContainRealtime
in interfaceClearableTableModel
- Returns:
- boolean true if table can contain realtime data.
-