Class RangeSlider
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<RangeSlider>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<RangeSlider>,com.vaadin.flow.component.FocusNotifier<RangeSlider>,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<RangeSlider,,RangeSliderValue>, RangeSliderValue> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RangeSlider,,RangeSliderValue>, RangeSliderValue> 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<RangeSlider,,RangeSliderValue>, RangeSliderValue> com.vaadin.flow.data.value.HasValueChangeMode,Serializable
- 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
ConstructorsConstructorDescriptionConstructs aRangeSliderwith min 0 and max 100.RangeSlider(double min, double max) Constructs aRangeSliderwith the given min and max.RangeSlider(String label) Constructs aRangeSliderwith the given label, min 0, and max 100.RangeSlider(String label, double min, double max) Constructs aRangeSliderwith the given label, min and max. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.dom.SignalBinding<Double> 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> 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> 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.voidclear()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.doublegetMax()Gets the maximum value of the slider.doublegetMin()Gets the minimum value of the slider.doublegetStep()Gets the step value of the slider.com.vaadin.flow.data.value.ValueChangeModeintprotected booleanbooleanGets whether the min and max values are displayed below the slider track.protected booleanbooleanGets whether the value bubble is always visible, regardless of focus or hover state.protected booleanprotected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) voidsetAccessibleNameEnd(String accessibleName) Sets an accessible name for the end range input element of the slider.voidsetAccessibleNameStart(String accessibleName) Sets an accessible name for the start range input element of the slider.voidsetMax(double max) Sets the maximum value of the slider.voidsetMin(double min) Sets the minimum value of the slider.voidsetMinMaxVisible(boolean minMaxVisible) Sets whether the min and max values are displayed below the slider track.voidsetStep(double step) Sets the step value of the slider.voidsetValue(RangeSliderValue value) voidsetValueAlwaysVisible(boolean valueAlwaysVisible) Sets whether the value bubble is always visible, regardless of focus or hover state.voidsetValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode) voidsetValueChangeTimeout(int valueChangeTimeout) Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, bindValue, getEmptyValue, getValue, isEmpty, setModelValue, valueEqualsMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
bindHelperText, getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, bindValue, getEmptyValue, getOptionalValue, getValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
bindReadOnly, bindRequiredIndicatorVisible, isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisibleMethods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
Constructor Details
-
RangeSlider
public RangeSlider()Constructs aRangeSliderwith min 0 and max 100. The initial value is [0, 100].The step defaults to 1.
-
RangeSlider
public RangeSlider(double min, double max) Constructs aRangeSliderwith the given min and max. The initial value is set to [min, max].The step defaults to 1.
- Parameters:
min- the minimum valuemax- the maximum value
-
RangeSlider
Constructs aRangeSliderwith 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
-
RangeSlider
Constructs aRangeSliderwith 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 labelmin- the minimum valuemax- the maximum value
-
-
Method Details
-
setAccessibleNameStart
Sets an accessible name for the start range input element of the slider.- Parameters:
accessibleName- the accessible name to set, ornullto remove it
-
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
Sets an accessible name for the end range input element of the slider.- Parameters:
accessibleName- the accessible name to set, ornullto remove it
-
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
-
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
-
clear
public void clear()Clears the slider value, setting it to the full range from minimum to maximum.- See Also:
-
hasValidValue
protected boolean hasValidValue()- Overrides:
hasValidValuein classcom.vaadin.flow.component.AbstractSinglePropertyField<RangeSlider,RangeSliderValue>
-
isValueWithinMinMax
-
isValueAlignedWithStep
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
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, notnull- Returns:
- a
SignalBindingthat can be used to registeronChangecallbacks - Since:
- 25.1
- See Also:
-
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, notnull- Returns:
- a
SignalBindingthat can be used to registeronChangecallbacks - Since:
- 25.1
- See Also:
-
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, notnull- Returns:
- a
SignalBindingthat can be used to registeronChangecallbacks - Since:
- 25.1
- See Also:
-
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-trueto always show the value bubble,falseotherwise
-
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:
trueif the value bubble is always visible,falseotherwise
-
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-trueto display min and max values,falseotherwise
-
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:
trueif the min and max values are displayed,falseotherwise
-
getValueChangeMode
public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()The default value is
ValueChangeMode.ON_CHANGE.- Specified by:
getValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValueChangeMode
public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode) - Specified by:
setValueChangeModein interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) - Specified by:
setValueChangeTimeoutin interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
getValueChangeTimeout
public int getValueChangeTimeout()- Specified by:
getValueChangeTimeoutin interfacecom.vaadin.flow.data.value.HasValueChangeMode
-
setValue
- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue>, TValue> - Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue>, TValue>
-