Class DecimalRangeSlider

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<DecimalRangeSlider,DecimalRangeSliderValue>
com.vaadin.flow.component.AbstractSinglePropertyField<DecimalRangeSlider,DecimalRangeSliderValue>
com.vaadin.flow.component.slider.DecimalRangeSlider
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<DecimalRangeSlider>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<DecimalRangeSlider>, com.vaadin.flow.component.FocusNotifier<DecimalRangeSlider>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DecimalRangeSlider,DecimalRangeSliderValue>,DecimalRangeSliderValue>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DecimalRangeSlider,DecimalRangeSliderValue>,DecimalRangeSliderValue>, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<DecimalRangeSlider,DecimalRangeSliderValue>,DecimalRangeSliderValue>, com.vaadin.flow.data.value.HasValueChangeMode, Serializable

@Tag("vaadin-range-slider") @NpmPackage(value="@vaadin/slider", version="25.2.0-alpha9") @JsModule("@vaadin/slider/src/vaadin-range-slider.js") public class DecimalRangeSlider extends com.vaadin.flow.component.AbstractSinglePropertyField<DecimalRangeSlider,DecimalRangeSliderValue>
DecimalRangeSlider is an input field that allows the user to select a decimal range within bounds by dragging two thumbs along a track or using arrow keys for precise input.

DecimalRangeSlider uses Double as the value type for its start and end values, see IntegerRangeSlider for a version of the component that supports integer values.

