Package jadex.tools.comanalyzer.table
Class MessageTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- jadex.tools.comanalyzer.table.MessageTableModel
-
- All Implemented Interfaces:
java.io.Serializable,javax.swing.table.TableModel
public class MessageTableModel extends javax.swing.table.AbstractTableModelThe table model for messages. It uses a sorted list to store the messages, cause the sequence of messages must be conserved regardless of their insertion time.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.ListCOLUMN_HEADERSList of all available column headers.protected SortedListmessagesSortedList of messages in table model.
-
Constructor Summary
Constructors Constructor Description MessageTableModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddMessage(Message message)Add a message to the tablevoidaddMessages(Message[] messages)Add an array of message to the table.booleancontainsMessage(Message message)Returnstrueif the message is in the tablejava.lang.ClassgetColumnClass(int columnIndex)Returns the class of columncolumnIndex.intgetColumnCount()Returns the number of columns in the modeljava.lang.StringgetColumnName(int columnIndex)Returns the name for the column.MessagegetMessage(int i)Returns the message at row i.intgetRowCount()Returns the number of rows in the model.java.lang.ObjectgetValueAt(int rowIndex, int columnIndex)Returns the value for the cell atcolumnIndexandrowIndex.voidremoveAllMessages()Remove all messages from table.booleanremoveMessage(Message message)Remove a message from the table.-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Field Detail
-
COLUMN_HEADERS
public static final java.util.List COLUMN_HEADERS
List of all available column headers.
-
messages
protected SortedList messages
SortedList of messages in table model.
-
-
Method Detail
-
addMessage
public boolean addMessage(Message message)
Add a message to the table- Parameters:
message- The message to add.- Returns:
trueif success
-
removeMessage
public boolean removeMessage(Message message)
Remove a message from the table.- Parameters:
message- The message to remove.- Returns:
trueif success
-
addMessages
public void addMessages(Message[] messages)
Add an array of message to the table.- Parameters:
messages- The Array of messages to add.
-
removeAllMessages
public void removeAllMessages()
Remove all messages from table.
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the model- Returns:
- The number of columns in the model
-
getRowCount
public int getRowCount()
Returns the number of rows in the model.- Returns:
- the number of rows in the model
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex)Returns the value for the cell atcolumnIndexandrowIndex.- 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
-
getColumnName
public java.lang.String getColumnName(int columnIndex)
Returns the name for the column.- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Overrides:
getColumnNamein classjavax.swing.table.AbstractTableModel- Parameters:
column- The column being queried- Returns:
- A string containing the default name of
column
-
getColumnClass
public java.lang.Class getColumnClass(int columnIndex)
Returns the class of columncolumnIndex.- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Overrides:
getColumnClassin classjavax.swing.table.AbstractTableModel- Parameters:
columnIndex- The column being queried- Returns:
- the class of column
columnIndex
-
containsMessage
public boolean containsMessage(Message message)
Returnstrueif the message is in the table- Parameters:
message- The message queried- Returns:
trueif the message exist
-
getMessage
public Message getMessage(int i)
Returns the message at row i.- Parameters:
i- The row with the message.- Returns:
- The message at row i.
-
-