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,FlowControlSubMenuSupporter,Flushable,HeadlessExecutionSupporter,MutableActorHandler,MenuBarProvider,SendToActionSupporter,Serializable,Comparable
public abstract class AbstractMultiView extends AbstractDisplay implements ActorReferenceHandler, MenuBarProvider, SendToActionSupporter, FlowControlSubMenuSupporter
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 classAbstractMultiView.ViewWrapperA wrapper for the actual actors.
-
Field Summary
Fields Modifier and Type Field Description protected List<Actor>m_Actorsthe underlying display actors.protected JMenuBarm_MenuBarthe menu bar, if used.protected JMenuItemm_MenuItemFileClearthe "clear" menu item.protected JMenuItemm_MenuItemFileClosethe "exit" menu item.protected JMenuItemm_MenuItemFlowPauseResumethe "pause/resume" menu item.protected JMenuItemm_MenuItemFlowStopthe "stop" menu item.protected booleanm_ShowFlowControlSubMenuwhether to show flow control sub-menu.protected List<AbstractMultiView.ViewWrapper>m_Wrappersthe panels in use.protected JComponentWriterm_Writerthe 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_ResetGUIWaiting, 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 StringactorsTipText()Returns the tip text for this property.Stringadd(int index, Actor actor)Inserts the actor at the given position.Stringadd(Actor actor)Inserts the actor at the end.abstract voidaddPanel(Actor actor, BasePanel panel)Replaces the current dummy panel with the actual panel.protected booleancanPauseOrResume()Returns whether the flow can be paused/resumed.Stringcheck()Performs checks on the "sub-actors".protected Stringcheck(Actor actor)Checks whether the actor is valid.StringcheckActorReferenceHandlers()Ensures that the handlers appear in the correct order.voidcleanUp()Cleans up after the execution has finished.protected voidclear()Clears the display, if possible.voidclearPanel()Clears the content of the panel.protected voidclose()Closes the dialog or frame.protected JMenuBarcreateMenuBar()Assembles the menu bar.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.ActorfirstActive()Returns the first non-skipped actor.voidflushExecution()Stops the processing of tokens without stopping the flow.Actorget(int index)Returns the actor at the given position.ActorHandlerInfogetActorHandlerInfo()Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.Actor[]getActors()Returns the panel providers.JMenuBargetMenuBar()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.ObjectgetSendToItem(Class[] cls)Returns the object to send.booleangetShowFlowControlSubMenu()Returns whether to show a flow control sub-menu in the menubar.booleanhasSendToItem(Class[] cls)Checks whether something to send is available.intindexOf(String actor)Returns the index of the actor.protected voidinitialize()Initializes the members.protected booleanisPaused()Returns whether the flow is currently paused.booleanisReferencingRequired()Returns whether actors have to be referenced elsewhere in the flow or whether it is optional.ActorlastActive()Returns the last non-skipped actor.abstract booleanmakeVisible(AbstractMultiView.ViewWrapper wrapper)Ensures that the wrapper is visible.protected RunnablenewDisplayRunnable()Returns a runnable that displays frame, etc.protected abstract BasePanelnewPanel()Creates the panel to display in the dialog.protected voidpauseResumeFlow()Pauses or resumes the flow.Actorremove(int index)Removes the actor at the given position and returns the removed object.voidremoveAll()Removes all actors.Stringset(int index, Actor actor)Sets the actor at the given position.voidsetActors(Actor[] value)Sets the panel providers.voidsetShowFlowControlSubMenu(boolean value)Sets whether to show a flow control sub-menu in the menubar.StringsetUp()Initializes the item for flow execution.voidsetVariables(Variables value)Updates the Variables instance in use, if different from current one.StringshowFlowControlSubMenuTipText()Returns the tip text for this property.intsize()Returns the size of the group.voidstopExecution()Stops the execution.protected voidstopFlow()Stops the flow.protected booleansupportsClear()Whether "clear" is supported and shows up in the menu.protected voidupdateMenu()updates the enabled state of the menu items.protected voidupdateParent()Updates the parent of all actors in this group.voidwrapUp()Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractDisplay
backupState, cleanUpGUI, cleanUpGUIKeepOpen, closeDisplay, createFrame, createTitle, currentInput, deregisterInWrapUp, deregisterWindow, deregisterWithEditor, displayTypeTipText, doCreateFrame, doExecuteHeadless, 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, supportsHeadlessExecution, 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:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractDisplay
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein 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.- Specified by:
setShowFlowControlSubMenuin interfaceFlowControlSubMenuSupporter- Parameters:
value- true if to show
-
getShowFlowControlSubMenu
public boolean getShowFlowControlSubMenu()
Returns whether to show a flow control sub-menu in the menubar.- Specified by:
getShowFlowControlSubMenuin interfaceFlowControlSubMenuSupporter- Returns:
- true if to show
-
showFlowControlSubMenuTipText
public String showFlowControlSubMenuTipText()
Returns the tip text for this property.- Specified by:
showFlowControlSubMenuTipTextin interfaceFlowControlSubMenuSupporter- 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:
addin 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:
addin 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:
removein interfaceMutableActorHandler- Parameters:
index- the position- Returns:
- the removed actor
-
removeAll
public void removeAll()
Removes all actors.- Specified by:
removeAllin 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:
getActorHandlerInfoin interfaceActorHandler- Returns:
- the info
-
getProhibitedPrecedingActorReferenceHandlers
public Class[] getProhibitedPrecedingActorReferenceHandlers()
Returns the classes that are prohibited to appear before this reference handler.- Specified by:
getProhibitedPrecedingActorReferenceHandlersin interfaceActorReferenceHandler- Returns:
- the classes
-
checkActorReferenceHandlers
public String checkActorReferenceHandlers()
Ensures that the handlers appear in the correct order.- Specified by:
checkActorReferenceHandlersin 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:
isReferencingRequiredin interfaceActorReferenceHandler- Returns:
- true if required, false if optional
-
check
public String check()
Performs checks on the "sub-actors".- Specified by:
checkin interfaceActorHandler- Returns:
- null if everything is fine, otherwise the error
-
size
public int size()
Returns the size of the group.- Specified by:
sizein interfaceActorHandler- Returns:
- the size
-
get
public Actor get(int index)
Returns the actor at the given position.- Specified by:
getin 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:
setin 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:
indexOfin 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:
firstActivein interfaceActorHandler- Returns:
- the first 'active' actor, null if none available
-
lastActive
public Actor lastActive()
Returns the last non-skipped actor.- Specified by:
lastActivein 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:
clearPanelin classAbstractDisplay
-
newPanel
protected abstract BasePanel newPanel()
Creates the panel to display in the dialog.- Specified by:
newPanelin 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:
newDisplayRunnablein 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.ViewWrapperinstances.- Specified by:
setVariablesin interfaceActor- Overrides:
setVariablesin 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:
setUpin interfaceActor- Overrides:
setUpin classAbstractActor- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractDisplay.reset()
-
doExecute
protected String doExecute()
Executes the flow item.- Overrides:
doExecutein 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:
flushExecutionin interfaceActorHandler- Specified by:
flushExecutionin interfaceFlushable
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractDisplay
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractDisplay
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished. Also removes graphical components.- Specified by:
cleanUpin interfaceActor- Specified by:
cleanUpin interfaceCleanUpHandler- Overrides:
cleanUpin 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:
getMenuBarin 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:
getSendToClassesin interfaceSendToActionSupporter- Returns:
- the classes
-
hasSendToItem
public boolean hasSendToItem(Class[] cls)
Checks whether something to send is available.- Specified by:
hasSendToItemin 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:
getSendToItemin interfaceSendToActionSupporter- Parameters:
cls- the requested classes- Returns:
- the item to send
-
-