org.ka2ddo.yaac.gui
Class DXTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.ka2ddo.yaac.gui.DXTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, AprsMessageListener, ColumnSizingTableModel, FastComparableTableModel, ClearableTableModel

public class DXTableModel
extends javax.swing.table.AbstractTableModel
implements AprsMessageListener, ColumnSizingTableModel, FastComparableTableModel, ClearableTableModel

This class implements a table model for tracking incoming DX reports.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ka2ddo.yaac.util.ClearableTableModel
ClearableTableModel.ClearType
 
Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Method Summary
 void aprsMessageReceived(Message msg)
          Delivers the next message received by YAAC that is an APRS message.
 int 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.
 java.lang.Class<?> getColumnClass(int columnIndex)
          Returns the class of data in the 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 DXTableModel getInstance()
          Get the shareable singleton instance of DXTableModel.
 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 isSizeToFit(int columnIndex)
          Specifies whether setWidthToFit() should be enabled on this column
 
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
 

Method Detail

getInstance

public static DXTableModel getInstance()
Get the shareable singleton instance of DXTableModel.

Returns:
the instance of DXTableModel.

aprsMessageReceived

public void aprsMessageReceived(Message msg)
Delivers the next message received by YAAC that is an APRS message.

Specified by:
aprsMessageReceived in interface AprsMessageListener
Parameters:
msg - some subclass of Message containing the message contents; the message should have an AX25Frame connected to it
See Also:
AX25Frame, AX25Message.ax25Frame, AX25Message.getAx25Frame()

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
the number of rows in the model
See Also:
getColumnCount()

getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
the number of columns in the model
See Also:
getRowCount()

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Returns the value for the cell at columnIndex and rowIndex.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - the row whose value is to be queried
columnIndex - the column whose value is to be queried
Returns:
the value Object at the specified cell

getColumnName

public java.lang.String getColumnName(int column)
Returns the localized name for the column.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - the column being queried
Returns:
a string containing the name of column

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Returns the class of data in the column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - the column being queried
Returns:
the Object.class

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 interface ColumnSizingTableModel
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 interface ColumnSizingTableModel
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 interface FastComparableTableModel
Parameters:
rowIndex1 - zero-based model row index of first row to compare
rowIndex2 - zero-based model row index of second row to compare
columnIndex - 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

deleteAllRows

public int deleteAllRows(ClearableTableModel.ClearType clearType)
Delete all rows from this table.

Specified by:
deleteAllRows in interface ClearableTableModel
Parameters:
clearType - type of records to delete
Returns:
number of rows deleted