org.ka2ddo.yaac.gui
Class OutstandingMessageTableModel

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

public class OutstandingMessageTableModel
extends javax.swing.table.AbstractTableModel
implements ColumnSizingTableModel, SendableMessageListener, FastComparableTableModel

This class displays all the outstanding messages that have been transmitted by this YAAC instance.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Method Summary
 int compareRows(int rowIndex1, int rowIndex2, int columnIndex)
          Compare the selected column of the two rows.
 void deleteOutgoingMessage(int index, SendableMessage sendableMessage, boolean isGuiDispatchThread)
          Report that a message has been deleted from the outgoing retransmitted message list.
 java.lang.Class<?> getColumnClass(int columnIndex)
          Returns the Class of the column's values.
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int column)
          Returns the name for the column.
 int getColumnWidth(int columnIndex)
          Specifies the default initial width of a column from this model.
static OutstandingMessageTableModel getInstance()
          Get the OutstandingMessageTableModel instance.
 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.
 void insertOutgoingMessage(int index, boolean isGuiDispatchThread)
          Report that a new message has been added to the outgoing retransmitted message list.
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isSizeToFit(int columnIndex)
          Specifies whether setWidthToFit() should be enabled on this column
static void showOutstandingTable()
          Display the OutstandingMessage table window.
 void updateOutgoingMessage(int index, boolean isGuiDispatchThread)
          Report that an existing message has been updated in the outgoing retransmitted message list.
 
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
 

Method Detail

getRowCount

public int getRowCount()
Returns the number of rows in the model. A JTable 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 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()

getColumnName

public java.lang.String getColumnName(int column)
Returns the 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 the column's values.

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 Class

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

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

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

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

showOutstandingTable

public static void showOutstandingTable()
Display the OutstandingMessage table window.


getInstance

public static OutstandingMessageTableModel getInstance()
Get the OutstandingMessageTableModel instance.

Returns:
singleton OutstandingMessageTableModel

insertOutgoingMessage

public void insertOutgoingMessage(int index,
                                  boolean isGuiDispatchThread)
Report that a new message has been added to the outgoing retransmitted message list.

Specified by:
insertOutgoingMessage in interface SendableMessageListener
Parameters:
index - position of message in the list.
isGuiDispatchThread - boolean true if caller is the GUI dispatch thread

updateOutgoingMessage

public void updateOutgoingMessage(int index,
                                  boolean isGuiDispatchThread)
Report that an existing message has been updated in the outgoing retransmitted message list.

Specified by:
updateOutgoingMessage in interface SendableMessageListener
Parameters:
index - position of message in the list.
isGuiDispatchThread - boolean true if caller is the GUI dispatch thread

deleteOutgoingMessage

public void deleteOutgoingMessage(int index,
                                  SendableMessage sendableMessage,
                                  boolean isGuiDispatchThread)
Report that a message has been deleted from the outgoing retransmitted message list.

Specified by:
deleteOutgoingMessage in interface SendableMessageListener
Parameters:
index - position of message in the list.
sendableMessage - the SendableMessage that is being cancelled
isGuiDispatchThread - boolean true if caller is the GUI dispatch thread