public class NumberField extends AbstractNumberField<NumberField,Double>
vaadin-number-field
element.GeneratedVaadinTextField.ChangeEvent<R extends GeneratedVaadinTextField<R,?>>, GeneratedVaadinTextField.InvalidChangeEvent<R extends GeneratedVaadinTextField<R,?>>
AbstractField.ComponentValueChangeEvent<C extends Component,V>
BlurNotifier.BlurEvent<C extends Component>
FocusNotifier.FocusEvent<C extends Component>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
DEFAULT_CHANGE_TIMEOUT
AUTOCOMPLETE_ATTRIBUTE
AUTOCAPITALIZE_ATTRIBUTE
AUTOCORRECT_ATTRIBUTE
Constructor and Description |
---|
NumberField()
Constructs an empty
NumberField . |
NumberField(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
Constructs an empty
NumberField with a value change listener. |
NumberField(String label)
Constructs an empty
NumberField with the given label. |
NumberField(String label,
Double initialValue,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
Constructs a
NumberField with a value change listener, a label
and an initial value. |
NumberField(String label,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
Constructs an empty
NumberField with a value change listener and
a label. |
NumberField(String label,
String placeholder)
Constructs an empty
NumberField with the given label and
placeholder text. |
Modifier and Type | Method and Description |
---|---|
double |
getMax()
The maximum value of the field.
|
int |
getMaxLength()
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . |
double |
getMin()
The minimum value of the field.
|
int |
getMinLength()
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . |
String |
getPattern()
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . For
setting a custom value pattern, use the TextField component
instead. |
double |
getStep()
Specifies the allowed number intervals of the field.
|
boolean |
isPreventInvalidInput()
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . For
setting a custom value pattern and preventing invalid input,
use the TextField component instead. |
void |
setMax(double max)
Description copied from corresponding location in WebComponent:
|
void |
setMaxLength(int maxLength)
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . |
void |
setMin(double min)
Description copied from corresponding location in WebComponent:
|
void |
setMinLength(int minLength)
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . |
void |
setPattern(String pattern)
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . For
setting a custom value pattern, use the TextField component
instead. |
void |
setPreventInvalidInput(boolean preventInvalidInput)
Deprecated.
Not supported by NumberField (as it's built on
<input type="number"> in HTML). You can set numeric
value constraints with setMin(double) ,
setMax(double) and setStep(double) . For
setting a custom value pattern and preventing invalid input,
use the TextField component instead. |
void |
setStep(double step)
Sets the allowed number intervals of the field.
|
getEmptyValue, getErrorMessage, getLabel, getMaxDouble, getMinDouble, getPlaceholder, getStepDouble, getTitle, getValue, getValueChangeMode, getValueChangeTimeout, hasControls, isAutofocus, isAutoselect, isClearButtonVisible, isInvalid, onAttach, setAutofocus, setAutoselect, setClearButtonVisible, setErrorMessage, setHasControls, setInvalid, setLabel, setPlaceholder, setRequiredIndicatorVisible, setTitle, setValue, setValueChangeMode, setValueChangeTimeout, validate
checkValidity, hasControlsBoolean
addChangeListener, addInvalidChangeListener, addThemeVariants, addToInput, addToPrefix, addToSuffix, getAutocapitalizeString, getAutocompleteString, getAutocorrectString, getErrorMessageString, getLabelString, getListString, getMaxlengthDouble, getMinlengthDouble, getNameString, getPatternString, getPlaceholderString, getTitleString, isAutofocusBoolean, isAutoselectBoolean, isClearButtonVisibleBoolean, isDisabledBoolean, isInvalidBoolean, isPreventInvalidInputBoolean, isReadonlyBoolean, isRequiredBoolean, remove, removeAll, removeThemeVariants, setAutocapitalize, setAutocomplete, setAutocorrect, setDisabled, setList, setMaxlength, setMinlength, setName, setReadonly, setRequired
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
addValueChangeListener, isEmpty, setModelValue, valueEquals
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
getPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponent
addInputListener
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
getAutocomplete, setAutocomplete
getAutocapitalize, setAutocapitalize
isAutocorrect, setAutocorrect
getHelperComponent, getHelperText, setHelperComponent, setHelperText
getElement
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
addBlurListener
addFocusListener
isEnabled, setEnabled
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
isReadOnly, isRequiredIndicatorVisible, setReadOnly
clear, getOptionalValue
addAttachListener
addDetachListener
public NumberField()
NumberField
.public NumberField(String label)
NumberField
with the given label.label
- the text to set as the labelpublic NumberField(String label, String placeholder)
NumberField
with the given label and
placeholder text.label
- the text to set as the labelplaceholder
- the placeholder text to setpublic NumberField(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
NumberField
with a value change listener.listener
- the value change listenerAbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
public NumberField(String label, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
NumberField
with a value change listener and
a label.label
- the text to set as the labellistener
- the value change listenerAbstractNumberField.setLabel(String)
,
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
public NumberField(String label, Double initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
NumberField
with a value change listener, a label
and an initial value.label
- the text to set as the labelinitialValue
- the initial valuelistener
- the value change listenerAbstractNumberField.setLabel(String)
,
AbstractField.setValue(Object)
,
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
public void setMin(double min)
GeneratedVaadinNumberField
Description copied from corresponding location in WebComponent:
The minimum value of the field.
setMin
in class AbstractNumberField<NumberField,Double>
min
- the double value to setpublic double getMin()
min
property from the webcomponentpublic void setMax(double max)
GeneratedVaadinNumberField
Description copied from corresponding location in WebComponent:
The maximum value of the field.
setMax
in class AbstractNumberField<NumberField,Double>
max
- the double value to setpublic double getMax()
max
property from the webcomponentpublic void setStep(double step)
min
(if specified by user).setStep
in class AbstractNumberField<NumberField,Double>
step
- the new step to setIllegalArgumentException
- if the argument is less or equal to zero.public double getStep()
step
property from the webcomponent@Deprecated public void setMaxLength(int maxLength)
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
.maxLength
- the maximum length@Deprecated public int getMaxLength()
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
.maxlength
property from the webcomponent@Deprecated public void setMinLength(int minLength)
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
.minLength
- the minimum length@Deprecated public int getMinLength()
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
.minlength
property from the webcomponent@Deprecated public boolean isPreventInvalidInput()
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
. For
setting a custom value pattern and preventing invalid input,
use the TextField component instead.true
, user is prevented from typing a value that
conflicts with the given pattern
.preventInvalidInput
property from the webcomponent@Deprecated public void setPreventInvalidInput(boolean preventInvalidInput)
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
. For
setting a custom value pattern and preventing invalid input,
use the TextField component instead.GeneratedVaadinTextField
Description copied from corresponding location in WebComponent:
When set to true, user is prevented from typing a value that conflicts
with the given pattern
, maxlength
or minlength
properties.
setPreventInvalidInput
in class GeneratedVaadinTextField<NumberField,Double>
preventInvalidInput
- the boolean value to set@Deprecated public void setPattern(String pattern)
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
. For
setting a custom value pattern, use the TextField component
instead.GeneratedVaadinTextField
Description copied from corresponding location in WebComponent:
A regular expression that the value is checked against. The pattern must match the entire value, not just some subset.
setPattern
in class GeneratedVaadinTextField<NumberField,Double>
pattern
- the String value to set@Deprecated public String getPattern()
<input type="number">
in HTML). You can set numeric
value constraints with setMin(double)
,
setMax(double)
and setStep(double)
. For
setting a custom value pattern, use the TextField component
instead.pattern
property from the webcomponentCopyright © 2023. All rights reserved.