Package adams.gui.flow.setup
Class FlowSetupTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- adams.gui.core.AbstractBaseTableModel
-
- adams.gui.core.AbstractMoveableTableModel
-
- adams.gui.flow.setup.FlowSetupTableModel
-
- All Implemented Interfaces:
LoggingLevelHandler
,LoggingSupporter
,SpreadSheetSupporter
,FlowSetupStateListener
,MoveableTableModel
,Serializable
,TableModel
public class FlowSetupTableModel extends AbstractMoveableTableModel implements FlowSetupStateListener
A table model for FlowSetup objects.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
COLUMN_DESC
the description/file column.static int
COLUMN_ERROR
the error column.static int
COLUMN_HEADLESS
the headless column.static int
COLUMN_NAME
the name column.static int
COLUMN_ONERROR
the onError column.static int
COLUMN_ONFINISH
the onFinish column.static int
COLUMN_RUNNING
the running column.protected FlowSetupManager
m_Manager
the underlying setups.-
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 FlowSetupTableModel(FlowSetupManager manager)
Initializes the model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSetup(FlowSetup setup)
Adds a shallow copy of the setup.void
clearSetups()
Removes all setups.void
flowSetupStateChanged(FlowSetupStateEvent e)
Gets called when the flow execution finished.Class
getColumnClass(int columnIndex)
Returns the column class for the specified column.int
getColumnCount()
Returns the number of columns.String
getColumnName(int column)
Returns the name of the column.int
getRowCount()
Returns the number of setups in the model.FlowSetup
getSetup(int row)
Returns a copy of the setup at the specified location.Object
getValueAt(int rowIndex, int columnIndex)
Returns the cell value at the specified location.int
indexOf(FlowSetup setup)
Returns the index of the given flow setup.void
insertSetup(int row, FlowSetup setup)
Inserts a shallow copy of the setup at the specified location.boolean
isCellEditable(int rowIndex, int columnIndex)
Returns whether a cell can be edited.void
removeSetup(int row)
Removes the setup at the specified location.void
setSetup(int row, FlowSetup setup)
Sets the setup at the specified location.void
setValueAt(Object value, int rowIndex, int columnIndex)
Sets the value at the specified position.protected void
swap(int firstIndex, int secondIndex)
Swaps the two rows.-
Methods inherited from class adams.gui.core.AbstractMoveableTableModel
canMoveDown, canMoveUp, moveBottom, moveDown, moveItems, moveTop, moveUp
-
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, removeTableModelListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
-
-
-
-
Field Detail
-
COLUMN_NAME
public static final int COLUMN_NAME
the name column.- See Also:
- Constant Field Values
-
COLUMN_DESC
public static final int COLUMN_DESC
the description/file column.- See Also:
- Constant Field Values
-
COLUMN_HEADLESS
public static final int COLUMN_HEADLESS
the headless column.- See Also:
- Constant Field Values
-
COLUMN_RUNNING
public static final int COLUMN_RUNNING
the running column.- See Also:
- Constant Field Values
-
COLUMN_ONFINISH
public static final int COLUMN_ONFINISH
the onFinish column.- See Also:
- Constant Field Values
-
COLUMN_ONERROR
public static final int COLUMN_ONERROR
the onError column.- See Also:
- Constant Field Values
-
COLUMN_ERROR
public static final int COLUMN_ERROR
the error column.- See Also:
- Constant Field Values
-
m_Manager
protected FlowSetupManager m_Manager
the underlying setups.
-
-
Constructor Detail
-
FlowSetupTableModel
public FlowSetupTableModel(FlowSetupManager manager)
Initializes the model.- Parameters:
manager
- the underlying setups
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Returns the number of columns. 1. Name 2. Desc/File 3. Headless 4. Running 5. OnFinish 6. OnError 7. Error- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- always 7
-
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 index- Returns:
- the name of the column
-
getRowCount
public int getRowCount()
Returns the number of setups in the model.- Specified by:
getRowCount
in interfaceTableModel
- Returns:
- the number of setups
-
getColumnClass
public Class getColumnClass(int columnIndex)
Returns the column class for the specified column.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
columnIndex
- the index of the column- Returns:
- the class
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
Returns whether a cell can be edited.- Specified by:
isCellEditable
in interfaceTableModel
- Overrides:
isCellEditable
in classAbstractTableModel
- Parameters:
rowIndex
- the row of the cellcolumnIndex
- the column of the cell- Returns:
- true if the cell can be edited
-
getValueAt
public Object getValueAt(int rowIndex, int columnIndex)
Returns the cell value at the specified location.- Specified by:
getValueAt
in interfaceTableModel
- Parameters:
rowIndex
- the row of the cellcolumnIndex
- the column of the cell- Returns:
- the value at the position
-
setValueAt
public void setValueAt(Object value, int rowIndex, int columnIndex)
Sets the value at the specified position.- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAbstractTableModel
- Parameters:
value
- the value to setrowIndex
- the row of the cellcolumnIndex
- the column of the cell
-
indexOf
public int indexOf(FlowSetup setup)
Returns the index of the given flow setup.- Parameters:
setup
- the setup to look for- Returns:
- the index, -1 if not found
-
getSetup
public FlowSetup getSetup(int row)
Returns a copy of the setup at the specified location.- Parameters:
row
- the row of the setup- Returns:
- the setup
-
setSetup
public void setSetup(int row, FlowSetup setup)
Sets the setup at the specified location.- Parameters:
row
- the row of the setupsetup
- the setup
-
addSetup
public void addSetup(FlowSetup setup)
Adds a shallow copy of the setup.- Parameters:
setup
- the setup to add
-
insertSetup
public void insertSetup(int row, FlowSetup setup)
Inserts a shallow copy of the setup at the specified location.- Parameters:
row
- the row of the setupsetup
- the setup to add
-
removeSetup
public void removeSetup(int row)
Removes the setup at the specified location.- Parameters:
row
- the row of the setup
-
clearSetups
public void clearSetups()
Removes all setups.
-
flowSetupStateChanged
public void flowSetupStateChanged(FlowSetupStateEvent e)
Gets called when the flow execution finished. Used for updating the table.- Specified by:
flowSetupStateChanged
in interfaceFlowSetupStateListener
- Parameters:
e
- the event
-
swap
protected void swap(int firstIndex, int secondIndex)
Swaps the two rows.- Specified by:
swap
in classAbstractMoveableTableModel
- Parameters:
firstIndex
- the index of the first rowsecondIndex
- the index of the second row
-
-