de.unihalle.informatik.Alida.gui
Class ALDOperatorGUIExecutionProxy

java.lang.Object
  extended by de.unihalle.informatik.Alida.gui.ALDOperatorGUIExecutionProxy
All Implemented Interfaces:
ALDWorkflowEventListener, java.awt.event.ActionListener, java.util.EventListener

public class ALDOperatorGUIExecutionProxy
extends java.lang.Object
implements ALDWorkflowEventListener, java.awt.event.ActionListener

Manager for executing single operator and workflow objects via GUI.

Author:
Birgit Moeller

Nested Class Summary
protected  class ALDOperatorGUIExecutionProxy.ParameterChangeListener
          Listener class to react on parameter value changes in config window.
protected static class ALDOperatorGUIExecutionProxy.WorkflowThreadStatus
          Status of the associated thread to execute operator.
 
Field Summary
protected  ALDWorkflow alidaWorkflow
          Reference to the underlying Alida workflow object.
protected  java.util.Iterator<java.lang.Object> batchInputIterator
           
protected  java.lang.String batchInputParameter
           
protected  boolean batchModeActive
           
protected  java.util.LinkedList<java.lang.String> batchOutputParameter
           
protected  java.util.HashMap<java.lang.String,ALDBatchRunResultInfo> batchOutputResultMap
           
protected  ALDOperatorControlFrame controlWin
          Corresponding configuration and control window.
protected  javax.swing.JFrame failureMessageWin
          Corresponding configuration and control window.
protected  ALDWorkflowNodeID operatorNodeID
          Reference ID of the operator node in Alida workflow;
protected  ALDOperatorGUIExecutionProxy.ParameterChangeListener paramChangeListener
          Listener object attached to the control window.
protected  boolean processEvents
          Flag to indicate if the is an abortion currently going on.
protected  ALDOperatorResultFrame resultFrame
          Frame showing operator execution results.
protected  ALDOperatorGUIExecutionProxy.WorkflowThreadStatus workflowStatus
          Current status of the operator execution thread.
protected  java.lang.Object[] yesnoOption
          Labels to be used on buttons of Yes/No message boxes.
 
Constructor Summary
ALDOperatorGUIExecutionProxy(ALDOperatorLocation opLocation)
          Default constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void configureWorkflow(ALDConfigurationEvent confEvent)
           
protected  void createNewWorkflowNode(ALDOperatorLocation loc)
          Creates a new workflow node.
protected  void displayFailureMessageWindow(ALDWorkflowEvent event)
          Displays window with detailed error information on execution failures.
protected  void doNextBatchModeStep()
           
 void doNextStepInWorkflow()
           
protected  ALDOperatorControlFrame getNewConfigWin(ALDOperator op)
          Generate a new configuration window.
 ALDOperatorGUIExecutionProxy.WorkflowThreadStatus getWorkflowThreadStatus()
          Returns current status of workflow thread.
protected  void handleAddNodeEvent(ALDOperator op, ALDWorkflowNodeID id)
          Adds a node to the workflow graph.
 void handleALDWorkflowEvent(ALDWorkflowEvent event)
          Method which is called on event occurrence.
protected  void handleNodeParameterChangeEvent(java.util.Collection<ALDWorkflowNodeID> idList)
          Update parameter labels according to configuration states.
protected  void handleNodeStateChangeEvent(java.util.Collection<ALDWorkflowNodeID> idList)
          Update control window color according to node's state.
protected  void initInterruptWin()
          Setup of the window for renaming workflows.
protected  void initOperatorWorkflow(ALDOperatorLocation opLocation)
          Adds the operator as node to the workflow.
 void interruptExecution()
          Aborts running execution of the workflow.
 void killWorkflowThread()
           
 void pauseWorkflow()
           
protected  void processWorkflowEventQueue()
          Processes all events that were recently added to the queue.
 boolean quit()
          Does clean-up on termination, i.e. closes all open windows.
 void resumeWorkflow()
           
 void runWorkflow()
          Executes the workflow.
 void runWorkflowInBatchMode()
           
 void showGUI()
          Displays the configuration and control window.
 void showResultFrame()
          (Re-)display the result frame again, if results available.
 void stopWorkflow()
           
 void updateOperator(ALDOperator newOp)
          Method called by GUI if a new operator was loaded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alidaWorkflow

protected ALDWorkflow alidaWorkflow
Reference to the underlying Alida workflow object.


batchInputIterator

protected java.util.Iterator<java.lang.Object> batchInputIterator

batchInputParameter

protected java.lang.String batchInputParameter

batchModeActive

protected boolean batchModeActive

batchOutputParameter

protected java.util.LinkedList<java.lang.String> batchOutputParameter

batchOutputResultMap

protected java.util.HashMap<java.lang.String,ALDBatchRunResultInfo> batchOutputResultMap

controlWin

