Package adams.flow.standalone
Class Stopwatch
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,VariableChangeListener,Actor,DisplayTypeSupporter,ErrorHandler,HeadlessExecutionSupporter,Serializable,Comparable
public class Stopwatch extends AbstractDisplay
Stops the execution time of the flow, till either the user stops the flow or the flow finishes by itself
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
-name <java.lang.String> (property: name) The name of the actor. default: Stopwatch
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-width <int> (property: width) The width of the dialog. default: 100 minimum: 1
-height <int> (property: height) The height of the dialog. default: 56 minimum: 1
-x <int> (property: x) The X position of the dialog (>=0: absolute, -1: left, -2: center, -3: right ). default: -3 minimum: -3
-y <int> (property: y) The Y position of the dialog (>=0: absolute, -1: top, -2: center, -3: bottom ). default: -1 minimum: -3
-update-interval <int> (property: updateInterval) The wait period in milli-seconds before the stopwatch display is being updated. default: 500 minimum: 10
-prefix <java.lang.String> (property: prefix) The prefix text for the time display. default:
-suffix <java.lang.String> (property: suffix) The suffix text for the time display. default:
-show-seconds (property: showSeconds) If enabled, the seconds are displayed in the stopwatch output as well.
-font <java.awt.Font> (property: font) The font to use for displaying the time. default: monospaced-PLAIN-16
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStopwatch.StopwatchPanelPanel for displaying a stopwatch.static classStopwatch.TimerTimer thread class.
-
Field Summary
Fields Modifier and Type Field Description protected Fontm_Fontthe font for the display.protected Stringm_Prefixthe text to prefix the time.protected booleanm_ShowSecondswhether to show the seconds as well.protected Stringm_Suffixthe text to suffix the time.protected intm_UpdateIntervalthe update interval in msec.-
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 Stopwatch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearPanel()Clears the content of the panel.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.StringfontTipText()Returns the tip text for this property.protected intgetDefaultHeight()Returns the default height for the dialog.protected intgetDefaultWidth()Returns the default width for the dialog.protected intgetDefaultX()Returns the default X position for the dialog.FontgetFont()Returns the font for the time display.StringgetPrefix()Returns the prefix for the time display.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.booleangetShowSeconds()Returns whether to display seconds as well.StringgetSuffix()Returns the suffix for the time display.intgetUpdateInterval()Returns the wait period before updating the display.StringglobalInfo()Returns a string describing the object.protected RunnablenewDisplayRunnable()Returns a runnable that displays frame, etc.protected BasePanelnewPanel()Creates the panel to display in the dialog.StringprefixTipText()Returns the tip text for this property.voidsetFont(Font value)Sets the font for the time display.voidsetPrefix(String value)Sets the prefix for the time display.voidsetShowSeconds(boolean value)Sets whether to display seconds as well.voidsetSuffix(String value)Sets the suffix for the time display.voidsetUpdateInterval(int value)Sets the wait period before the display is updated.StringshowSecondsTipText()Returns the tip text for this property.voidstopExecution()Stops the execution.StringsuffixTipText()Returns the tip text for this property.StringupdateIntervalTipText()Returns the tip text for this property.voidwrapUp()Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractDisplay
backupState, cleanUp, cleanUpGUI, cleanUpGUIKeepOpen, closeDisplay, createFrame, createTitle, currentInput, deregisterInWrapUp, deregisterWindow, deregisterWithEditor, displayTypeTipText, doCreateFrame, doExecuteHeadless, getCreateFrame, getDefaultDisplayType, getDefaultShortTitle, getDefaultY, getDisplayType, getFrame, getFrameDefaultCloseOperation, getHeight, getKeepOpen, getPanel, getShortTitle, getWidth, getX, getY, hasInput, heightTipText, initialize, 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, 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, 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
-
m_UpdateInterval
protected int m_UpdateInterval
the update interval in msec.
-
m_Prefix
protected String m_Prefix
the text to prefix the time.
-
m_Suffix
protected String m_Suffix
the text to suffix the time.
-
m_ShowSeconds
protected boolean m_ShowSeconds
whether to show the seconds as well.
-
m_Font
protected Font m_Font
the font for the display.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractDisplay
-
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 classAbstractDisplay- Returns:
- null if no info available, otherwise short string
-
getDefaultX
protected int getDefaultX()
Returns the default X position for the dialog.- Overrides:
getDefaultXin classAbstractDisplay- Returns:
- the default X position
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Overrides:
getDefaultWidthin classAbstractDisplay- Returns:
- the default width
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Overrides:
getDefaultHeightin classAbstractDisplay- Returns:
- the default height
-
setPrefix
public void setPrefix(String value)
Sets the prefix for the time display.- Parameters:
value- the prefix string
-
getPrefix
public String getPrefix()
Returns the prefix for the time display.- Returns:
- the prefix string
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSuffix
public void setSuffix(String value)
Sets the suffix for the time display.- Parameters:
value- the suffix string
-
getSuffix
public String getSuffix()
Returns the suffix for the time display.- Returns:
- the suffix string
-
suffixTipText
public String suffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowSeconds
public void setShowSeconds(boolean value)
Sets whether to display seconds as well.- Parameters:
value- if true then seconds are displayed as well
-
getShowSeconds
public boolean getShowSeconds()
Returns whether to display seconds as well.- Returns:
- true if seconds are displayed as well
-
showSecondsTipText
public String showSecondsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUpdateInterval
public void setUpdateInterval(int value)
Sets the wait period before the display is updated.- Parameters:
value- interval in msecs
-
getUpdateInterval
public int getUpdateInterval()
Returns the wait period before updating the display.- Returns:
- interval in msecs
-
updateIntervalTipText
public String updateIntervalTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFont
public void setFont(Font value)
Sets the font for the time display.- Parameters:
value- the font
-
getFont
public Font getFont()
Returns the font for the time display.- Returns:
- the font
-
fontTipText
public String fontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
clearPanel
public void clearPanel()
Clears the content of the panel.- Specified by:
clearPanelin classAbstractDisplay
-
newPanel
protected 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
-
doExecute
protected String doExecute()
Executes the flow item.- Overrides:
doExecutein classAbstractDisplay- Returns:
- null if everything is fine, otherwise error message
-
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. Graphical output is left untouched.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractDisplay
-
-