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
    • 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_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.
    • Constructor Detail

      • ProgressBar

        public ProgressBar()
    • Method Detail

      • getDefaultX

        protected int getDefaultX()
        Returns the default X position for the dialog.
        Overrides:
        getDefaultX in class AbstractDisplay
        Returns:
        the default X position
      • getDefaultWidth

        protected int getDefaultWidth()
        Returns the default width for the dialog.
        Overrides:
        getDefaultWidth in class AbstractDisplay
        Returns:
        the default width
      • getDefaultHeight

        protected int getDefaultHeight()
        Returns the default height for the dialog.
        Overrides:
        getDefaultHeight in class AbstractDisplay
        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.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Returns:
        the Class of objects that can be processed
      • display

        protected void display​(Token token)
        Displays the token (the panel and dialog have already been created at this stage).
        Specified by:
        display in class AbstractDisplay
        Parameters:
        token - the token to display
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Overrides:
        doExecute in class AbstractDisplay
        Returns:
        null if everything is fine, otherwise error message