nz.ac.waikato.mcennis.rat.gui
Class ApplicationTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by nz.ac.waikato.mcennis.rat.gui.ApplicationTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class ApplicationTableModel
extends javax.swing.table.DefaultTableModel

JTable model containing the DataAquisition and Algorithm modules that describe applications in the GUI.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ApplicationTableModel()
          Create an empty model with an empty module for data aquisition.
 
Method Summary
 void addAlgorithm(Algorithm algorithm, int row)
          If the row is valid, add the algorithm at the given row.
 void addDataAquisition(DataAquisition aquisition, int row)
          Fix the data aquisition module tothe given object.
 Algorithm[] getAlgorithms()
          Return the algorithms of this application in an ordered array.
 Component getComponent(int row)
          Return the component at the given row.
 DataAquisition[] getDataAquisition()
          Return the data aquisition module or null if it has not been set yet
 int getDataAquisitionCount()
          Returns the number of data aquisition rows in the table
 java.lang.String getPattern(int row)
          Returns the pattern object associated with the Algorithm at this row.
 boolean isCellEditable(int row, int column)
           
 void moveDown(int row)
          move the algorithm one step down (moving the one below it to the given row) if the row is valid or log an error message.
 void moveUp(int row)
          move the algorithm one step up (moving the one above it to the given row) if the row is valid or log an error message.
 void removeAlgorithm(int row)
          Remove the algorithm at the given row value or log an error if the row is invalid.
 void removeDataAquisition(int row)
          Removes the data aquisition module if present, null operation otherwise.
 void setPattern(int row, java.lang.String pattern)
          Sets the regular expression describing the graph(s) which will be executed against the algorithm at this location.
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationTableModel

public ApplicationTableModel()
Create an empty model with an empty module for data aquisition.

Method Detail

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.DefaultTableModel

addDataAquisition

public void addDataAquisition(DataAquisition aquisition,
                              int row)
Fix the data aquisition module tothe given object. Replaces the old value if one already exists. Throws a NullPointerException if the module is null.

Parameters:
aquisition - module to load

removeDataAquisition

public void removeDataAquisition(int row)
Removes the data aquisition module if present, null operation otherwise.


addAlgorithm

public void addAlgorithm(Algorithm algorithm,
                         int row)
If the row is valid, add the algorithm at the given row. Otherwise add the algorithm as the first algorithm. Throws a NullPointerException if the Algorithm is null.

Parameters:
algorithm - algorithm to insert
row - place to insert algorithm

removeAlgorithm

public void removeAlgorithm(int row)
Remove the algorithm at the given row value or log an error if the row is invalid.

Parameters:
row -

moveUp

public void moveUp(int row)
move the algorithm one step up (moving the one above it to the given row) if the row is valid or log an error message.

Parameters:
row - location of the algorithm to move

moveDown

public void moveDown(int row)
move the algorithm one step down (moving the one below it to the given row) if the row is valid or log an error message.

Parameters:
row - location of the algorithm to move

getComponent

public Component getComponent(int row)
Return the component at the given row. Returns null if there is no component at the row provided.

Parameters:
row - location of the component to retrieve
Returns:
component on this row

getDataAquisition

public DataAquisition[] getDataAquisition()
Return the data aquisition module or null if it has not been set yet

Returns:
data aquisition module of this application

getAlgorithms

public Algorithm[] getAlgorithms()
Return the algorithms of this application in an ordered array. Returns an empty array if no algorithms are present.

Returns:
array of algorithms

setPattern

public void setPattern(int row,
                       java.lang.String pattern)
Sets the regular expression describing the graph(s) which will be executed against the algorithm at this location. See Graph.getGraphs(Pattern) for a description of which graphs are returned using this pattern. This logs an error if the row does not resolve to an Algorithm object.

Parameters:
row - which algorithm to set a pattern for
pattern - regular expression describing which graph objects to execute against this algorithm.

getPattern

public java.lang.String getPattern(int row)
Returns the pattern object associated with the Algorithm at this row. Returns null if the row is not associated with a valid Algorithm object.

Parameters:
row - which algorithm's pattern to return
Returns:
string representation of this pattern.

getDataAquisitionCount

public int getDataAquisitionCount()
Returns the number of data aquisition rows in the table

Returns: