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
,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 class
ProgressBar.ProgressBarPanel
Panel for displaying a progress bar.
-
Field Summary
Fields Modifier and Type Field Description protected Color
m_Background
the background color.protected Color
m_Bar
the color of the bar.protected Font
m_Font
the font to use.protected Color
m_Foreground
the foreground color.protected DecimalFormatString
m_Format
the format of the current value.protected double
m_Maximum
the maximum of the progress bar.protected double
m_Minimum
the minimum of the progress bar.protected ProgressBar.ProgressBarPanel
m_PanelProgress
the progress bar.protected String
m_Prefix
the prefix.protected boolean
m_ShowStopButton
whether to display a stop button.protected String
m_Suffix
the suffix.protected String
m_Title
the title.protected Font
m_TitleFont
the 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_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.String
backgroundTipText()
Returns the tip text for this property.String
barTipText()
Returns the tip text for this property.void
clearPanel()
Clears the content of the panel.void
defineOptions()
Adds options to the internal list of options.protected void
display(Token token)
Displays the token (the panel and dialog have already been created at this stage).protected String
doExecute()
Executes the flow item.String
fontTipText()
Returns the tip text for this property.String
foregroundTipText()
Returns the tip text for this property.String
formatTipText()
Returns the tip text for this property.Color
getBackground()
Returns the background color.Color
getBar()
Returns the bar color.protected int
getDefaultHeight()
Returns the default height for the dialog.protected int
getDefaultWidth()
Returns the default width for the dialog.protected int
getDefaultX()
Returns the default X position for the dialog.Font
getFont()
Returns the font for the percentage display.Color
getForeground()
Returns the foreground color.DecimalFormatString
getFormat()
Returns the format string for the current value.double
getMaximum()
Returns the maximum.double
getMinimum()
Returns the minimum.String
getPrefix()
Returns the prefix string.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.boolean
getShowStopButton()
Returns whether to show a stop button.String
getSuffix()
Returns the suffix string.String
getTitle()
Returns the optional title string.Font
getTitleFont()
Returns the font for the title.String
globalInfo()
Returns a string describing the object.String
maximumTipText()
Returns the tip text for this property.String
minimumTipText()
Returns the tip text for this property.protected BasePanel
newPanel()
Creates the panel to display in the dialog.String
prefixTipText()
Returns the tip text for this property.void
setBackground(Color value)
Sets the background color.void
setBar(Color value)
Sets the bar color.void
setFont(Font value)
Sets the font for the percentage display.void
setForeground(Color value)
Sets the foreground color.void
setFormat(DecimalFormatString value)
Sets the format string for the current value.void
setMaximum(double value)
Sets the maximum.void
setMinimum(double value)
Sets the minimum.void
setPrefix(String value)
Sets the prefix string.void
setShowStopButton(boolean value)
Sets whether to show a stop button.void
setSuffix(String value)
Sets the suffix string.void
setTitle(String value)
Sets the optional title string.void
setTitleFont(Font value)
Sets the font for the title.String
showStopButtonTipText()
Returns the tip text for this property.String
suffixTipText()
Returns the tip text for this property.String
titleFontTipText()
Returns the tip text for this property.String
titleTipText()
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, closeFrame, createFrame, createTitle, currentInput, deregisterInWrapUp, deregisterWindow, deregisterWithEditor, displayTypeTipText, doCreateFrame, 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, 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 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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractGraphicalDisplay
-
getDefaultX
protected int getDefaultX()
Returns the default X position for the dialog.- Overrides:
getDefaultX
in classAbstractDisplay
- Returns:
- the default X position
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Overrides:
getDefaultWidth
in classAbstractDisplay
- Returns:
- the default width
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Overrides:
getDefaultHeight
in 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:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in 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:
newPanel
in classAbstractDisplay
- Returns:
- the panel
-
clearPanel
public void clearPanel()
Clears the content of the panel.- Specified by:
clearPanel
in classAbstractDisplay
-
display
protected void display(Token token)
Displays the token (the panel and dialog have already been created at this stage).- Specified by:
display
in classAbstractDisplay
- Parameters:
token
- the token to display
-
doExecute
protected String doExecute()
Executes the flow item.- Overrides:
doExecute
in classAbstractDisplay
- Returns:
- null if everything is fine, otherwise error message
-
-