public class ObjectPacketModel extends java.lang.Object implements javax.swing.table.TableModel, TrackerListener, AprsMessageContainingModel, FastComparableTableModel
Constructor and Description |
---|
ObjectPacketModel(StationState ss,
StationTracker tracker)
Create a table model for viewing the historical packet traffic of a tracked station.
|
Modifier and Type | Method and Description |
---|---|
void |
addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener to the list that is notified each time a change
to the data model occurs.
|
int |
compareRows(int rowIndex1,
int rowIndex2,
int columnIndex)
Compare the selected column of the two rows.
|
java.lang.Class<?> |
getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values
in the column.
|
int |
getColumnCount()
Returns the number of columns in the model.
|
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the column at
columnIndex . |
int |
getColumnWidth(int columnIndex)
Specifies the default initial width of a column from this model.
|
AX25Message |
getMessageAt(int rowIndex)
Fetch the AX25Message object at the specified index.
|
int |
getRowCount()
Returns the number of rows in the model.
|
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
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 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 |
removeTableModelListener(javax.swing.event.TableModelListener l)
Removes a listener from the list that is notified each time a
change to the data model occurs.
|
void |
setMode(RawPacketDisplayMode mode)
Specify what display mode should be used to present the message body of the specified
message when the body's column is requested with the getValueAt() method.
|
void |
setValueAt(java.lang.Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at
columnIndex and
rowIndex to aValue . |
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.
|
public ObjectPacketModel(StationState ss, StationTracker tracker)
ss
- StationState object of the station or object to displaytracker
- reference to the StationTracker so changes can be listened forpublic int getRowCount()
JTable
uses this method to determine how many rows it
should display. This method should be quick, as it
is called frequently during rendering.getRowCount
in interface javax.swing.table.TableModel
getColumnCount()
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
getRowCount()
public java.lang.String getColumnName(int columnIndex)
columnIndex
. This is used
to initialize the table's column header name. Note: this name does
not need to be unique; two columns in a table can have the same name.getColumnName
in interface javax.swing.table.TableModel
columnIndex
- the index of the columnpublic java.lang.Class<?> getColumnClass(int columnIndex)
JTable
to set up a
default renderer and editor for the column.getColumnClass
in interface javax.swing.table.TableModel
columnIndex
- the index of the columnpublic 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 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.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 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
columnIndex
and
rowIndex
to aValue
.setValueAt
in interface javax.swing.table.TableModel
aValue
- the new valuerowIndex
- the row whose value is to be changedcolumnIndex
- the column whose value is to be changedgetValueAt(int, int)
,
isCellEditable(int, int)
public void addTableModelListener(javax.swing.event.TableModelListener l)
addTableModelListener
in interface javax.swing.table.TableModel
l
- the TableModelListenerpublic void removeTableModelListener(javax.swing.event.TableModelListener l)
removeTableModelListener
in interface javax.swing.table.TableModel
l
- the TableModelListenerpublic 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 AX25Message getMessageAt(int rowIndex) throws java.lang.IndexOutOfBoundsException
getMessageAt
in interface AprsMessageContainingModel
rowIndex
- zero-based index to the specified Messagejava.lang.IndexOutOfBoundsException
- if the row index is < 0 or >= the size of the Message listpublic void setMode(RawPacketDisplayMode mode)
setMode
in interface AprsMessageContainingModel
mode
- RawPacketDisplayMode enum specifying the display modegetValueAt(int, int)
public void stationAdded(StationState ss, int index)
stationAdded
in interface TrackerListener
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 StationTrackerpublic void stationUpdated(StationState ss)
stationUpdated
in interface TrackerListener
ss
- StationState containing the station's information; the new Message
will not yet be stored within the StationState objectpublic 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 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
- AX.25 Message object being added to the trackerpublic void messageDeleted(StationState ss, int index, AX25Message msg)
messageDeleted
in interface TrackerListener
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