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>HasClientValidation.ClientValidatedEventBlurNotifier.BlurEvent<C extends Component>FocusNotifier.FocusEvent<C extends Component>HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>DEFAULT_CHANGE_TIMEOUTAUTOCOMPLETE_ATTRIBUTEAUTOCAPITALIZE_ATTRIBUTEAUTOCORRECT_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.
|
addValidationStatusChangeListener, getDefaultValidator, getEmptyValue, getErrorMessage, getLabel, getMaxDouble, getMinDouble, getPlaceholder, getStepDouble, getTitle, getValue, getValueChangeMode, getValueChangeTimeout, hasControls, isAutofocus, isAutoselect, isClearButtonVisible, isEnforcedFieldValidationEnabled, isInvalid, onAttach, setAutofocus, setAutoselect, setClearButtonVisible, setErrorMessage, setHasControls, setInvalid, setLabel, setPlaceholder, setRequiredIndicatorVisible, setTitle, setValue, setValueChangeMode, setValueChangeTimeout, validatecheckValidity, hasControlsBooleanaddChangeListener, 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, setRequiredgetSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventaddValueChangeListener, isEmpty, setModelValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullgetPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponentaddInputListeneraddKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListeneraddCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenergetAutocomplete, setAutocompletegetAutocapitalize, setAutocapitalizeisAutocorrect, setAutocorrectgetHelperComponent, getHelperText, setHelperComponent, setHelperTextgetElementaddClientValidatedEventListeneraddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameaddFocusShortcut, blur, focus, getTabIndex, setTabIndexaddBlurListeneraddFocusListenerisEnabled, setEnabledaddThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameisReadOnly, isRequiredIndicatorVisible, setReadOnlyclear, getOptionalValueaddAttachListeneraddDetachListenerpublic 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)
GeneratedVaadinNumberFieldDescription 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)
GeneratedVaadinNumberFieldDescription 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.GeneratedVaadinTextFieldDescription 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.GeneratedVaadinTextFieldDescription 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 © 2025. All rights reserved.