protected ALDOperatorControlFrame controlWin
Corresponding configuration and control window.


failureMessageWin

protected javax.swing.JFrame failureMessageWin
Corresponding configuration and control window.


operatorNodeID

protected ALDWorkflowNodeID operatorNodeID
Reference ID of the operator node in Alida workflow;


paramChangeListener

protected ALDOperatorGUIExecutionProxy.ParameterChangeListener paramChangeListener
Listener object attached to the control window.


processEvents

protected boolean processEvents
Flag to indicate if the is an abortion currently going on.


resultFrame

protected ALDOperatorResultFrame resultFrame
Frame showing operator execution results.


workflowStatus

protected ALDOperatorGUIExecutionProxy.WorkflowThreadStatus workflowStatus
Current status of the operator execution thread.


yesnoOption

protected final java.lang.Object[] yesnoOption
Labels to be used on buttons of Yes/No message boxes.

Constructor Detail

ALDOperatorGUIExecutionProxy

public ALDOperatorGUIExecutionProxy(ALDOperatorLocation opLocation)
Default constructor.

Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

configureWorkflow

public void configureWorkflow(ALDConfigurationEvent confEvent)

createNewWorkflowNode

protected void createNewWorkflowNode(ALDOperatorLocation loc)
Creates a new workflow node.

Parameters:
loc - Location from where to instantiate the operator.

displayFailureMessageWindow

protected void displayFailureMessageWindow(ALDWorkflowEvent event)
Displays window with detailed error information on execution failures.

Parameters:
event - Workflow event got on failure.

doNextBatchModeStep

protected void doNextBatchModeStep()

doNextStepInWorkflow

public void doNextStepInWorkflow()

getNewConfigWin

protected ALDOperatorControlFrame getNewConfigWin(ALDOperator op)
                                           throws ALDOperatorException
Generate a new configuration window.

Is to be overwritten by subclasses.

Parameters:
op - Operator for which window is requested.
Returns:
New configuration window.
Throws:
ALDOperatorException

getWorkflowThreadStatus

public ALDOperatorGUIExecutionProxy.WorkflowThreadStatus getWorkflowThreadStatus()
Returns current status of workflow thread.

Returns:
Status of workflow thread.

handleAddNodeEvent

protected void handleAddNodeEvent(ALDOperator op,
                                  ALDWorkflowNodeID id)
Adds a node to the workflow graph.

Parameters:
op - Operator associated with the node.
Throws:
ALDOperatorException

handleALDWorkflowEvent

public void handleALDWorkflowEvent(ALDWorkflowEvent event)
Description copied from interface: ALDWorkflowEventListener
Method which is called on event occurrence.

Specified by:
handleALDWorkflowEvent in interface ALDWorkflowEventListener
Parameters:
event - Event to be handled.

handleNodeParameterChangeEvent

protected void handleNodeParameterChangeEvent(java.util.Collection<ALDWorkflowNodeID> idList)
Update parameter labels according to configuration states.

Parameters:
idList - List of nodes that are to be updated.

handleNodeStateChangeEvent

protected void handleNodeStateChangeEvent(java.util.Collection<ALDWorkflowNodeID> idList)
Update control window color according to node's state.

Parameters:
idList - List of nodes that are to be updated.

initInterruptWin

protected void initInterruptWin()
Setup of the window for renaming workflows.


initOperatorWorkflow

protected void initOperatorWorkflow(ALDOperatorLocation opLocation)
Adds the operator as node to the workflow.

Parameters:
opPath - Full path of operator object to be handled by this manager.

interruptExecution

public void interruptExecution()
Aborts running execution of the workflow.


killWorkflowThread

public void killWorkflowThread()

pauseWorkflow

public void pauseWorkflow()

processWorkflowEventQueue

protected void processWorkflowEventQueue()
Processes all events that were recently added to the queue.

Note that this function needs to be called after all actions on the Alida workflow except calls to 'run' methods.


quit

public boolean quit()
Does clean-up on termination, i.e. closes all open windows.


resumeWorkflow

public void resumeWorkflow()

runWorkflow

public void runWorkflow()
Executes the workflow.


runWorkflowInBatchMode

public void runWorkflowInBatchMode()
                            throws ALDBatchIOException,
                                   ALDOperatorException
Throws:
ALDBatchIOException
ALDOperatorException

showGUI

public void showGUI()
Displays the configuration and control window.


showResultFrame

public void showResultFrame()
(Re-)display the result frame again, if results available.


stopWorkflow

public void stopWorkflow()

updateOperator

public void updateOperator(ALDOperator newOp)
                    throws ALDWorkflowException
Method called by GUI if a new operator was loaded.

This method updates the workflow by deleting the old operator node and adding a new one for the new operator. Note that the GUI components are not newly initialized, but are only updated. This is triggered by setting the variable initialInit to false.

Parameters:
newOp - New operator loaded from file.
Throws:
ALDWorkflowException