Package org.ka2ddo.yaac.gui
Class ConnectionModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.ka2ddo.yaac.gui.ConnectionModel
- All Implemented Interfaces:
Serializable
,TableModel
,ConnStateChangeListener
,ColumnSizingTableModel
public class ConnectionModel
extends AbstractTableModel
implements ColumnSizingTableModel, ConnStateChangeListener
This presents the current list of AX.25 connected sessions managed by this process's
AX.25 stack as a table view.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
ConstructorDescriptionCreate a TableModel for viewing the current AX.25 connected-mode sessions observed by this instance of YAAC. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener to the list that's notified each time a change to the data model occurs.Class<?>
getColumnClass
(int columnIndex) Returns rendering data type for each column of the table.int
Returns the number of columns in the model.getColumnName
(int column) Returns the localized name for each column.int
getColumnWidth
(int columnIndex) Specifies the default initial width of a column from this model.int
Returns the number of rows in the model.getValueAt
(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndex
androwIndex
.boolean
isSizeToFit
(int columnIndex) Specifies whether setWidthToFit() should be enabled on this columnvoid
Removes a listener from the list that's notified each time a change to the data model occurs.void
updateConnStateRow
(AX25Callsign sender, AX25Callsign dest) Report that the row containing the specified pair of callsigns has been updated.void
Report that a ConnState session has been added or removed from theAX25Stack
, but we don't know which row number it is.Methods inherited from class javax.swing.table.AbstractTableModel
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
isCellEditable, setValueAt
-
Constructor Details
-
ConnectionModel
public ConnectionModel()Create a TableModel for viewing the current AX.25 connected-mode sessions observed by this instance of YAAC.
-
-
Method Details
-
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:
-
getColumnClass
Returns rendering data type for each column of the table.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the column being queried- Returns:
- the Object.class
-
getColumnName
Returns the localized name for each column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column being queried- Returns:
- a string containing the name of
column
-
getRowCount
public int getRowCount()Returns the number of rows in the model.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of rows in the model
- See Also:
-
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
-
addTableModelListener
Adds a listener to the list that's notified each time a change to the data model occurs.- Specified by:
addTableModelListener
in interfaceTableModel
- Overrides:
addTableModelListener
in classAbstractTableModel
- Parameters:
l
- the TableModelListener
-
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
-
updateConnStateRow
Report that the row containing the specified pair of callsigns has been updated. This is expected to be called from a thread other than the AWT dispatch thread.- Specified by:
updateConnStateRow
in interfaceConnStateChangeListener
- Parameters:
sender
- AX25Callsign of originator of sessiondest
- AX25Callsign of recipient of session
-
updateWholeConStateTable
public void updateWholeConStateTable()Report that a ConnState session has been added or removed from theAX25Stack
, but we don't know which row number it is. This is expected to be called from a thread other than the AWT dispatch thread.- Specified by:
updateWholeConStateTable
in interfaceConnStateChangeListener
-