Package swingtree

Class UIForProgressBar<P extends JProgressBar>


public final class UIForProgressBar<P extends JProgressBar> extends UIForAnySwing<UIForProgressBar<P>,P>
A SwingTree builder node designed for configuring JProgressBar instances.
  • Method Details

    • _state

      protected swingtree.BuilderState<P> _state()
      Description copied from class: UIForAnything
      Returns the state of the builder, which is a container for the wrapped component as well as it's type and current EventProcessor.
      Specified by:
      _state in class UIForAnything<UIForProgressBar<P extends JProgressBar>,P extends JProgressBar,JComponent>
      Returns:
      The state of the builder.
    • _newBuilderWithState

      protected UIForProgressBar<P> _newBuilderWithState(swingtree.BuilderState<P> newState)
      Description copied from class: UIForAnything
      An internal wither method which creates a new builder instance with the provided BuilderState stored inside it.
      Specified by:
      _newBuilderWithState in class UIForAnything<UIForProgressBar<P extends JProgressBar>,P extends JProgressBar,JComponent>
      Parameters:
      newState - The new state which should be stored inside the new builder instance.
      Returns:
      A new builder instance with the provided state stored inside it.
    • withOrientation

      public final UIForProgressBar<P> withOrientation(UI.Align align)
      Sets a fixed orientation for the slider using the UI.Align enum.
      Parameters:
      align - The orientation constant of the slider.
      Returns:
      This builder node.
    • withOrientation

      public final UIForProgressBar<P> withOrientation(sprouts.Val<UI.Align> align)
      Models the orientation of the slider using a Val property which allows for dynamic updates to the orientation of the slider. So when the value of the property changes, the orientation of the slider will be updated accordingly.
      Parameters:
      align - The orientation of the slider.
      Returns:
      This builder node.
    • withMin

      public final UIForProgressBar<P> withMin(int min)
      Sets the minimum value of the slider. For more information see JProgressBar.setMinimum(int).
      Parameters:
      min - The minimum value of the slider.
      Returns:
      This very instance, which enables builder-style method chaining.
    • withMin

      public final UIForProgressBar<P> withMin(sprouts.Val<Integer> min)
      Models the minimum value of the slider using a Val property which allows for dynamic updates to the min value of the slider. So when the value of the property changes, the min value of the slider will be updated accordingly.
      Parameters:
      min - The min property used to dynamically update the min value of the slider.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if min is null.
    • withMax

      public final UIForProgressBar<P> withMax(int max)
      Sets the maximum value of the progress bar. For more information see JProgressBar.setMaximum(int) (int)}.
      Parameters:
      max - The maximum value of the progress bar.
      Returns:
      This very instance, which enables builder-style method chaining.
    • withMax

      public final UIForProgressBar<P> withMax(sprouts.Val<Integer> max)
      Models the maximum value of the progress bar using a Val property so that when the value of the property changes, the max value of the progress bar will be updated accordingly. For more information see JProgressBar.setMaximum(int).
      Parameters:
      max - An integer property used to dynamically update the max value of the progress bar.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if max is null.
    • withValue

      public final UIForProgressBar<P> withValue(int value)
      Sets the value of the progress bar through the JProgressBar.setValue(int) method of the underlying JProgressBar type.
      Parameters:
      value - The value to set for this JProgressBar.
      Returns:
      This very instance, which enables builder-style method chaining.
    • withProgress

      public final UIForProgressBar<P> withProgress(double progress)
      Use this to specify the current progress value in terms of a double value between 0 and 1, where 0 represents 0% progress and 1 represents 100% progress. Note that the actual value of the progress bar will be calculated based on the min and max values currently specified for the progress bar.
      Parameters:
      progress - The progress value, a number between 0 and 1, to set for this JProgressBar. Note that this will be converted to an integer value between the min and max values.
      Returns:
      This very instance, which enables builder-style method chaining.
    • withValue

      public final UIForProgressBar<P> withValue(sprouts.Val<Integer> val)
      Allows you to model the progress of the progress bar in terms of an integer based property which will update the progress bar value whenever it is changed, typically in your view model or controller.
      Parameters:
      val - An integer property used to dynamically update the value of the progress bar.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if value is null.
    • withProgress

      public final UIForProgressBar<P> withProgress(sprouts.Val<Double> progress)
      Allows you to model the progress of the progress bar in terms of a double value between 0 and 1 using a Val property. When the value of the property changes, the progress bar will be updated accordingly.
      The progress value will be converted to an integer value between the min and max values.
      Parameters:
      progress - A double property used to dynamically update the value of the progress bar.
      Returns:
      This very instance, which enables builder-style method chaining.
      Throws:
      IllegalArgumentException - if value is null.