Class WDoubleSpinBox


public class WDoubleSpinBox
extends WAbstractSpinBox
An input control for fixed point numbers.

The spin box provides a control for entering a fixed point number. It consists of a line edit, and buttons which allow to increase or decrease the value. If you rather need input of an integer number number, use WSpinBox instead.

WDoubleSpinBox is an inline widget.

See Also:
Note: A spinbox configures a validator for validating the input. Therefore you cannot set a validator yourself.
  • Constructor Details

    • WDoubleSpinBox

      public WDoubleSpinBox​(WContainerWidget parent)
      Creates a spin-box.

      The range is (0.0 - 99.99), the step size 1.0, and the spin box has a precision of 2 decimals.

      The initial value is 0.0.

    • WDoubleSpinBox

      public WDoubleSpinBox()
      Creates a spin-box.

      Calls this((WContainerWidget)null)

  • Method Details

    • setMinimum

      public void setMinimum​(double minimum)
      Sets the minimum value.

      The default value is 0.0.

    • getMinimum

      public double getMinimum()
      Returns the minimum value.

      See Also:
      setMinimum(double minimum)
    • setMaximum

      public void setMaximum​(double maximum)
      Sets the maximum value.

      The default value is 99.99.

    • getMaximum

      public double getMaximum()
      Returns the maximum value.

      See Also:
      setMaximum(double maximum)
    • setRange

      public void setRange​(double minimum, double maximum)
      Sets the range.

      See Also:
      setMinimum(double minimum), setMaximum(double maximum)
    • setSingleStep

      public void setSingleStep​(double step)
      Sets the step value.

      The default value is 1.0.

    • getSingleStep

      public double getSingleStep()
      Returns the step value.

      See Also:
      setSingleStep(double step)
    • setDecimals

      public void setDecimals​(int decimals)
      Sets the precision.

      This sets the number of digits after the decimal point shown

      The default precision is 2.

    • setValue

      public void setValue​(double value)
      Sets the value.

      value must be a value between getMinimum() and getMaximum().

      The default value is 0

    • getValue

      public double getValue()
      Returns the value.

      Note: This value may not correctly reflect the WLineEdit.getValueText() of the spin box if WLineEdit.getValueText() is empty or if the contents are not in a valid state.

    • valueChanged

      public Signal1<java.lang.Double> valueChanged()
      A signal that indicates when the value has changed.

      This signal is emitted when WFormWidget.changed() is emitted, but supplies the new value as an argument. The WFormWidget.changed() signal is emitted when the user changes the value of the spinbox by pressing the up/down arrow, or entering a different value and pressing enter or moving focus.

      See Also:
      WFormWidget.changed()
    • refresh

      public void refresh()
      Description copied from class: WWidget
      Refresh the widget.

      The refresh method is invoked when the locale is changed using WApplication#setLocale() or when the user hit the refresh button.

      The widget must actualize its contents in response.

      Note: This does *not* rerender the widget! Calling refresh() usually does not have any effect (unless you've reimplemented refresh() to attach to it an effect).

      Overrides:
      refresh in class WAbstractSpinBox
    • render

      protected void render​(java.util.EnumSet<RenderFlag> flags)
      Description copied from class: WWidget
      Renders the widget.

      This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

      The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

      Overrides:
      render in class WAbstractSpinBox
    • getTextFromValue

      protected java.lang.String getTextFromValue()
      Specified by:
      getTextFromValue in class WAbstractSpinBox
    • getValidateRange

      protected WValidator.Result getValidateRange()
      Specified by:
      getValidateRange in class WAbstractSpinBox