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
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractDisplay
,AbstractMultiView
,AbstractMultiView.ViewWrapper
,ConsoleWindow
,MissionControl
,Stopwatch
public abstract class AbstractDisplay extends AbstractActor implements DisplayTypeSupporter
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 String
BACKUP_INPUT
the key for storing the input token in the backup.protected boolean
m_CreateFrame
whether to create the frame or just the panel.protected AbstractDisplayType
m_DisplayType
how to show the display.protected BaseFrame
m_Frame
the dialog that's being displayed.protected int
m_Height
the height of the dialog.protected Token
m_InputToken
the current token.protected boolean
m_KeepOpen
whether to keep the GUI even beyond cleanup.protected BasePanel
m_Panel
the panel to display.protected boolean
m_ShortTitle
whether to use just the actor name or the full name as title.protected Boolean
m_Updating
whether the GUI is currently being updated.protected int
m_Width
the width of the dialog.protected int
m_X
the X position of the dialog.protected int
m_Y
the 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.void
cleanUp()
Cleans up after the execution has finished.protected void
cleanUpGUI()
Removes all graphical components.protected void
cleanUpGUIKeepOpen()
Performs only minimal clean up as GUI elements were requested to stay available.abstract void
clearPanel()
Clears the content of the panel.void
closeFrame()
Closes the frame.protected BaseFrame
createFrame(BasePanel panel)
Creates and initializes a frame with the just created panel.protected String
createTitle()
Creates a title for the dialog.Token
currentInput()
Returns the current input token, if any.void
defineOptions()
Adds options to the internal list of options.boolean
deregisterInWrapUp()
Returns whether to de-register inwrapUp()
or wait tillcleanUpGUI()
.protected void
deregisterWindow()
Deregisters the window with the flow root actor.void
deregisterWithEditor()
Deregisters the actor from the flow editor, if possible.String
displayTypeTipText()
Returns the tip text for this property.protected BaseFrame
doCreateFrame(BasePanel panel)
Creates the actual frame.protected String
doExecute()
Executes the flow item.boolean
getCreateFrame()
Returns whether the frame is created as well as the panel.protected AbstractDisplayType
getDefaultDisplayType()
Returns the default value for showing the display.protected int
getDefaultHeight()
Returns the default height for the dialog.protected boolean
getDefaultShortTitle()
Returns the default value for short title.protected int
getDefaultWidth()
Returns the default width for the dialog.protected int
getDefaultX()
Returns the default X position for the dialog.protected int
getDefaultY()
Returns the default Y position for the dialog.AbstractDisplayType
getDisplayType()
Returns how to show the display.BaseFrame
getFrame()
Returns the frame.protected int
getFrameDefaultCloseOperation()
Returns the default operation when closing the frame.int
getHeight()
Returns the currently set height of the dialog.boolean
getKeepOpen()
Returns whether to keep the GUI open beyond cleanup.BasePanel
getPanel()
Returns the panel.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.boolean
getShortTitle()
Returns whether to use just the name of the actor or the full name.int
getWidth()
Returns the currently set width of the dialog.int
getX()
Returns the currently set X position of the dialog.int
getY()
Returns the currently set Y position of the dialog.boolean
hasInput()
Returns whether an input token is currently present.String
heightTipText()
Returns the tip text for this property.protected void
initialize()
Initializes the members.void
input(Token token)
The method that accepts the input token and then processes it.protected abstract Runnable
newDisplayRunnable()
Returns a runnable that displays frame, etc.protected abstract BasePanel
newPanel()
Creates the panel to display in the dialog.protected void
postCreateFrame(BaseFrame frame, BasePanel panel)
Hook method after the frame got created.protected void
preCreateFrame(BasePanel panel)
Hook method before the frame gets created.protected void
registerWindow()
Registers the window with the flow root actor.void
registerWithEditor()
Registers the actor with the flow editor, if possible.protected void
reset()
Resets the object.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setCreateFrame(boolean value)
Sets whether to create the frame or just the panel.void
setDisplayType(AbstractDisplayType value)
Sets how to show the display.void
setHeight(int value)
Sets the height of the dialog.void
setKeepOpen(boolean value)
Sets whether to keep the GUI open beyond cleanup.void
setShortTitle(boolean value)
Sets whether to use just the name of the actor or the full name.void
setWidth(int value)
Sets the width of the dialog.void
setX(int value)
Sets the X position of the dialog.void
setY(int value)
Sets the Y position of the dialog.String
shortTitleTipText()
Returns the tip text for this property.void
stopExecution()
Stops the execution.String
widthTipText()
Returns the tip text for this property.void
wrapUp()
Cleans up after the execution has finished.String
xTipText()
Returns the tip text for this property.String
yTipText()
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.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in 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:
backupState
in 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:
restoreState
in 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:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in 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:
setDisplayType
in interfaceDisplayTypeSupporter
- Parameters:
value
- the type
-
getDisplayType
public AbstractDisplayType getDisplayType()
Returns how to show the display.- Specified by:
getDisplayType
in interfaceDisplayTypeSupporter
- Returns:
- the type
-
displayTypeTipText
public String displayTypeTipText()
Returns the tip text for this property.- Specified by:
displayTypeTipText
in 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:
reset
in classAbstractActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractActor
-
closeFrame
public void closeFrame()
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.
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in 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:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
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 classAbstractActor
-
-