com.vaadin.flow.component.html.
Class RangeInput
All Implemented Interfaces:
AttachNotifier
, BlurNotifier<RangeInput>
, DetachNotifier
, Focusable<RangeInput>
, FocusNotifier<RangeInput>
, HasAriaLabel
, HasElement
, HasEnabled
, HasSize
, HasStyle
, HasValue<AbstractField.ComponentValueChangeEvent<RangeInput,
, HasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeInput,
, HasValueChangeMode
, Serializable
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 enum
The orientation of the range slider.
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
ConstructorsConstructorDescriptionCreates a new slider, with
ON_CHANGE
value change mode.RangeInput
(ValueChangeMode valueChangeMode) Creates a new slider.
-
Method Summary
Modifier and TypeMethodDescriptiondouble
getMax()
Gets the maximum value.
double
getMin()
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.
Gets current value change mode of the component.
int
Returns the currently set timeout, for how often
HasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.boolean
Returns whether the object is enabled or disabled.
boolean
Returns whether this
HasValue
is in read-only mode or not.void
setEnabled
(boolean enabled) Sets the UI object explicitly disabled or enabled.
void
setMax
(double max) Sets the new maximum value.
void
setMin
(double min) Sets the new minimum value.
void
setOrientation
(RangeInput.Orientation orientation) Sets the orientation of the range slider.
void
setReadOnly
(boolean readOnly) Sets the read-only mode of this
HasValue
to given mode.void
The step attribute is a number that specifies the granularity that the value must adhere to.
void
setValueChangeMode
(ValueChangeMode valueChangeMode) Sets new value change mode for the component.
void
setValueChangeTimeout
(int valueChangeTimeout) Sets how often
HasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
Methods 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, 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, getTabIndex, setTabIndex
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
Methods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledBy
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods 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, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValue
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isRequiredIndicatorVisible, setRequiredIndicatorVisible
-
Constructor Details
-
RangeInput
public RangeInput()Creates a new slider, with
ON_CHANGE
value change mode. -
RangeInput
Creates a new slider.
Parameters:
valueChangeMode
- initial value change mode, ornull
to disable the value synchronization
-
-
Method Details
-
getValueChangeMode
Description copied from interface:
HasValueChangeMode
Gets current value change mode of the component.
Specified by:
getValueChangeMode
in interfaceHasValueChangeMode
Returns:
current value change mode of the component, or
null
if the value is not synchronized -
setValueChangeMode
Description copied from interface:
HasValueChangeMode
Sets new value change mode for the component.
Specified by:
setValueChangeMode
in interfaceHasValueChangeMode
Parameters:
valueChangeMode
- new value change mode, ornull
to disable the value synchronization -
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) Description copied from interface:
HasValueChangeMode
Sets how often
HasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.Implementations should use
ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration)
.Specified by:
setValueChangeTimeout
in interfaceHasValueChangeMode
Parameters:
valueChangeTimeout
- the timeout in milliseconds of how oftenHasValue.ValueChangeEvent
s are triggered. -
getValueChangeTimeout
public int getValueChangeTimeout()Returns the currently set timeout, for how often
HasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.The default value is
HasValueChangeMode.DEFAULT_CHANGE_TIMEOUT
.Specified by:
getValueChangeTimeout
in interfaceHasValueChangeMode
Returns:
the timeout in milliseconds of how often
HasValue.ValueChangeEvent
s are triggered. -
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.
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.
Parameters:
step
- the new step value, may be null. -
setOrientation
Sets the orientation of the range slider.
Parameters:
orientation
- the orientation, not null. Defaults toRangeInput.Orientation.HORIZONTAL
. -
getOrientation
Gets the orientation of the range slider.
Returns:
the current orientation, never null.
-
setReadOnly
public void setReadOnly(boolean readOnly) Description copied from interface:
HasValue
Sets the read-only mode of this
HasValue
to given mode. The user can't change the value when in read-only mode.A
HasValue
with a visual component in read-only mode typically looks visually different to signal to the user that the value cannot be edited.Specified by:
setReadOnly
in interfaceHasValue<AbstractField.ComponentValueChangeEvent<RangeInput,
Double>, Double> Specified by:
setReadOnly
in interfaceHasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeInput,
Double>, Double> Parameters:
readOnly
- a boolean value specifying whether the component is put read-only mode or not -
isReadOnly
public boolean isReadOnly()Description copied from interface:
HasValue
Returns whether this
HasValue
is in read-only mode or not.Specified by:
isReadOnly
in interfaceHasValue<AbstractField.ComponentValueChangeEvent<RangeInput,
Double>, Double> Specified by:
isReadOnly
in interfaceHasValueAndElement<AbstractField.ComponentValueChangeEvent<RangeInput,
Double>, Double> Returns:
false
if the user can modify the value,true
if not. -
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:
HasEnabled
Sets the UI object explicitly disabled or enabled.
Specified by:
setEnabled
in interfaceHasEnabled
Parameters:
enabled
- iffalse
then explicitly disables the object, iftrue
then enables the object so that its state depends on parent -
isEnabled
public boolean isEnabled()Description copied from interface:
HasEnabled
Returns whether the object is enabled or disabled.
Object may be enabled by itself by but if its ascendant is disabled then it's considered as (implicitly) disabled.
Specified by:
isEnabled
in interfaceHasEnabled
Returns:
enabled state of the object
-