public class StationListTableModel extends java.lang.Object implements javax.swing.table.TableModel, ColumnSizingTableModel, TrackerListener, java.lang.Runnable, java.beans.PropertyChangeListener, java.awt.event.ActionListener, FilterChangeListener, FastComparableTableModel, UnitEnumChangeListener, ExtraColumnProviderChangeListener
Constructor and Description |
---|
StationListTableModel(java.util.ResourceBundle msgBundle,
boolean isOneShot)
Create a StationListViewer TableModel, obtaining column labels from the specified
ResourceBundle.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Do not call.
|
static void |
addExtraColumnProvider(ExtraColumnProvider p)
Register an ExtraColumnProvider to supplement the columns in instances of this TableModel.
|
void |
addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener to the list that's notified each time a change
to the data model occurs.
|
void |
cellValueChanged(ExtraColumnProvider provider,
GuiContentType guiContentType,
int extraColumnIndex,
SupportsExtraData rowData)
This method is called by an ExtraColumnProvider when the value in a cell of an extra column
changes (corresponding to a TableModelEvent.UPDATE on the displaying table's model).
|
void |
columnListChanged(ExtraColumnProvider provider,
GuiContentType guiContentType)
This method is called by an ExtraColumnProvider when its set of columns changes.
|
int |
compareRows(int rowIndex1,
int rowIndex2,
int columnIndex)
Compare the selected column of the two rows.
|
void |
filterSettingsChanged(Filter changedFilter,
boolean changedByUser)
Called when the specified Filter's matching criteria have been changed.
|
void |
fireTableStructureChanged()
Notifies all listeners that the table's structure has changed.
|
java.lang.Class<?> |
getColumnClass(int columnIndex)
Returns the data Class for the specified column.
|
int |
getColumnCount()
Returns the number of columns in the model.
|
java.lang.String |
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 java.util.ArrayList<ExtraColumnProvider> |
getExtraColumnProvidersCopy()
Get a copy of the list of registered
ExtraColumnProvider s. |
ListViewMode |
getListViewMode()
Get the current mode for viewing the list of stations and objects.
|
int |
getObjectCount()
Get the current number of objects known to YAAC, regardless of the view mode.
|
int |
getRowCount()
Returns the number of rows in the model.
|
StationState |
getSortedRow(int rowIndex)
Return the object state record for the specified index into the sorted
list of objects that is backing the table model.
|
int |
getStationCount()
Get the current number of stations known to YAAC, regardless of the view mode.
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
boolean |
isApplyFilter()
Report whether the currently defined filters should restrict the contents of the
station/object list.
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at
rowIndex and
columnIndex
is editable. |
boolean |
isSizeToFit(int columnIndex)
Specifies whether setWidthToFit() should be enabled on this column
|
void |
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.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
This method gets called when a bound property is changed.
|
static void |
removeExtraColumnProvider(ExtraColumnProvider p)
Remove an ExtraColumnProvider from supplementing the columns in instances of this TableModel.
|
void |
removeTableModelListener(javax.swing.event.TableModelListener l)
Removes a listener from the list that's notified each time a
change to the data model occurs.
|
void |
run()
DO NOT CALL.
|
void |
setApplyFilter(boolean applyFilter)
Specify whether filters should be applied when generating the list of stations and objects.
|
void |
setListViewMode(ListViewMode listViewMode)
Set the current view mode.
|
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Allow changing the editable columns of the table.
|
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 |
stationUpdated(StationState ss)
Called when an existing station is updated with new information in the tracker.
|
void |
unitEnumChanged(java.lang.Enum<? extends UnitEnum> oldEnumValue,
java.lang.Enum<? extends UnitEnum> newEnumValue)
Reports that a unit enum was changed.
|
public StationListTableModel(java.util.ResourceBundle msgBundle, boolean isOneShot)
msgBundle
- ResourceBundle providing localized column titlesisOneShot
- boolean true if model does not refresh itself (useful for mini-webserver)public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
getColumnCount()
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
getRowCount()
public StationState getSortedRow(int rowIndex)
rowIndex
- zero-based row indexpublic java.lang.Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.getValueAt
in interface javax.swing.table.TableModel
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queriedpublic int compareRows(int rowIndex1, int rowIndex2, int columnIndex)
compareRows
in interface FastComparableTableModel
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 comparepublic java.lang.Class<?> getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
columnIndex
- the column being queriedpublic boolean isCellEditable(int rowIndex, int columnIndex)
rowIndex
and
columnIndex
is editable. Otherwise, setValueAt
on the cell will not
change the value of that cell.isCellEditable
in interface javax.swing.table.TableModel
rowIndex
- the row whose value to be queriedcolumnIndex
- the column whose value to be queriedsetValueAt(java.lang.Object, int, int)
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
column
- the column being queriedcolumn
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
aValue
- value to assign to cellrowIndex
- row of cellcolumnIndex
- column of cellpublic int getColumnWidth(int columnIndex)
getColumnWidth
in interface ColumnSizingTableModel
columnIndex
- int index of the model's column whose width should be obtainedpublic boolean isSizeToFit(int columnIndex)
isSizeToFit
in interface ColumnSizingTableModel
columnIndex
- int index of the model's column whose width should be obtainedpublic ListViewMode getListViewMode()
public void setListViewMode(ListViewMode listViewMode)
listViewMode
- ListViewMode to use for future display of stations/objectspublic int getStationCount()
public int getObjectCount()
public void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener
in interface javax.swing.table.TableModel
l
- the TableModelListenerpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener
in interface javax.swing.table.TableModel
l
- the TableModelListenerpublic void fireTableStructureChanged()
JTable
receives this event and its
autoCreateColumnsFromModel
flag is set it discards any table columns that it had and reallocates
default columns in the order they appear in the model. This is the
same as calling setModel(TableModel)
on the
JTable
.TableModelEvent
,
EventListenerList
public boolean isApplyFilter()
public void setApplyFilter(boolean applyFilter)
applyFilter
- boolean true if filters should be usedpublic void messageAdded(StationState ss, int index, AX25Message msg)
messageAdded
in interface TrackerListener
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 herepublic void messageDeleted(StationState ss, int index, AX25Message msg)
messageDeleted
in interface TrackerListener
ss
- StationState containing the station's information; the initial Message
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 herepublic void stationAdded(StationState ss, int index)
stationAdded
in interface TrackerListener
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 StationTrackerpublic void stationUpdated(StationState ss)
stationUpdated
in interface TrackerListener
ss
- StationState containing the station's informationpublic void stationDeleted(StationState ss, int index)
stationDeleted
in interface TrackerListener
ss
- StationState containing the station's informationindex
- zero-based integer sequence number for this station in the StationTrackerpublic void run()
run
in interface java.lang.Runnable
public void filterSettingsChanged(Filter changedFilter, boolean changedByUser)
filterSettingsChanged
in interface FilterChangeListener
changedFilter
- Filter that has changedchangedByUser
- boolean true if change was manually made by user, false if
change was made automatically by dynamic filter logicpublic void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
evt
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void unitEnumChanged(java.lang.Enum<? extends UnitEnum> oldEnumValue, java.lang.Enum<? extends UnitEnum> newEnumValue)
unitEnumChanged
in interface UnitEnumChangeListener
oldEnumValue
- old enumeration unit of the typenewEnumValue
- new enumeration unit of the same enum typepublic static java.util.ArrayList<ExtraColumnProvider> getExtraColumnProvidersCopy()
ExtraColumnProvider
s. Intended
for use by other TableModels that intend to support extra data columns.ExtraColumnProvider
spublic static void addExtraColumnProvider(ExtraColumnProvider p)
p
- ExtraColumnProvider to registerpublic static void removeExtraColumnProvider(ExtraColumnProvider p)
p
- ExtraColumnProvider to unregisterpublic void columnListChanged(ExtraColumnProvider provider, GuiContentType guiContentType)
columnListChanged
in interface ExtraColumnProviderChangeListener
provider
- the ExtraColumnProvider reporting the changeguiContentType
- the GuiContentType of the set of modified extra columnspublic void cellValueChanged(ExtraColumnProvider provider, GuiContentType guiContentType, int extraColumnIndex, SupportsExtraData rowData)
cellValueChanged
in interface ExtraColumnProviderChangeListener
provider
- the ExtraColumnProvider reporting the changeguiContentType
- the GuiContentType of the set of extra columnsextraColumnIndex
- zero-based index of extra column from this provider that changedrowData
- SupportsExtraData object for the modified row, or null for all rows