Class RangeSlider
- All Implemented Interfaces:
AttachNotifier,BlurNotifier<RangeSlider>,DetachNotifier,Focusable<RangeSlider>,FocusNotifier<RangeSlider>,HasElement,HasEnabled,HasHelper,HasLabel,HasSize,HasStyle,HasValidation,HasValue<AbstractField.ComponentValueChangeEvent<RangeSlider,,RangeSliderValue>, RangeSliderValue> HasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeSlider,,RangeSliderValue>, RangeSliderValue> KeyNotifier,HasTooltip,HasValidationProperties,InputField<AbstractField.ComponentValueChangeEvent<RangeSlider,,RangeSliderValue>, RangeSliderValue> HasValueChangeMode,Serializable
- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
BlurNotifier.BlurEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
FocusNotifier.FocusEvent<C extends Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends 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 TypeMethodDescriptionvoidclear()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.Gets current value change mode of the component.intReturns the currently set timeout, for how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.protected booleanChecks whether the element property has a value that can be converted to the model type.booleanGets 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(AttachEvent attachEvent) Called when the component is attached to a UI.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) Sets the value of this object.voidsetValueAlwaysVisible(boolean valueAlwaysVisible) Sets whether the value bubble is always visible, regardless of focus or hover state.voidsetValueChangeMode(ValueChangeMode valueChangeMode) Sets new value change mode for the component.voidsetValueChangeTimeout(int valueChangeTimeout) Sets how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.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, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, 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.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, 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
bindErrorMessage, bindInvalid, 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()Description copied from class:AbstractSinglePropertyFieldChecks whether the element property has a value that can be converted to the model type. Property changes from the element will be ignored if this method returnsfalse. The default implementation always returntrue.- Overrides:
hasValidValuein classAbstractSinglePropertyField<RangeSlider,RangeSliderValue> - Returns:
trueif the element property value can be converted to the model type; otherwisefalse
-
isValueWithinMinMax
-
isValueAlignedWithStep
-
onAttach
Description copied from class:ComponentCalled when the component is attached to a UI.This method is invoked before the
AttachEventis fired for the component. Make sure to callsuper.onAttachwhen overriding this method. -
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
Gets current value change mode of the component.The default value is
ValueChangeMode.ON_CHANGE.- Specified by:
getValueChangeModein interfaceHasValueChangeMode- Returns:
- current value change mode of the component, or
nullif the value is not synchronized
-
setValueChangeMode
Description copied from interface:HasValueChangeModeSets new value change mode for the component.- Specified by:
setValueChangeModein interfaceHasValueChangeMode- Parameters:
valueChangeMode- new value change mode, ornullto disable the value synchronization
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) Description copied from interface:HasValueChangeModeSets how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.Implementations should use
ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration).- Specified by:
setValueChangeTimeoutin interfaceHasValueChangeMode- Parameters:
valueChangeTimeout- the timeout in milliseconds of how oftenHasValue.ValueChangeEvents are triggered.
-
getValueChangeTimeout
public int getValueChangeTimeout()Description copied from interface:HasValueChangeModeReturns the currently set timeout, for how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.- Specified by:
getValueChangeTimeoutin interfaceHasValueChangeMode- Returns:
- the timeout in milliseconds of how often
HasValue.ValueChangeEvents are triggered.
-
setValue
Description copied from interface:HasValueSets the value of this object. If the new value is not equal togetValue(), fires a value change event. May throwIllegalArgumentExceptionif the value is not acceptable.Implementation note: the implementing class should document whether null values are accepted or not, and override
HasValue.getEmptyValue()if the empty value is notnull.- Specified by:
setValuein interfaceHasValue<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue>, TValue> - Overrides:
setValuein classAbstractField<TComponent extends com.vaadin.flow.component.slider.SliderBase<TComponent,TValue>, TValue> - Parameters:
value- the new value
-