Author:
Vaadin Ltd.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField

    com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue

    com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
  • Field Summary

    Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode

    DEFAULT_CHANGE_TIMEOUT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a DecimalRangeSlider with min 0 and max 100.
    DecimalRangeSlider(double min, double max)
    Constructs a DecimalRangeSlider with the given min and max.
    Constructs a DecimalRangeSlider with the given label, min 0, and max 100.
    DecimalRangeSlider(String label, double min, double max)
    Constructs a DecimalRangeSlider with the given label, min and max.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.dom.SignalBinding<Double>
    bindMax(com.vaadin.flow.signals.Signal<Double> signal)
    Binds the given signal to the maximum value of the slider as a one-way binding so that the property is updated when the signal's value is updated.
    com.vaadin.flow.dom.SignalBinding<Double>
    bindMin(com.vaadin.flow.signals.Signal<Double> signal)
    Binds the given signal to the minimum value of the slider as a one-way binding so that the property is updated when the signal's value is updated.
    com.vaadin.flow.dom.SignalBinding<Double>
    bindStep(com.vaadin.flow.signals.Signal<Double> signal)
    Binds the given signal to the step value of the slider as a one-way binding so that the property is updated when the signal's value is updated.
    void
    Clears the slider value, setting it to the full range from minimum to maximum.
    Gets the accessible name for the end range input element of the slider.
    Gets the accessible name for the start range input element of the slider.
    Gets the maximum value of the slider.
    Gets the minimum value of the slider.
    Gets the step value of the slider.
    com.vaadin.flow.data.value.ValueChangeMode
    int
     
    protected boolean
     
    boolean
    Gets whether the min and max values are displayed below the slider track.
    protected boolean
     
    boolean
    Gets whether the value bubble is always visible, regardless of focus or hover state.
    protected boolean
     
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    void
    setAccessibleNameEnd(String accessibleName)
    Sets an accessible name for the end range input element of the slider.
    void
    Sets an accessible name for the start range input element of the slider.
    void
    Sets the maximum value of the slider.
    void
    Sets the minimum value of the slider.
    void
    setMinMaxVisible(boolean minMaxVisible)
    Sets whether the min and max values are displayed below the slider track.
    void
    Sets the step value of the slider.
    void
     
    void
    setValueAlwaysVisible(boolean valueAlwaysVisible)
    Sets whether the value bubble is always visible, regardless of focus or hover state.
    void
    setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
     
    void
    setValueChangeTimeout(int valueChangeTimeout)
     

    Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField

    getSynchronizationRegistration, setPresentationValue, setSynchronizedEvent

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, bindValue, getEmptyValue, getValue, isEmpty, setModelValue, valueEquals

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasHelper

    bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperText

    Methods inherited from interface com.vaadin.flow.component.HasLabel

    getLabel, setLabel

    Methods inherited from interface com.vaadin.flow.component.HasSize

    bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    getTooltip, setTooltipMarkdown, setTooltipText

    Methods inherited from interface com.vaadin.flow.component.HasValidation

    setManualValidation

    Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties

    getErrorMessage, isInvalid, setErrorMessage, setInvalid

    Methods inherited from interface com.vaadin.flow.component.HasValue

    addValueChangeListener, bindValue, getEmptyValue, getOptionalValue, getValue, isEmpty

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible

    Methods inherited from interface com.vaadin.flow.component.KeyNotifier

    addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
  • Constructor Details

    • DecimalRangeSlider

      public DecimalRangeSlider()
      Constructs a DecimalRangeSlider with min 0 and max 100. The initial value is [0, 100].

      The step defaults to 1.

    • DecimalRangeSlider

      public DecimalRangeSlider(double min, double max)
      Constructs a DecimalRangeSlider with the given min and max. The initial value is set to [min, max].

      The step defaults to 1.

      Parameters:
      min - the minimum value
      max - the maximum value
    • DecimalRangeSlider

      public DecimalRangeSlider(String label)
      Constructs a DecimalRangeSlider with the given label, min 0, and max 100. The initial value is [0, 100].

      The step defaults to 1.

      Parameters:
      label - the text to set as the label
    • DecimalRangeSlider

      public DecimalRangeSlider(String label, double min, double max)
      Constructs a DecimalRangeSlider with the given label, min and max. The initial value is set to [min, max].

      The step defaults to 1.

      Parameters:
      label - the text to set as the label
      min - the minimum value
      max - the maximum value
  • Method Details

    • setAccessibleNameStart

      public void setAccessibleNameStart(String accessibleName)
      Sets an accessible name for the start range input element of the slider.
      Parameters:
      accessibleName - the accessible name to set, or null to remove it
    • getAccessibleNameStart

      public Optional<String> getAccessibleNameStart()
      Gets the accessible name for the start range input element of the slider.
      Returns:
      an optional accessible name, or an empty optional if no accessible name has been set
    • setAccessibleNameEnd

      public void setAccessibleNameEnd(String accessibleName)
      Sets an accessible name for the end range input element of the slider.
      Parameters:
      accessibleName - the accessible name to set, or null to remove it
    • getAccessibleNameEnd

      public Optional<String> getAccessibleNameEnd()
      Gets the accessible name for the end range input element of the slider.
      Returns:
      an optional accessible name, or an empty optional if no accessible name has been set
    • clear

      public void clear()
      Clears the slider value, setting it to the full range from minimum to maximum.
      See Also:
    • isValueWithinMinMax

      protected boolean isValueWithinMinMax(DecimalRangeSliderValue value)
    • isValueAlignedWithStep

      protected boolean isValueAlignedWithStep(DecimalRangeSliderValue value)
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • getMin

      public Double getMin()
      Gets the minimum value of the slider.
      Returns:
      the minimum value
    • setMin

      public void setMin(Double min)
      Sets the minimum value of the slider.
      Parameters:
      min - the minimum value
    • getMax

      public Double getMax()
      Gets the maximum value of the slider.
      Returns:
      the maximum value
    • setMax

      public void setMax(Double max)
      Sets the maximum value of the slider.
      Parameters:
      max - the maximum value
    • getStep

      public Double getStep()
      Gets the step value of the slider.

      Valid slider values are calculated relative to the minimum value: min, min + step, min + 2*step, etc.

      Returns:
      the step value
    • setStep

      public void setStep(Double step)
      Sets the step value of the slider.

      Valid slider values are calculated relative to the minimum value: min, min + step, min + 2*step, etc.

      Parameters:
      step - the step value
    • bindMin

      public com.vaadin.flow.dom.SignalBinding<Double> bindMin(com.vaadin.flow.signals.Signal<Double> signal)
      Binds the given signal to the minimum value of the slider as a one-way binding so that the property is updated when the signal's value is updated.

      The minimum value is set immediately with the current signal value when the binding is created, and is kept synchronized with any subsequent signal value changes while the component is in attached state. When the component is in detached state, signal value changes have no effect.

      While a signal is bound, any attempt to set the minimum value manually through the setter throws a BindingActiveException.

      Parameters:
      signal - the signal to bind the minimum value to, not null
      Returns:
      a SignalBinding that can be used to register onChange callbacks
      Since:
      25.1
      See Also:
      • Element.bindProperty(String, Signal, SerializableConsumer)
    • bindMax

      public com.vaadin.flow.dom.SignalBinding<Double> bindMax(com.vaadin.flow.signals.Signal<Double> signal)
      Binds the given signal to the maximum value of the slider as a one-way binding so that the property is updated when the signal's value is updated.

      The maximum value is set immediately with the current signal value when the binding is created, and is kept synchronized with any subsequent signal value changes while the component is in attached state. When the component is in detached state, signal value changes have no effect.

      While a signal is bound, any attempt to set the maximum value manually through the setter throws a BindingActiveException.

      Parameters:
      signal - the signal to bind the maximum value to, not null
      Returns:
      a SignalBinding that can be used to register onChange callbacks
      Since:
      25.1
      See Also:
      • Element.bindProperty(String, Signal, SerializableConsumer)
    • bindStep

      public com.vaadin.flow.dom.SignalBinding<Double> bindStep(com.vaadin.flow.signals.Signal<Double> signal)
      Binds the given signal to the step value of the slider as a one-way binding so that the property is updated when the signal's value is updated.

      The step value is set immediately with the current signal value when the binding is created, and is kept synchronized with any subsequent signal value changes while the component is in attached state. When the component is in detached state, signal value changes have no effect.

      While a signal is bound, any attempt to set the step value manually through the setter throws a BindingActiveException.

      Parameters:
      signal - the signal to bind the step value to, not null
      Returns:
      a SignalBinding that can be used to register onChange callbacks
      Since:
      25.1
      See Also:
      • Element.bindProperty(String, Signal, SerializableConsumer)
    • setValueAlwaysVisible

      public void setValueAlwaysVisible(boolean valueAlwaysVisible)
      Sets whether the value bubble is always visible, regardless of focus or hover state. By default, bubble is hidden and only shown on interaction.
      Parameters:
      valueAlwaysVisible - true to always show the value bubble, false otherwise
    • isValueAlwaysVisible

      public boolean isValueAlwaysVisible()
      Gets whether the value bubble is always visible, regardless of focus or hover state. By default, bubble is hidden and only shown on interaction.
      Returns:
      true if the value bubble is always visible, false otherwise
    • setMinMaxVisible

      public void setMinMaxVisible(boolean minMaxVisible)
      Sets whether the min and max values are displayed below the slider track. By default, min and max values are hidden.
      Parameters:
      minMaxVisible - true to display min and max values, false otherwise
    • isMinMaxVisible

      public boolean isMinMaxVisible()
      Gets whether the min and max values are displayed below the slider track. By default, min and max values are hidden.
      Returns:
      true if the min and max values are displayed, false otherwise
    • getValueChangeMode

      public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()

      The default value is ValueChangeMode.ON_CHANGE.

      Specified by:
      getValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeMode
    • setValueChangeMode

      public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
      Specified by:
      setValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeMode
    • setValueChangeTimeout

      public void setValueChangeTimeout(int valueChangeTimeout)
      Specified by:
      setValueChangeTimeout in interface com.vaadin.flow.data.value.HasValueChangeMode
    • getValueChangeTimeout

      public int getValueChangeTimeout()
      Specified by:
      getValueChangeTimeout in interface com.vaadin.flow.data.value.HasValueChangeMode
    • setValue

      public void setValue(DecimalRangeSliderValue value)
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue,TNumber,TPresentation>,TValue>
      Overrides:
      setValue in class com.vaadin.flow.component.AbstractField<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue,TNumber,TPresentation>,TValue>
    • hasValidValue

      protected boolean hasValidValue()
      Overrides:
      hasValidValue in class com.vaadin.flow.component.AbstractSinglePropertyField<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue,TNumber,TPresentation>,TValue>