Package adams.flow.core
Class AbstractDisplay
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,VariableChangeListener,Actor,DisplayTypeSupporter,ErrorHandler,HeadlessExecutionSupporter,Serializable,Comparable
- Direct Known Subclasses:
AbstractDisplay,AbstractMultiView,AbstractMultiView.ViewWrapper,ConsoleWindow,MissionControl,Stopwatch
public abstract class AbstractDisplay extends AbstractActor implements DisplayTypeSupporter, HeadlessExecutionSupporter
Ancestor for actors that display stuff.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringBACKUP_INPUTthe key for storing the input token in the backup.protected booleanm_CreateFramewhether to create the frame or just the panel.protected AbstractDisplayTypem_DisplayTypehow to show the display.protected BaseFramem_Framethe dialog that's being displayed.protected intm_Heightthe height of the dialog.protected Tokenm_InputTokenthe current token.protected booleanm_KeepOpenwhether to keep the GUI even beyond cleanup.protected BasePanelm_Panelthe panel to display.protected booleanm_ResetGUIWaitingwhether to reset the GUI.protected booleanm_ShortTitlewhether to use just the actor name or the full name as title.protected Booleanm_Updatingwhether the GUI is currently being updated.protected intm_Widththe width of the dialog.protected intm_Xthe X position of the dialog.protected intm_Ythe Y position of the dialog.-
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 AbstractDisplay()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Hashtable<String,Object>backupState()Backs up the current state of the actor before update the variables.voidcleanUp()Cleans up after the execution has finished.protected voidcleanUpGUI()Removes all graphical components.protected voidcleanUpGUIKeepOpen()Performs only minimal clean up as GUI elements were requested to stay available.abstract voidclearPanel()Clears the content of the panel.voidcloseDisplay()Closes the frame.protected BaseFramecreateFrame(BasePanel panel)Creates and initializes a frame with the just created panel.protected StringcreateTitle()Creates a title for the dialog.TokencurrentInput()Returns the current input token, if any.voiddefineOptions()Adds options to the internal list of options.booleanderegisterInWrapUp()Returns whether to de-register inwrapUp()or wait tillcleanUpGUI().protected voidderegisterWindow()Deregisters the window with the flow root actor.voidderegisterWithEditor()Deregisters the actor from the flow editor, if possible.StringdisplayTypeTipText()Returns the tip text for this property.protected BaseFramedoCreateFrame(BasePanel panel)Creates the actual frame.protected StringdoExecute()Executes the flow item.protected StringdoExecuteHeadless()Executes the flow item in headless mode.booleangetCreateFrame()Returns whether the frame is created as well as the panel.protected AbstractDisplayTypegetDefaultDisplayType()Returns the default value for showing the display.protected intgetDefaultHeight()Returns the default height for the dialog.protected booleangetDefaultShortTitle()Returns the default value for short title.protected intgetDefaultWidth()Returns the default width for the dialog.protected intgetDefaultX()Returns the default X position for the dialog.protected intgetDefaultY()Returns the default Y position for the dialog.AbstractDisplayTypegetDisplayType()Returns how to show the display.BaseFramegetFrame()Returns the frame.protected intgetFrameDefaultCloseOperation()Returns the default operation when closing the frame.intgetHeight()Returns the currently set height of the dialog.booleangetKeepOpen()Returns whether to keep the GUI open beyond cleanup.BasePanelgetPanel()Returns the panel.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.booleangetShortTitle()Returns whether to use just the name of the actor or the full name.intgetWidth()Returns the currently set width of the dialog.intgetX()Returns the currently set X position of the dialog.intgetY()Returns the currently set Y position of the dialog.booleanhasInput()Returns whether an input token is currently present.StringheightTipText()Returns the tip text for this property.protected voidinitialize()Initializes the members.voidinput(Token token)The method that accepts the input token and then processes it.protected abstract RunnablenewDisplayRunnable()Returns a runnable that displays frame, etc.protected abstract BasePanelnewPanel()Creates the panel to display in the dialog.protected voidpostCreateFrame(BaseFrame frame, BasePanel panel)Hook method after the frame got created.protected voidpreCreateFrame(BasePanel panel)Hook method before the frame gets created.protected voidregisterWindow()Registers the window with the flow root actor.voidregisterWithEditor()Registers the actor with the flow editor, if possible.protected voidreset()Resets the object.protected voidrestoreState(Hashtable<String,Object> state)Restores the state of the actor before the variables got updated.voidsetCreateFrame(boolean value)Sets whether to create the frame or just the panel.voidsetDisplayType(AbstractDisplayType value)Sets how to show the display.voidsetHeight(int value)Sets the height of the dialog.voidsetKeepOpen(boolean value)Sets whether to keep the GUI open beyond cleanup.voidsetShortTitle(boolean value)Sets whether to use just the name of the actor or the full name.voidsetWidth(int value)Sets the width of the dialog.voidsetX(int value)Sets the X position of the dialog.voidsetY(int value)Sets the Y position of the dialog.StringshortTitleTipText()Returns the tip text for this property.voidstopExecution()Stops the execution.booleansupportsHeadlessExecution()Returns whether headless execution is supported.StringwidthTipText()Returns the tip text for this property.voidwrapUp()Cleans up after the execution has finished.StringxTipText()Returns the tip text for this property.StringyTipText()Returns the tip text for this property.-
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, setUp, setVariables, 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, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, 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
-
BACKUP_INPUT
public static final String BACKUP_INPUT
the key for storing the input token in the backup.- See Also:
- Constant Field Values
-
m_InputToken
protected transient Token m_InputToken
the current token.
-
m_ShortTitle
protected boolean m_ShortTitle
whether to use just the actor name or the full name as title.
-
m_Width
protected int m_Width
the width of the dialog.
-
m_Height
protected int m_Height
the height of the dialog.
-
m_X
protected int m_X
the X position of the dialog.
-
m_Y
protected int m_Y
the Y position of the dialog.
-
m_DisplayType
protected AbstractDisplayType m_DisplayType
how to show the display.
-
m_Panel
protected BasePanel m_Panel
the panel to display.
-
m_Frame
protected BaseFrame m_Frame
the dialog that's being displayed.
-
m_CreateFrame
protected boolean m_CreateFrame
whether to create the frame or just the panel.
-
m_Updating
protected Boolean m_Updating
whether the GUI is currently being updated.
-
m_KeepOpen
protected boolean m_KeepOpen
whether to keep the GUI even beyond cleanup.
-
m_ResetGUIWaiting
protected boolean m_ResetGUIWaiting
whether to reset the GUI.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractActor- Returns:
- null if no info available, otherwise short string
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupStatein classAbstractActor- Returns:
- the backup
- See Also:
AbstractActor.updateVariables(),AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreStatein classAbstractActor- Parameters:
state- the backup of the state to restore from- See Also:
AbstractActor.updateVariables(),AbstractActor.backupState()
-
input
public void input(Token token)
The method that accepts the input token and then processes it.- Parameters:
token- the token to accept and process- See Also:
m_InputToken
-
hasInput
public boolean hasInput()
Returns whether an input token is currently present.- Returns:
- true if input token present
-
currentInput
public Token currentInput()
Returns the current input token, if any.- Returns:
- the input token, null if none present
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractActor
-
getDefaultShortTitle
protected boolean getDefaultShortTitle()
Returns the default value for short title.- Returns:
- the default
-
getDefaultDisplayType
protected AbstractDisplayType getDefaultDisplayType()
Returns the default value for showing the display.- Returns:
- the default
-
getDefaultX
protected int getDefaultX()
Returns the default X position for the dialog.- Returns:
- the default X position
-
getDefaultY
protected int getDefaultY()
Returns the default Y position for the dialog.- Returns:
- the default Y position
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Returns:
- the default width
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Returns:
- the default height
-
setShortTitle
public void setShortTitle(boolean value)
Sets whether to use just the name of the actor or the full name.- Parameters:
value- if true just the name will get used, otherwise the full name
-
getShortTitle
public boolean getShortTitle()
Returns whether to use just the name of the actor or the full name.- Returns:
- true if just the name used, otherwise full name
-
shortTitleTipText
public String shortTitleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWidth
public void setWidth(int value)
Sets the width of the dialog.- Parameters:
value- the width
-
getWidth
public int getWidth()
Returns the currently set width of the dialog.- Returns:
- the width
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setHeight
public void setHeight(int value)
Sets the height of the dialog.- Parameters:
value- the height
-
getHeight
public int getHeight()
Returns the currently set height of the dialog.- Returns:
- the height
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setX
public void setX(int value)
Sets the X position of the dialog.- Parameters:
value- the X position
-
getX
public int getX()
Returns the currently set X position of the dialog.- Returns:
- the X position
-
xTipText
public String xTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setY
public void setY(int value)
Sets the Y position of the dialog.- Parameters:
value- the Y position
-
getY
public int getY()
Returns the currently set Y position of the dialog.- Returns:
- the Y position
-
yTipText
public String yTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDisplayType
public void setDisplayType(AbstractDisplayType value)
Sets how to show the display.- Specified by:
setDisplayTypein interfaceDisplayTypeSupporter- Parameters:
value- the type
-
getDisplayType
public AbstractDisplayType getDisplayType()
Returns how to show the display.- Specified by:
getDisplayTypein interfaceDisplayTypeSupporter- Returns:
- the type
-
displayTypeTipText
public String displayTypeTipText()
Returns the tip text for this property.- Specified by:
displayTypeTipTextin interfaceDisplayTypeSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setKeepOpen
public void setKeepOpen(boolean value)
Sets whether to keep the GUI open beyond cleanup.- Parameters:
value- true if to keep open
-
getKeepOpen
public boolean getKeepOpen()
Returns whether to keep the GUI open beyond cleanup.- Returns:
- true if to keep open
-
reset
protected void reset()
Resets the object. Removes graphical components as well.- Overrides:
resetin classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractActor
-
closeDisplay
public void closeDisplay()
Closes the frame.
-
clearPanel
public abstract void clearPanel()
Clears the content of the panel.
-
newPanel
protected abstract BasePanel newPanel()
Creates the panel to display in the dialog.- Returns:
- the panel
-
getPanel
public BasePanel getPanel()
Returns the panel.- Returns:
- the panel, null if not available
-
createTitle
protected String createTitle()
Creates a title for the dialog. Default implementation only returns the full name of the actor.- Returns:
- the title of the dialog
-
setCreateFrame
public void setCreateFrame(boolean value)
Sets whether to create the frame or just the panel.- Parameters:
value- if false, only the panel is created
-
getCreateFrame
public boolean getCreateFrame()
Returns whether the frame is created as well as the panel.- Returns:
- true if the panel is created as well
-
preCreateFrame
protected void preCreateFrame(BasePanel panel)
Hook method before the frame gets created.
Default implementation does nothing.- Parameters:
panel- the panel to display in the frame
-
getFrameDefaultCloseOperation
protected int getFrameDefaultCloseOperation()
Returns the default operation when closing the frame.- Returns:
- the operation
-
doCreateFrame
protected BaseFrame doCreateFrame(BasePanel panel)
Creates the actual frame.- Parameters:
panel- the panel to display in the frame- Returns:
- the created frame
-
postCreateFrame
protected void postCreateFrame(BaseFrame frame, BasePanel panel)
Hook method after the frame got created.
Default implementation does nothing.- Parameters:
frame- the frame that got just createdpanel- the panel displayed in the frame
-
createFrame
protected BaseFrame createFrame(BasePanel panel)
Creates and initializes a frame with the just created panel.- Parameters:
panel- the panel to use in the frame- Returns:
- the created frame
-
getFrame
public BaseFrame getFrame()
Returns the frame.- Returns:
- the frame, null if not available
-
registerWithEditor
public void registerWithEditor()
Registers the actor with the flow editor, if possible.
-
deregisterWithEditor
public void deregisterWithEditor()
Deregisters the actor from the flow editor, if possible.
-
deregisterInWrapUp
public boolean deregisterInWrapUp()
- Returns:
- true if to deregister already in
wrapUp()
-
newDisplayRunnable
protected abstract Runnable newDisplayRunnable()
Returns a runnable that displays frame, etc. Must call notifyAll() on the m_Self object and set m_Updating to false.- Returns:
- the runnable
- See Also:
m_Updating
-
registerWindow
protected void registerWindow()
Registers the window with the flow root actor.
-
deregisterWindow
protected void deregisterWindow()
Deregisters the window with the flow root actor.
-
supportsHeadlessExecution
public boolean supportsHeadlessExecution()
Returns whether headless execution is supported.- Specified by:
supportsHeadlessExecutionin interfaceHeadlessExecutionSupporter- Returns:
- true if supported
-
doExecuteHeadless
protected String doExecuteHeadless()
Executes the flow item in headless mode.
Default implementation does nothing and just returns null.- Returns:
- null if everything is fine, otherwise error message
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
cleanUpGUIKeepOpen
protected void cleanUpGUIKeepOpen()
Performs only minimal clean up as GUI elements were requested to stay available.- See Also:
getKeepOpen()
-
cleanUpGUI
protected void cleanUpGUI()
Removes all graphical components.
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
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 classAbstractActor
-
-