Package adams.gui.tools
Class ExpressionWatchPanel.TableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.tools.ExpressionWatchPanel.TableModel
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SpreadSheetSupporter
,ClearableModel
,Serializable
,TableModel
- Enclosing class:
- ExpressionWatchPanel
public static class ExpressionWatchPanel.TableModel extends AbstractBaseTableModel implements ClearableModel
A specialized table model for displaying expressions.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>
m_Expressions
the expressions.protected List<ExpressionWatchPanel.ExpressionType>
m_Types
the types of expressions.protected List<Object>
m_Values
values of the expressions.protected Variables
m_Variables
the Variables instance to use.-
Fields inherited from class adams.gui.core.AbstractBaseTableModel
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
-
Constructor Summary
Constructors Constructor Description TableModel(Variables variables)
Initializes the model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExpression(String expr, ExpressionWatchPanel.ExpressionType type)
Adds an expression.void
clear()
Clears the internal model.String
fixExpression(String expr, ExpressionWatchPanel.ExpressionType type)
Fixes an expression.Class
getColumnClass(int columnIndex)
Returns the class of the column.int
getColumnCount()
Returns the number of columns in the table.String
getColumnName(int column)
Returns the name of the column.String
getExpressionAt(int rowIndex)
Returns the expression at the specified position.int
getRowCount()
Returns the number of rows in the table.ExpressionWatchPanel.ExpressionType
getTypeAt(int rowIndex)
Returns the type at the specified position.Object
getValueAt(int rowIndex, int columnIndex)
Returns the value at the specified position.Variables
getVariables()
Returns the underlying Variables instance.void
refreshAllExpressions()
Refreshes the value of all expressions.void
refreshExpression(int rowIndex)
Refreshes the value at the specified position.protected void
refreshExpression(int rowIndex, boolean fireUpdate)
Refreshes the value at the specified position.void
removeExpression(int rowIndex)
Removes the expression at the specified position.void
setVariables(Variables value)
Sets the underlying Variables instance.void
updateExpression(int rowIndex, String expr, ExpressionWatchPanel.ExpressionType type)
Updates an expression.-
Methods inherited from class adams.gui.core.AbstractBaseTableModel
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, setLoggingLevel, toSpreadSheet, toString
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
-
-
-
-
Field Detail
-
m_Types
protected List<ExpressionWatchPanel.ExpressionType> m_Types
the types of expressions.
-
m_Variables
protected Variables m_Variables
the Variables instance to use.
-
-
Constructor Detail
-
TableModel
public TableModel(Variables variables)
Initializes the model.- Parameters:
variables
- the Variables instance to use
-
-
Method Detail
-
setVariables
public void setVariables(Variables value)
Sets the underlying Variables instance.- Parameters:
value
- the instance to use
-
getVariables
public Variables getVariables()
Returns the underlying Variables instance.- Returns:
- the instance in use
-
getColumnCount
public int getColumnCount()
Returns the number of columns in the table.- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- always 3
-
getRowCount
public int getRowCount()
Returns the number of rows in the table.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of rows
-
refreshExpression
protected void refreshExpression(int rowIndex, boolean fireUpdate)
Refreshes the value at the specified position.- Parameters:
rowIndex
- the value to refreshfireUpdate
- whether to fire an update event
-
refreshExpression
public void refreshExpression(int rowIndex)
Refreshes the value at the specified position.- Parameters:
rowIndex
- the value to refresh
-
refreshAllExpressions
public void refreshAllExpressions()
Refreshes the value of all expressions.
-
getExpressionAt
public String getExpressionAt(int rowIndex)
Returns the expression at the specified position.- Parameters:
rowIndex
- the row of the expression- Returns:
- the expression
-
getTypeAt
public ExpressionWatchPanel.ExpressionType getTypeAt(int rowIndex)
Returns the type at the specified position.- Parameters:
rowIndex
- the row of the expression- Returns:
- the type
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
Returns the value at the specified position.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
rowIndex
- the row of the cellcolumnIndex
- the column of the cell- Returns:
- the value of the cell
-
getColumnName
public String getColumnName(int column)
Returns the name of the column.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
column
- the column to get the name for- Returns:
- the name
-
getColumnClass
public Class getColumnClass(int columnIndex)
Returns the class of the column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the index of the column- Returns:
- the class for the specified column
-
clear
public void clear()
Clears the internal model.- Specified by:
clear
in interfaceClearableModel
-
fixExpression
public String fixExpression(String expr, ExpressionWatchPanel.ExpressionType type)
Fixes an expression. In case of VARIABLE, surrounding () are removed.- Parameters:
expr
- the expression to addtype
- the type of the expression
-
addExpression
public void addExpression(String expr, ExpressionWatchPanel.ExpressionType type)
Adds an expression.- Parameters:
expr
- the expression to addtype
- the type of the expression
-
updateExpression
public void updateExpression(int rowIndex, String expr, ExpressionWatchPanel.ExpressionType type)
Updates an expression.- Parameters:
rowIndex
- the index of the expressionexpr
- the new expressiontype
- the type of the new expression
-
removeExpression
public void removeExpression(int rowIndex)
Removes the expression at the specified position.- Parameters:
rowIndex
- the row of the expression to remove
-
-