Package adams.flow.standalone
Class AbstractMultiView
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.core.AbstractDisplay
-
- adams.flow.standalone.AbstractMultiView
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ActorHandler
,ActorReferenceHandler
,DisplayTypeSupporter
,ErrorHandler
,Flushable
,MutableActorHandler
,MenuBarProvider
,SendToActionSupporter
,Serializable
,Comparable
public abstract class AbstractMultiView extends AbstractDisplay implements ActorReferenceHandler, MenuBarProvider, SendToActionSupporter
Ancestor for graphical actors that display multiple views.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractMultiView.ViewWrapper
A wrapper for the actual actors.
-
Field Summary
Fields Modifier and Type Field Description protected List<Actor>
m_Actors
the underlying display actors.protected JMenuBar
m_MenuBar
the menu bar, if used.protected JMenuItem
m_MenuItemFileClear
the "clear" menu item.protected JMenuItem
m_MenuItemFileClose
the "exit" menu item.protected JMenuItem
m_MenuItemFlowPauseResume
the "pause/resume" menu item.protected JMenuItem
m_MenuItemFlowStop
the "stop" menu item.protected boolean
m_ShowFlowControlSubMenu
whether to show flow control sub-menu.protected List<AbstractMultiView.ViewWrapper>
m_Wrappers
the panels in use.protected JComponentWriter
m_Writer
the writer to use.-
Fields inherited from class adams.flow.core.AbstractDisplay
BACKUP_INPUT, m_CreateFrame, m_DisplayType, m_Frame, m_Height, m_InputToken, m_KeepOpen, m_Panel, m_ShortTitle, m_Updating, m_Width, m_X, m_Y
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractMultiView()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
actorsTipText()
Returns the tip text for this property.String
add(int index, Actor actor)
Inserts the actor at the given position.String
add(Actor actor)
Inserts the actor at the end.abstract void
addPanel(Actor actor, BasePanel panel)
Replaces the current dummy panel with the actual panel.protected boolean
canPauseOrResume()
Returns whether the flow can be paused/resumed.String
check()
Performs checks on the "sub-actors".protected String
check(Actor actor)
Checks whether the actor is valid.String
checkActorReferenceHandlers()
Ensures that the handlers appear in the correct order.void
cleanUp()
Cleans up after the execution has finished.protected void
clear()
Clears the display, if possible.void
clearPanel()
Clears the content of the panel.protected void
close()
Closes the dialog or frame.protected JMenuBar
createMenuBar()
Assembles the menu bar.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.Actor
firstActive()
Returns the first non-skipped actor.void
flushExecution()
Stops the processing of tokens without stopping the flow.Actor
get(int index)
Returns the actor at the given position.ActorHandlerInfo
getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.Actor[]
getActors()
Returns the panel providers.JMenuBar
getMenuBar()
Creates a menu bar (singleton per panel object).Class[]
getProhibitedPrecedingActorReferenceHandlers()
Returns the classes that are prohibited to appear before this reference handler.Class[]
getSendToClasses()
Returns the classes that the supporter generates.Object
getSendToItem(Class[] cls)
Returns the object to send.boolean
getShowFlowControlSubMenu()
Returns whether to show a flow control sub-menu in the menubar.boolean
hasSendToItem(Class[] cls)
Checks whether something to send is available.int
indexOf(String actor)
Returns the index of the actor.protected void
initialize()
Initializes the members.protected boolean
isPaused()
Returns whether the flow is currently paused.boolean
isReferencingRequired()
Returns whether actors have to be referenced elsewhere in the flow or whether it is optional.Actor
lastActive()
Returns the last non-skipped actor.abstract boolean
makeVisible(AbstractMultiView.ViewWrapper wrapper)
Ensures that the wrapper is visible.protected Runnable
newDisplayRunnable()
Returns a runnable that displays frame, etc.protected abstract BasePanel
newPanel()
Creates the panel to display in the dialog.protected void
pauseResumeFlow()
Pauses or resumes the flow.Actor
remove(int index)
Removes the actor at the given position and returns the removed object.void
removeAll()
Removes all actors.String
set(int index, Actor actor)
Sets the actor at the given position.void
setActors(Actor[] value)
Sets the panel providers.void
setShowFlowControlSubMenu(boolean value)
Sets whether to show a flow control sub-menu in the menubar.String
setUp()
Initializes the item for flow execution.void
setVariables(Variables value)
Updates the Variables instance in use, if different from current one.String
showFlowControlSubMenuTipText()
Returns the tip text for this property.int
size()
Returns the size of the group.void
stopExecution()
Stops the execution.protected void
stopFlow()
Stops the flow.protected boolean
supportsClear()
Whether "clear" is supported and shows up in the menu.protected void
updateMenu()
updates the enabled state of the menu items.protected void
updateParent()
Updates the parent of all actors in this group.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractDisplay
backupState, cleanUpGUI, cleanUpGUIKeepOpen, closeFrame, createFrame, createTitle, currentInput, deregisterInWrapUp, deregisterWindow, deregisterWithEditor, displayTypeTipText, doCreateFrame, getCreateFrame, getDefaultDisplayType, getDefaultHeight, getDefaultShortTitle, getDefaultWidth, getDefaultX, getDefaultY, getDisplayType, getFrame, getFrameDefaultCloseOperation, getHeight, getKeepOpen, getPanel, getQuickInfo, getShortTitle, getWidth, getX, getY, hasInput, heightTipText, input, postCreateFrame, preCreateFrame, registerWindow, registerWithEditor, reset, restoreState, setCreateFrame, setDisplayType, setHeight, setKeepOpen, setShortTitle, setWidth, setX, setY, shortTitleTipText, widthTipText, xTipText, yTipText
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_Wrappers
protected List<AbstractMultiView.ViewWrapper> m_Wrappers
the panels in use.
-
m_Writer
protected JComponentWriter m_Writer
the writer to use.
-
m_ShowFlowControlSubMenu
protected boolean m_ShowFlowControlSubMenu
whether to show flow control sub-menu.
-
m_MenuBar
protected JMenuBar m_MenuBar
the menu bar, if used.
-
m_MenuItemFileClear
protected JMenuItem m_MenuItemFileClear
the "clear" menu item.
-
m_MenuItemFileClose
protected JMenuItem m_MenuItemFileClose
the "exit" menu item.
-
m_MenuItemFlowPauseResume
protected JMenuItem m_MenuItemFlowPauseResume
the "pause/resume" menu item.
-
m_MenuItemFlowStop
protected JMenuItem m_MenuItemFlowStop
the "stop" menu item.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractDisplay
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractDisplay
-
setActors
public void setActors(Actor[] value)
Sets the panel providers.- Parameters:
value
- the panel providers
-
getActors
public Actor[] getActors()
Returns the panel providers.- Returns:
- the panel providers
-
actorsTipText
public abstract String actorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowFlowControlSubMenu
public void setShowFlowControlSubMenu(boolean value)
Sets whether to show a flow control sub-menu in the menubar.- Parameters:
value
- true if to show
-
getShowFlowControlSubMenu
public boolean getShowFlowControlSubMenu()
Returns whether to show a flow control sub-menu in the menubar.- Returns:
- true if to show
-
showFlowControlSubMenuTipText
public String showFlowControlSubMenuTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
check
protected String check(Actor actor)
Checks whether the actor is valid.- Parameters:
actor
- the actor to check- Returns:
- null if OK, otherwise error message
-
updateParent
protected void updateParent()
Updates the parent of all actors in this group.
-
add
public String add(Actor actor)
Inserts the actor at the end.- Specified by:
add
in interfaceMutableActorHandler
- Parameters:
actor
- the actor to insert- Returns:
- null if everything is fine, otherwise the error
-
add
public String add(int index, Actor actor)
Inserts the actor at the given position.- Specified by:
add
in interfaceMutableActorHandler
- Parameters:
index
- the positionactor
- the actor to insert- Returns:
- null if everything is fine, otherwise the error
-
remove
public Actor remove(int index)
Removes the actor at the given position and returns the removed object.- Specified by:
remove
in interfaceMutableActorHandler
- Parameters:
index
- the position- Returns:
- the removed actor
-
removeAll
public void removeAll()
Removes all actors.- Specified by:
removeAll
in interfaceMutableActorHandler
-
getActorHandlerInfo
public ActorHandlerInfo getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.- Specified by:
getActorHandlerInfo
in interfaceActorHandler
- Returns:
- the info
-
getProhibitedPrecedingActorReferenceHandlers
public Class[] getProhibitedPrecedingActorReferenceHandlers()
Returns the classes that are prohibited to appear before this reference handler.- Specified by:
getProhibitedPrecedingActorReferenceHandlers
in interfaceActorReferenceHandler
- Returns:
- the classes
-
checkActorReferenceHandlers
public String checkActorReferenceHandlers()
Ensures that the handlers appear in the correct order.- Specified by:
checkActorReferenceHandlers
in interfaceActorReferenceHandler
- Returns:
- null if OK, otherwise error message
- See Also:
getProhibitedPrecedingActorReferenceHandlers()
-
isReferencingRequired
public boolean isReferencingRequired()
Returns whether actors have to be referenced elsewhere in the flow or whether it is optional.- Specified by:
isReferencingRequired
in interfaceActorReferenceHandler
- Returns:
- true if required, false if optional
-
check
public String check()
Performs checks on the "sub-actors".- Specified by:
check
in interfaceActorHandler
- Returns:
- null if everything is fine, otherwise the error
-
size
public int size()
Returns the size of the group.- Specified by:
size
in interfaceActorHandler
- Returns:
- the size
-
get
public Actor get(int index)
Returns the actor at the given position.- Specified by:
get
in interfaceActorHandler
- Parameters:
index
- the position- Returns:
- the actor
-
set
public String set(int index, Actor actor)
Sets the actor at the given position.- Specified by:
set
in interfaceActorHandler
- Parameters:
index
- the positionactor
- the actor to set at this position- Returns:
- null if everything is fine, otherwise the error
-
indexOf
public int indexOf(String actor)
Returns the index of the actor.- Specified by:
indexOf
in interfaceActorHandler
- Parameters:
actor
- the name of the actor to look for- Returns:
- the index of -1 if not found
-
firstActive
public Actor firstActive()
Returns the first non-skipped actor.- Specified by:
firstActive
in interfaceActorHandler
- Returns:
- the first 'active' actor, null if none available
-
lastActive
public Actor lastActive()
Returns the last non-skipped actor.- Specified by:
lastActive
in interfaceActorHandler
- Returns:
- the last 'active' actor, null if none available
-
makeVisible
public abstract boolean makeVisible(AbstractMultiView.ViewWrapper wrapper)
Ensures that the wrapper is visible.- Parameters:
wrapper
- the wrapper to make visible- Returns:
- true if successful
-
clearPanel
public void clearPanel()
Clears the content of the panel.- Specified by:
clearPanel
in classAbstractDisplay
-
newPanel
protected abstract BasePanel newPanel()
Creates the panel to display in the dialog.- Specified by:
newPanel
in classAbstractDisplay
- Returns:
- the panel
-
newDisplayRunnable
protected Runnable newDisplayRunnable()
Returns a runnable that displays frame, etc. Must call notifyAll() on the m_Self object and set m_Updating to false.- Specified by:
newDisplayRunnable
in classAbstractDisplay
- Returns:
- the runnable
- See Also:
AbstractDisplay.m_Updating
-
setVariables
public void setVariables(Variables value)
Updates the Variables instance in use, if different from current one.
Also updates theAbstractMultiView.ViewWrapper
instances.- Specified by:
setVariables
in interfaceActor
- Overrides:
setVariables
in classAbstractActor
- Parameters:
value
- the instance to use- See Also:
AbstractActor.forceVariables(Variables)
-
setUp
public String setUp()
Initializes the item for flow execution. Also calls the reset() method first before anything else.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractDisplay.reset()
-
doExecute
protected String doExecute()
Executes the flow item.- Overrides:
doExecute
in classAbstractDisplay
- Returns:
- null if everything is fine, otherwise error message
-
addPanel
public abstract void addPanel(Actor actor, BasePanel panel)
Replaces the current dummy panel with the actual panel.- Parameters:
actor
- the actor this panel is forpanel
- the panel to replace the dummy one
-
flushExecution
public void flushExecution()
Stops the processing of tokens without stopping the flow.- Specified by:
flushExecution
in interfaceActorHandler
- Specified by:
flushExecution
in interfaceFlushable
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractDisplay
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractDisplay
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished. Also removes graphical components.- Specified by:
cleanUp
in interfaceActor
- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractDisplay
-
createMenuBar
protected JMenuBar createMenuBar()
Assembles the menu bar.- Returns:
- the menu bar
-
getMenuBar
public JMenuBar getMenuBar()
Creates a menu bar (singleton per panel object). Can be used in frames.- Specified by:
getMenuBar
in interfaceMenuBarProvider
- Returns:
- the menu bar
-
updateMenu
protected void updateMenu()
updates the enabled state of the menu items.
-
supportsClear
protected boolean supportsClear()
Whether "clear" is supported and shows up in the menu.- Returns:
- true if supported by at least one wrapped view
-
clear
protected void clear()
Clears the display, if possible.
-
close
protected void close()
Closes the dialog or frame.
-
canPauseOrResume
protected boolean canPauseOrResume()
Returns whether the flow can be paused/resumed.- Returns:
- true if pause/resume available
-
isPaused
protected boolean isPaused()
Returns whether the flow is currently paused.- Returns:
- true if currently paused
-
pauseResumeFlow
protected void pauseResumeFlow()
Pauses or resumes the flow.
-
stopFlow
protected void stopFlow()
Stops the flow.
-
getSendToClasses
public Class[] getSendToClasses()
Returns the classes that the supporter generates.- Specified by:
getSendToClasses
in interfaceSendToActionSupporter
- Returns:
- the classes
-
hasSendToItem
public boolean hasSendToItem(Class[] cls)
Checks whether something to send is available.- Specified by:
hasSendToItem
in interfaceSendToActionSupporter
- Parameters:
cls
- the requested classes- Returns:
- true if an object is available for sending
-
getSendToItem
public Object getSendToItem(Class[] cls)
Returns the object to send.- Specified by:
getSendToItem
in interfaceSendToActionSupporter
- Parameters:
cls
- the requested classes- Returns:
- the item to send
-
-