Package com.vaadin.flow.component.html
Class RangeInput
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<RangeInput,Double>
com.vaadin.flow.component.html.RangeInput
- All Implemented Interfaces:
AttachNotifier,BlurNotifier<RangeInput>,DetachNotifier,Focusable<RangeInput>,FocusNotifier<RangeInput>,HasAriaLabel,HasElement,HasEnabled,HasSize,HasStyle,HasValue<AbstractField.ComponentValueChangeEvent<RangeInput,,Double>, Double> HasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeInput,,Double>, Double> HasValueChangeMode,Serializable
@Tag("input")
public class RangeInput
extends AbstractSinglePropertyField<RangeInput,Double>
implements Focusable<RangeInput>, HasSize, HasStyle, HasValueChangeMode, HasAriaLabel
Creates a new input element with type "range".
Note: Slider doesn't support the read-only mode and will disable itself instead.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe orientation of the range slider.Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V extends Object> 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 extends Object>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>> -
Field Summary
Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new slider, withON_CHANGEvalue change mode.RangeInput(ValueChangeMode valueChangeMode) Creates a new slider. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetMax()Gets the maximum value.doublegetMin()Gets the minimum value.Gets the orientation of the range slider.getStep()The step attribute is a number that specifies the granularity that the value must adhere to.intbooleanbooleanvoidsetEnabled(boolean enabled) voidsetMax(double max) Sets the new maximum value.voidsetMin(double min) Sets the new minimum value.voidsetOrientation(RangeInput.Orientation orientation) Sets the orientation of the range slider.voidsetReadOnly(boolean readOnly) voidThe step attribute is a number that specifies the granularity that the value must adhere to.voidsetValueChangeMode(ValueChangeMode valueChangeMode) voidsetValueChangeTimeout(int valueChangeTimeout) Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, 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, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
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, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isRequiredIndicatorVisible, setRequiredIndicatorVisible
-
Constructor Details
-
RangeInput
public RangeInput()Creates a new slider, withON_CHANGEvalue change mode. -
RangeInput
Creates a new slider.- Parameters:
valueChangeMode- initial value change mode, ornullto disable the value synchronization
-
-
Method Details
-
getValueChangeMode
- Specified by:
getValueChangeModein interfaceHasValueChangeMode
-
setValueChangeMode
- Specified by:
setValueChangeModein interfaceHasValueChangeMode
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) - Specified by:
setValueChangeTimeoutin interfaceHasValueChangeMode
-
getValueChangeTimeout
public int getValueChangeTimeout()The default value is
HasValueChangeMode.DEFAULT_CHANGE_TIMEOUT.- Specified by:
getValueChangeTimeoutin interfaceHasValueChangeMode
-
getMin
public double getMin()Gets the minimum value.- Returns:
- the minimum value, defaults to 0.
-
setMin
public void setMin(double min) Sets the new minimum value.- Parameters:
min- the minimum value.
-
getMax
public double getMax()Gets the maximum value.- Returns:
- the maximum value, defaults to 100.
-
setMax
public void setMax(double max) Sets the new maximum value.- Parameters:
max- the maximum value.
-
getStep
The step attribute is a number that specifies the granularity that the value must adhere to.
The step attribute can also be set to null. This step value means that no stepping interval is implied and any value is allowed in the specified range
The default stepping value for range inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer; for example, if you set min to -10 and value to 1.5, then a step of 1 will allow only values such as 1.5, 2.5, 3.5,… in the positive direction and -0.5, -1.5, -2.5,… in the negative direction.- Returns:
- the current step value, defaults to 1.
-
setStep
The step attribute is a number that specifies the granularity that the value must adhere to.
The step attribute can also be set to null. This step value means that no stepping interval is implied and any value is allowed in the specified range
The default stepping value for range inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer; for example, if you set min to -10 and value to 1.5, then a step of 1 will allow only values such as 1.5, 2.5, 3.5,… in the positive direction and -0.5, -1.5, -2.5,… in the negative direction.- Parameters:
step- the new step value, may be null.
-
setOrientation
Sets the orientation of the range slider.
Non-standard Attribute. Since the vertical orientation is not standardized yet, this feature is not guaranteed to work on every browser. We found this feature to work on Firefox 120+, Chromium 119+, Edge 119+ and Safari 17.1+.
The orient attribute defines the orientation of the range slider. Values include horizontal, meaning the range is rendered horizontally, and vertical, where the range is rendered vertically.- Parameters:
orientation- the orientation, not null. Defaults toRangeInput.Orientation.HORIZONTAL.
-
getOrientation
Gets the orientation of the range slider.
Non-standard Attribute.
The orient attribute defines the orientation of the range slider. Values include horizontal, meaning the range is rendered horizontally, and vertical, where the range is rendered vertically.- Returns:
- the current orientation, never null.
-
setReadOnly
public void setReadOnly(boolean readOnly) - Specified by:
setReadOnlyin interfaceHasValue<AbstractField.ComponentValueChangeEvent<RangeInput,Double>, Double> - Specified by:
setReadOnlyin interfaceHasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeInput,Double>, Double>
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfaceHasValue<AbstractField.ComponentValueChangeEvent<RangeInput,Double>, Double> - Specified by:
isReadOnlyin interfaceHasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeInput,Double>, Double>
-
setEnabled
public void setEnabled(boolean enabled) - Specified by:
setEnabledin interfaceHasEnabled
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceHasEnabled
-