Package adams.flow.execution
Class MultiListener
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<FlowExecutionListener>
,SizeOfHandler
,FlowExecutionListener
,GraphicalFlowExecutionListener
,Serializable
,Comparable
public class MultiListener extends AbstractFlowExecutionListener implements GraphicalFlowExecutionListener
A meta-listener that executes all sub-listeners sequentially.
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-listener <adams.flow.execution.FlowExecutionListener> [-listener ...] (property: subListeners) The array of listeners to use. default:
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BasePanel
m_ListenerPanel
the listener panel.protected FlowExecutionListener[]
m_Listeners
the listeners.-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListener
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description MultiListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createTitle(HashSet<String> titles, String initial)
Creates a new tab title, ensures uniqueness.void
defineOptions()
Adds options to the internal list of options.void
finishListening()
Gets called when the flow execution ends.Dimension
getDefaultFrameSize()
Returns the default size for the frame.boolean
getDisposeOnFinish()
Returns whether the frame should get disposed when the flow finishes.String
getListenerTitle()
The title of this listener.FlowExecutionListener[]
getSubListeners()
Returns the listeners in use.String
globalInfo()
Returns a string describing the object.BasePanel
newListenerPanel()
Returns the panel to use.BasePanel
newListenerPanelIfNecessary()
Returns a new panel if necessary.void
postExecute(Actor actor)
Gets called after the actor was executed.void
postInput(Actor actor)
Gets called after the actor received the token.void
postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.void
preExecute(Actor actor)
Gets called before the actor gets executed.void
preInput(Actor actor, Token token)
Gets called before the actor receives the token.void
preOutput(Actor actor)
Gets called before a token gets obtained from the actor.void
setSubListeners(FlowExecutionListener[] value)
Sets the listeners to use.void
startListening()
Gets called when the flow execution starts.String
subListenersTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListener
cleanUp, compareTo, equals, getListeners, getOwner, setOwner, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.flow.execution.FlowExecutionListener
getOwner, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Listeners
protected FlowExecutionListener[] m_Listeners
the listeners.
-
m_ListenerPanel
protected BasePanel m_ListenerPanel
the listener panel.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setSubListeners
public void setSubListeners(FlowExecutionListener[] value)
Sets the listeners to use.- Parameters:
value
- the listeners to use
-
getSubListeners
public FlowExecutionListener[] getSubListeners()
Returns the listeners in use.- Returns:
- the listeners
-
subListenersTipText
public String subListenersTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
startListening
public void startListening()
Gets called when the flow execution starts.- Specified by:
startListening
in interfaceFlowExecutionListener
- Overrides:
startListening
in classAbstractFlowExecutionListener
-
preInput
public void preInput(Actor actor, Token token)
Gets called before the actor receives the token.- Specified by:
preInput
in interfaceFlowExecutionListener
- Overrides:
preInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will receive the tokentoken
- the token that the actor will receive
-
postInput
public void postInput(Actor actor)
Gets called after the actor received the token.- Specified by:
postInput
in interfaceFlowExecutionListener
- Overrides:
postInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that received the token
-
preExecute
public void preExecute(Actor actor)
Gets called before the actor gets executed.- Specified by:
preExecute
in interfaceFlowExecutionListener
- Overrides:
preExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will get executed
-
postExecute
public void postExecute(Actor actor)
Gets called after the actor was executed.- Specified by:
postExecute
in interfaceFlowExecutionListener
- Overrides:
postExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that was executed
-
preOutput
public void preOutput(Actor actor)
Gets called before a token gets obtained from the actor.- Specified by:
preOutput
in interfaceFlowExecutionListener
- Overrides:
preOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor the token gets obtained from
-
postOutput
public void postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.- Specified by:
postOutput
in interfaceFlowExecutionListener
- Overrides:
postOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that the token was acquired fromtoken
- the token that was acquired from the actor
-
getListenerTitle
public String getListenerTitle()
The title of this listener.- Specified by:
getListenerTitle
in interfaceGraphicalFlowExecutionListener
- Returns:
- the title
-
createTitle
protected String createTitle(HashSet<String> titles, String initial)
Creates a new tab title, ensures uniqueness.- Parameters:
titles
- the titles so farinitial
- the initial title- Returns:
- the final title
-
newListenerPanelIfNecessary
public BasePanel newListenerPanelIfNecessary()
Returns a new panel if necessary.- Specified by:
newListenerPanelIfNecessary
in interfaceGraphicalFlowExecutionListener
- Returns:
- the control panel
-
newListenerPanel
public BasePanel newListenerPanel()
Returns the panel to use.- Specified by:
newListenerPanel
in interfaceGraphicalFlowExecutionListener
- Returns:
- the panel, null if none available
-
getDefaultFrameSize
public Dimension getDefaultFrameSize()
Returns the default size for the frame.- Specified by:
getDefaultFrameSize
in interfaceGraphicalFlowExecutionListener
- Returns:
- the frame size
-
getDisposeOnFinish
public boolean getDisposeOnFinish()
Returns whether the frame should get disposed when the flow finishes.
Returns only true if all sub-listeners return true.- Specified by:
getDisposeOnFinish
in interfaceGraphicalFlowExecutionListener
- Returns:
- true if to dispose when flow finishes
-
finishListening
public void finishListening()
Gets called when the flow execution ends.- Specified by:
finishListening
in interfaceFlowExecutionListener
- Overrides:
finishListening
in classAbstractFlowExecutionListener
-
-