Package adams.flow.sink
Class ProgressBar
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,VariableChangeListener,Actor,ClearableDisplay,DisplayTypeSupporter,ErrorHandler,FlowControlSubMenuSupporter,HeadlessExecutionSupporter,InputConsumer,ComponentSupplier,MenuBarProvider,SendToActionSupporter,Serializable,Comparable
public class ProgressBar extends AbstractGraphicalDisplay
Displays a progress bar. The incoming token is used as 'current' value to be displayed. For convenience, the incoming token representing a number can also be in string format.
Input/output:
- accepts:
java.lang.Number
java.lang.String
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: ProgressBar
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-short-title <boolean> (property: shortTitle) If enabled uses just the name for the title instead of the actor's full name. default: false
-display-type <adams.flow.core.displaytype.AbstractDisplayType> (property: displayType) Determines how to show the display, eg as standalone frame (default) or in the Flow editor window. default: adams.flow.core.displaytype.Default
-width <int> (property: width) The width of the dialog. default: 200 minimum: -1
-height <int> (property: height) The height of the dialog. default: 100 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
-writer <adams.gui.print.JComponentWriter> (property: writer) The writer to use for generating the graphics output. default: adams.gui.print.NullWriter
-min <double> (property: minimum) The minimum to use. default: 0.0
-max <double> (property: maximum) The maximum to use. default: 100.0
-bar <java.awt.Color> (property: bar) The bar color to use. default: #0000ff
-background <java.awt.Color> (property: background) The background color to use. default: #c0c0c0
-foreground <java.awt.Color> (property: foreground) The foreground color to use. default: #ffffff
-prefix <java.lang.String> (property: prefix) The prefix string to print before the percentage. default:
-format <adams.data.DecimalFormatString> (property: format) The format string to use for outputting the current value, use empty string to suppress output. default: #.#%
-suffix <java.lang.String> (property: suffix) The suffix string to print before the percentage. default:
-font <java.awt.Font> (property: font) The font to use for the current value. default: helvetica-BOLD-16
-title <java.lang.String> (property: title) The optional title for the progressbar. default:
-title-font <java.awt.Font> (property: titleFont) The font to use for the title. default: helvetica-PLAIN-12
-show-stop-button <boolean> (property: showStopButton) If enabled, a button to stop the flow is shown as well. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProgressBar.ProgressBarPanelPanel for displaying a progress bar.
-
Field Summary
Fields Modifier and Type Field Description protected Colorm_Backgroundthe background color.protected Colorm_Barthe color of the bar.protected Fontm_Fontthe font to use.protected Colorm_Foregroundthe foreground color.protected DecimalFormatStringm_Formatthe format of the current value.protected Stringm_LastOutputthe last string that was output.protected doublem_Maximumthe maximum of the progress bar.protected doublem_Minimumthe minimum of the progress bar.protected ProgressBar.ProgressBarPanelm_PanelProgressthe progress bar.protected Stringm_Prefixthe prefix.protected booleanm_ShowStopButtonwhether to display a stop button.protected Stringm_Suffixthe suffix.protected Stringm_Titlethe title.protected Fontm_TitleFontthe font to use for the title.-
Fields inherited from class adams.flow.sink.AbstractGraphicalDisplay
m_GraphicFileChooser, m_MenuBar, m_MenuItemFileClear, m_MenuItemFileClose, m_MenuItemFileSaveAs, m_MenuItemFileSaveTextAs, m_MenuItemFlowPauseResume, m_MenuItemFlowStop, m_ShowFlowControlSubMenu, m_TextFileChooser, m_Writer
-
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 ProgressBar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the class that the consumer accepts.StringbackgroundTipText()Returns the tip text for this property.StringbarTipText()Returns the tip text for this property.voidclearPanel()Clears the content of the panel.voiddefineOptions()Adds options to the internal list of options.protected voiddisplay(Token token)Displays the token (the panel and dialog have already been created at this stage).protected StringdoExecuteHeadless()Executes the flow item in headless mode.StringfontTipText()Returns the tip text for this property.StringforegroundTipText()Returns the tip text for this property.StringformatTipText()Returns the tip text for this property.ColorgetBackground()Returns the background color.ColorgetBar()Returns the bar color.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 percentage display.ColorgetForeground()Returns the foreground color.DecimalFormatStringgetFormat()Returns the format string for the current value.doublegetMaximum()Returns the maximum.doublegetMinimum()Returns the minimum.StringgetPrefix()Returns the prefix string.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.booleangetShowStopButton()Returns whether to show a stop button.StringgetSuffix()Returns the suffix string.StringgetTitle()Returns the optional title string.FontgetTitleFont()Returns the font for the title.StringglobalInfo()Returns a string describing the object.StringmaximumTipText()Returns the tip text for this property.StringminimumTipText()Returns the tip text for this property.protected BasePanelnewPanel()Creates the panel to display in the dialog.StringprefixTipText()Returns the tip text for this property.protected voidreset()Resets the scheme.voidsetBackground(Color value)Sets the background color.voidsetBar(Color value)Sets the bar color.voidsetFont(Font value)Sets the font for the percentage display.voidsetForeground(Color value)Sets the foreground color.voidsetFormat(DecimalFormatString value)Sets the format string for the current value.voidsetMaximum(double value)Sets the maximum.voidsetMinimum(double value)Sets the minimum.voidsetPrefix(String value)Sets the prefix string.voidsetShowStopButton(boolean value)Sets whether to show a stop button.voidsetSuffix(String value)Sets the suffix string.voidsetTitle(String value)Sets the optional title string.voidsetTitleFont(Font value)Sets the font for the title.StringshowStopButtonTipText()Returns the tip text for this property.StringsuffixTipText()Returns the tip text for this property.booleansupportsHeadlessExecution()Returns whether headless execution is supported.StringtitleFontTipText()Returns the tip text for this property.StringtitleTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.sink.AbstractGraphicalDisplay
canPauseOrResume, cleanUpGUI, clear, close, createMenuBar, getGraphicFileChooser, getMenuBar, getSendToClasses, getSendToItem, getShowFlowControlSubMenu, getTextFileChooser, getWriter, hasPanel, hasSendToItem, isPaused, pauseResumeFlow, saveAs, saveTextAs, setShowFlowControlSubMenu, setWriter, showFlowControlSubMenuTipText, stopFlow, supplyComponent, supportsClear, updateMenu, wrapUp, writerTipText
-
Methods inherited from class adams.flow.sink.AbstractDisplay
newDisplayRunnable, postDisplay, preDisplay
-
Methods inherited from class adams.flow.core.AbstractDisplay
backupState, cleanUp, cleanUpGUIKeepOpen, closeDisplay, createFrame, createTitle, currentInput, deregisterInWrapUp, deregisterWindow, deregisterWithEditor, displayTypeTipText, doCreateFrame, doExecute, getCreateFrame, getDefaultDisplayType, getDefaultShortTitle, getDefaultY, getDisplayType, getFrame, getFrameDefaultCloseOperation, getHeight, getKeepOpen, getPanel, getShortTitle, getWidth, getX, getY, hasInput, heightTipText, initialize, input, postCreateFrame, preCreateFrame, registerWindow, registerWithEditor, restoreState, setCreateFrame, setDisplayType, setHeight, setKeepOpen, setShortTitle, setWidth, setX, setY, shortTitleTipText, stopExecution, 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
cleanUp, 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, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.flow.core.InputConsumer
currentInput, hasInput, input
-
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_Minimum
protected double m_Minimum
the minimum of the progress bar.
-
m_Maximum
protected double m_Maximum
the maximum of the progress bar.
-
m_Bar
protected Color m_Bar
the color of the bar.
-
m_Background
protected Color m_Background
the background color.
-
m_Foreground
protected Color m_Foreground
the foreground color.
-
m_Font
protected Font m_Font
the font to use.
-
m_Prefix
protected String m_Prefix
the prefix.
-
m_Format
protected transient DecimalFormatString m_Format
the format of the current value.
-
m_Suffix
protected String m_Suffix
the suffix.
-
m_Title
protected String m_Title
the title.
-
m_TitleFont
protected Font m_TitleFont
the font to use for the title.
-
m_ShowStopButton
protected boolean m_ShowStopButton
whether to display a stop button.
-
m_PanelProgress
protected ProgressBar.ProgressBarPanel m_PanelProgress
the progress bar.
-
m_LastOutput
protected transient String m_LastOutput
the last string that was output.
-
-
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 classAbstractGraphicalDisplay
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classAbstractDisplay
-
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
-
setMinimum
public void setMinimum(double value)
Sets the minimum.- Parameters:
value- the minimum
-
getMinimum
public double getMinimum()
Returns the minimum.- Returns:
- the minimum
-
minimumTipText
public String minimumTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaximum
public void setMaximum(double value)
Sets the maximum.- Parameters:
value- the maximum
-
getMaximum
public double getMaximum()
Returns the maximum.- Returns:
- the maximum
-
maximumTipText
public String maximumTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBar
public void setBar(Color value)
Sets the bar color.- Parameters:
value- the color
-
getBar
public Color getBar()
Returns the bar color.- Returns:
- the color
-
barTipText
public String barTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBackground
public void setBackground(Color value)
Sets the background color.- Parameters:
value- the color
-
getBackground
public Color getBackground()
Returns the background color.- Returns:
- the color
-
backgroundTipText
public String backgroundTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setForeground
public void setForeground(Color value)
Sets the foreground color.- Parameters:
value- the color
-
getForeground
public Color getForeground()
Returns the foreground color.- Returns:
- the color
-
foregroundTipText
public String foregroundTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrefix
public void setPrefix(String value)
Sets the prefix string.- Parameters:
value- the prefix
-
getPrefix
public String getPrefix()
Returns the prefix string.- Returns:
- the prefix
-
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.
-
setFormat
public void setFormat(DecimalFormatString value)
Sets the format string for the current value.- Parameters:
value- the format, empty string to suppress output
-
getFormat
public DecimalFormatString getFormat()
Returns the format string for the current value.- Returns:
- the format, empty string is suppressing output
-
formatTipText
public String formatTipText()
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 string.- Parameters:
value- the suffix
-
getSuffix
public String getSuffix()
Returns the suffix string.- Returns:
- the suffix
-
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.
-
setFont
public void setFont(Font value)
Sets the font for the percentage display.- Parameters:
value- the font
-
getFont
public Font getFont()
Returns the font for the percentage 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.
-
setTitle
public void setTitle(String value)
Sets the optional title string.- Parameters:
value- the title
-
getTitle
public String getTitle()
Returns the optional title string.- Returns:
- the title
-
titleTipText
public String titleTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTitleFont
public void setTitleFont(Font value)
Sets the font for the title.- Parameters:
value- the font
-
getTitleFont
public Font getTitleFont()
Returns the font for the title.- Returns:
- the font
-
titleFontTipText
public String titleFontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowStopButton
public void setShowStopButton(boolean value)
Sets whether to show a stop button.- Parameters:
value- true if to show
-
getShowStopButton
public boolean getShowStopButton()
Returns whether to show a stop button.- Returns:
- true if to show
-
showStopButtonTipText
public String showStopButtonTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
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
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Returns:
- the Class of objects that can be processed
-
newPanel
protected BasePanel newPanel()
Creates the panel to display in the dialog.- Specified by:
newPanelin classAbstractDisplay- Returns:
- the panel
-
clearPanel
public void clearPanel()
Clears the content of the panel.- Specified by:
clearPanelin classAbstractDisplay
-
display
protected void display(Token token)
Displays the token (the panel and dialog have already been created at this stage).- Specified by:
displayin classAbstractDisplay- Parameters:
token- the token to display
-
supportsHeadlessExecution
public boolean supportsHeadlessExecution()
Returns whether headless execution is supported.- Specified by:
supportsHeadlessExecutionin interfaceHeadlessExecutionSupporter- Overrides:
supportsHeadlessExecutionin classAbstractDisplay- Returns:
- true if supported
-
doExecuteHeadless
protected String doExecuteHeadless()
Executes the flow item in headless mode.- Overrides:
doExecuteHeadlessin classAbstractDisplay- Returns:
- null if everything is fine, otherwise error message
-
-