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 intCOLUMN_DESCthe description/file column.static intCOLUMN_ERRORthe error column.static intCOLUMN_HEADLESSthe headless column.static intCOLUMN_NAMEthe name column.static intCOLUMN_ONERRORthe onError column.static intCOLUMN_ONFINISHthe onFinish column.static intCOLUMN_RUNNINGthe running column.protected FlowSetupManagerm_Managerthe 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 voidaddSetup(FlowSetup setup)Adds a shallow copy of the setup.voidclearSetups()Removes all setups.voidflowSetupStateChanged(FlowSetupStateEvent e)Gets called when the flow execution finished.ClassgetColumnClass(int columnIndex)Returns the column class for the specified column.intgetColumnCount()Returns the number of columns. 1.StringgetColumnName(int column)Returns the name of the column.intgetRowCount()Returns the number of setups in the model.FlowSetupgetSetup(int row)Returns a copy of the setup at the specified location.ObjectgetValueAt(int rowIndex, int columnIndex)Returns the cell value at the specified location.intindexOf(FlowSetup setup)Returns the index of the given flow setup.voidinsertSetup(int row, FlowSetup setup)Inserts a shallow copy of the setup at the specified location.booleanisCellEditable(int rowIndex, int columnIndex)Returns whether a cell can be edited.voidremoveSetup(int row)Removes the setup at the specified location.voidsetSetup(int row, FlowSetup setup)Sets the setup at the specified location.voidsetValueAt(Object value, int rowIndex, int columnIndex)Sets the value at the specified position.protected voidswap(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:
getColumnCountin interfaceTableModel- Returns:
- always 7
-
getColumnName
public String getColumnName(int column)
Returns the name of the column.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein 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:
getRowCountin interfaceTableModel- Returns:
- the number of setups
-
getColumnClass
public Class getColumnClass(int columnIndex)
Returns the column class for the specified column.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin 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:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein 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:
getValueAtin 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:
setValueAtin interfaceTableModel- Overrides:
setValueAtin 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:
flowSetupStateChangedin interfaceFlowSetupStateListener- Parameters:
e- the event
-
swap
protected void swap(int firstIndex, int secondIndex)Swaps the two rows.- Specified by:
swapin classAbstractMoveableTableModel- Parameters:
firstIndex- the index of the first rowsecondIndex- the index of the second row
-
-