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_Expressionsthe expressions.protected List<ExpressionWatchPanel.ExpressionType>m_Typesthe types of expressions.protected List<Object>m_Valuesvalues of the expressions.protected Variablesm_Variablesthe 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 voidaddExpression(String expr, ExpressionWatchPanel.ExpressionType type)Adds an expression.voidclear()Clears the internal model.StringfixExpression(String expr, ExpressionWatchPanel.ExpressionType type)Fixes an expression.ClassgetColumnClass(int columnIndex)Returns the class of the column.intgetColumnCount()Returns the number of columns in the table.StringgetColumnName(int column)Returns the name of the column.StringgetExpressionAt(int rowIndex)Returns the expression at the specified position.intgetRowCount()Returns the number of rows in the table.ExpressionWatchPanel.ExpressionTypegetTypeAt(int rowIndex)Returns the type at the specified position.ObjectgetValueAt(int rowIndex, int columnIndex)Returns the value at the specified position.VariablesgetVariables()Returns the underlying Variables instance.voidrefreshAllExpressions()Refreshes the value of all expressions.voidrefreshExpression(int rowIndex)Refreshes the value at the specified position.protected voidrefreshExpression(int rowIndex, boolean fireUpdate)Refreshes the value at the specified position.voidremoveExpression(int rowIndex)Removes the expression at the specified position.voidsetVariables(Variables value)Sets the underlying Variables instance.voidupdateExpression(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:
getColumnCountin interfaceTableModel- Returns:
- always 3
-
getRowCount
public int getRowCount()
Returns the number of rows in the table.- Specified by:
getRowCountin 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:
getValueAtin 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:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein 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:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin 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:
clearin 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
-
-