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.AbstractTableModel
The 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.List
COLUMN_HEADERS
List of all available column headers.protected SortedList
messages
SortedList of messages in table model.
-
Constructor Summary
Constructors Constructor Description MessageTableModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addMessage(Message message)
Add a message to the tablevoid
addMessages(Message[] messages)
Add an array of message to the table.boolean
containsMessage(Message message)
Returnstrue
if the message is in the tablejava.lang.Class
getColumnClass(int columnIndex)
Returns the class of columncolumnIndex
.int
getColumnCount()
Returns the number of columns in the modeljava.lang.String
getColumnName(int columnIndex)
Returns the name for the column.Message
getMessage(int i)
Returns the message at row i.int
getRowCount()
Returns the number of rows in the model.java.lang.Object
getValueAt(int rowIndex, int columnIndex)
Returns the value for the cell atcolumnIndex
androwIndex
.void
removeAllMessages()
Remove all messages from table.boolean
removeMessage(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:
true
if success
-
removeMessage
public boolean removeMessage(Message message)
Remove a message from the table.- Parameters:
message
- The message to remove.- Returns:
true
if 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 atcolumnIndex
androwIndex
.- 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:
getColumnName
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnName
in 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:
getColumnClass
in interfacejavax.swing.table.TableModel
- Overrides:
getColumnClass
in classjavax.swing.table.AbstractTableModel
- Parameters:
columnIndex
- The column being queried- Returns:
- the class of column
columnIndex
-
containsMessage
public boolean containsMessage(Message message)
Returnstrue
if the message is in the table- Parameters:
message
- The message queried- Returns:
true
if 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.
-
-