junit.extensions.awt.editor
Class ScriptModel
java.lang.Object
|
+--javax.swing.table.AbstractTableModel
|
+--junit.extensions.awt.editor.ScriptModel
- All Implemented Interfaces:
- java.io.Serializable, StepListener, javax.swing.table.TableModel
- class ScriptModel
- extends javax.swing.table.AbstractTableModel
- implements StepListener
Formats a Script for display in a table. Keeps track of
"open" nodes to create a tree-like display
NOTE: this is a brute-force implementation with no attempts at
optimization. But it's a very simple tree+table implementation.
- See Also:
- Serialized Form
Inner Class Summary |
class |
ScriptModel.Entry
Encapsulate information we need to manipulate the row. |
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScriptModel
ScriptModel()
doLayout
public void doLayout()
- Scan the layout to initialize the row entries.
getEntry
public ScriptModel.Entry getEntry(int row)
getRowOf
public int getRowOf(Step step)
- Returns -1 if the step is not found.
isOpen
public boolean isOpen(int row)
- Return whether the given row is "open".
toggle
public void toggle(int row)
- Toggle the open state of the node, if it's a sequence.
setScript
public void setScript(Script script)
- Set the script to display. Don't allow any model accesses until
this method has completed.
getRowCount
public int getRowCount()
- Overrides:
getRowCount
in class javax.swing.table.AbstractTableModel
getColumnCount
public int getColumnCount()
- Overrides:
getColumnCount
in class javax.swing.table.AbstractTableModel
getValueAt
public java.lang.Object getValueAt(int row,
int column)
- Returns the entry object at the given row.
- Overrides:
getValueAt
in class javax.swing.table.AbstractTableModel
setValueAt
public void setValueAt(java.lang.Object value,
int row,
int col)
- Assumes value is XML for a script step.
- Overrides:
setValueAt
in class javax.swing.table.AbstractTableModel
getColumnName
public java.lang.String getColumnName(int col)
- Overrides:
getColumnName
in class javax.swing.table.AbstractTableModel
isCellEditable
public boolean isCellEditable(int row,
int col)
- Overrides:
isCellEditable
in class javax.swing.table.AbstractTableModel
getColumnClass
public java.lang.Class getColumnClass(int col)
- Overrides:
getColumnClass
in class javax.swing.table.AbstractTableModel
getScript
public Script getScript()
stateChanged
public void stateChanged(StepEvent ev)
- Specified by:
stateChanged
in interface StepListener