public class NumberField extends GeneratedVaadinNumberField<NumberField,Double> implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.data.value.HasValueChangeMode, HasPrefixAndSuffix, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.CompositionNotifier, HasAutocomplete, HasAutocapitalize, HasAutocorrect
vaadin-number-field element.GeneratedVaadinTextField.ChangeEvent<R extends GeneratedVaadinTextField<R,?>>, GeneratedVaadinTextField.InvalidChangeEvent<R extends GeneratedVaadinTextField<R,?>>com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>AUTOCOMPLETE_ATTRIBUTEAUTOCAPITALIZE_ATTRIBUTEAUTOCORRECT_ATTRIBUTE| Constructor and Description |
|---|
NumberField()
Constructs an empty
NumberField. |
NumberField(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.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,
com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<NumberField,Double>> listener)
Constructs a
NumberField with a value change listener, a label
and an initial value. |
NumberField(String label,
com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.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 |
getEmptyValue()
Returns the value that represents an empty value.
|
String |
getErrorMessage() |
String |
getLabel()
String used for the label element.
|
double |
getMax()
The maximum value of the field.
|
int |
getMaxLength()
Maximum number of characters (in Unicode code points) that the user can
enter.
|
double |
getMin()
The minimum value of the field.
|
int |
getMinLength()
Minimum number of characters (in Unicode code points) that the user can
enter.
|
String |
getPattern()
A regular expression that the value is checked against.
|
String |
getPlaceholder()
A hint to the user of what can be entered in the component.
|
double |
getStep()
Specifies the allowed number intervals of the field.
|
String |
getTitle()
Message to show to the user when validation fails.
|
Double |
getValue()
Returns the current value of the number field.
|
com.vaadin.flow.data.value.ValueChangeMode |
getValueChangeMode() |
boolean |
hasControls()
Set to true to display value increase/decrease controls.
|
boolean |
isAutofocus()
Specify that this control should have input focus when the page loads.
|
boolean |
isAutoselect()
Specifies if the field value gets automatically selected when
the field gains focus.
|
boolean |
isClearButtonVisible()
Gets the visibility state of the button which clears the number field.
|
boolean |
isInvalid() |
boolean |
isPreventInvalidInput()
When set to
true, user is prevented from typing a value that
conflicts with the given pattern. |
void |
setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
|
void |
setAutoselect(boolean autoselect)
Set to
true to always have the field value automatically
selected when the field gains focus, false otherwise. |
void |
setClearButtonVisible(boolean clearButtonVisible)
Set to
false to hide the clear button which clears the number
field. |
void |
setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
|
void |
setHasControls(boolean hasControls)
Description copied from corresponding location in WebComponent:
|
void |
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
|
void |
setLabel(String label)
Description copied from corresponding location in WebComponent:
|
void |
setMax(double max)
Description copied from corresponding location in WebComponent:
|
void |
setMaxLength(int maxLength)
Maximum number of characters (in Unicode code points) that the user can
enter.
|
void |
setMin(double min)
Description copied from corresponding location in WebComponent:
|
void |
setMinLength(int minLength)
Minimum number of characters (in Unicode code points) that the user can
enter.
|
void |
setPattern(String pattern)
Description copied from corresponding location in WebComponent:
|
void |
setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
|
void |
setPreventInvalidInput(boolean preventInvalidInput)
Description copied from corresponding location in WebComponent:
|
void |
setRequiredIndicatorVisible(boolean requiredIndicatorVisible) |
void |
setStep(double step)
Description copied from corresponding location in WebComponent:
|
void |
setTitle(String title)
Description copied from corresponding location in WebComponent:
|
void |
setValue(Double value)
Sets the value of this number field.
|
void |
setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode) |
checkValidity, getMaxDouble, getMinDouble, getStepDouble, 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, setRequired, validatehasValidValue, setPresentationValue, setSynchronizedEventaddValueChangeListener, isEmpty, setModelValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFullgetPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponentaddKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListeneraddCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenergetAutocomplete, setAutocompletegetAutocapitalize, setAutocapitalizeisAutocorrect, setAutocorrectaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameaddFocusShortcut, blur, focus, getTabIndex, setTabIndexaddThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNamepublic 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(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.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, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.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 listenersetLabel(String),
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public NumberField(String label, Double initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.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 listenersetLabel(String),
AbstractField.setValue(Object),
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()
The default value is ValueChangeMode.ON_CHANGE.
getValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeModepublic void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
setValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeModepublic String getErrorMessage()
getErrorMessage in interface com.vaadin.flow.component.HasValidationpublic void setErrorMessage(String errorMessage)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Error to show when the input value is invalid.
setErrorMessage in interface com.vaadin.flow.component.HasValidationsetErrorMessage in class GeneratedVaadinTextField<NumberField,Double>errorMessage - the String value to setpublic boolean isInvalid()
isInvalid in interface com.vaadin.flow.component.HasValidationpublic void setInvalid(boolean invalid)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
This property is set to true when the control value is invalid.
setInvalid in interface com.vaadin.flow.component.HasValidationsetInvalid in class GeneratedVaadinTextField<NumberField,Double>invalid - the boolean value to setpublic void setLabel(String label)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
String used for the label element.
setLabel in class GeneratedVaadinTextField<NumberField,Double>label - the String value to setpublic String getLabel()
label property from the webcomponentpublic void setMax(double max)
GeneratedVaadinNumberFieldDescription copied from corresponding location in WebComponent:
The maximum value of the field.
setMax in class GeneratedVaadinNumberField<NumberField,Double>max - the double value to setpublic double getMax()
max property from the webcomponentpublic void setMin(double min)
GeneratedVaadinNumberFieldDescription copied from corresponding location in WebComponent:
The minimum value of the field.
setMin in class GeneratedVaadinNumberField<NumberField,Double>min - the double value to setpublic double getMin()
min property from the webcomponentpublic void setStep(double step)
GeneratedVaadinNumberFieldDescription copied from corresponding location in WebComponent:
Specifies the allowed number intervals of the field.
setStep in class GeneratedVaadinNumberField<NumberField,Double>step - the double value to setpublic double getStep()
step property from the webcomponentpublic void setPlaceholder(String placeholder)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control.
setPlaceholder in class GeneratedVaadinTextField<NumberField,Double>placeholder - the String value to setpublic void setHasControls(boolean hasControls)
GeneratedVaadinNumberFieldDescription copied from corresponding location in WebComponent:
Set to true to display value increase/decrease controls.
setHasControls in class GeneratedVaadinNumberField<NumberField,Double>hasControls - the boolean value to setpublic boolean hasControls()
hasControls property from the webcomponentpublic String getPlaceholder()
placeholder property from the webcomponentpublic void setAutofocus(boolean autofocus)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
setAutofocus in class GeneratedVaadinTextField<NumberField,Double>autofocus - the boolean value to setpublic boolean isAutofocus()
autofocus property from the webcomponentpublic void setMaxLength(int maxLength)
maxLength - the maximum lengthpublic int getMaxLength()
maxlength property from the webcomponentpublic void setMinLength(int minLength)
minLength - the minimum lengthpublic int getMinLength()
minlength property from the webcomponentpublic boolean isPreventInvalidInput()
true, user is prevented from typing a value that
conflicts with the given pattern.preventInvalidInput property from the webcomponentpublic void setPreventInvalidInput(boolean preventInvalidInput)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
When set to true, user is prevented from typing a value that conflicts
with the given pattern.
setPreventInvalidInput in class GeneratedVaadinTextField<NumberField,Double>preventInvalidInput - the boolean value to setpublic void setPattern(String pattern)
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 setpublic String getPattern()
pattern property from the webcomponentpublic String getTitle()
title property from the webcomponentpublic void setTitle(String title)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Message to show to the user when validation fails.
setTitle in class GeneratedVaadinTextField<NumberField,Double>title - the String value to setpublic boolean isAutoselect()
true if autoselect is active, false
otherwisepublic void setAutoselect(boolean autoselect)
true to always have the field value automatically
selected when the field gains focus, false otherwise.setAutoselect in class GeneratedVaadinTextField<NumberField,Double>autoselect - true to set auto select on,
false otherwisepublic boolean isClearButtonVisible()
true if the button is visible, false
otherwisepublic void setClearButtonVisible(boolean clearButtonVisible)
false to hide the clear button which clears the number
field.setClearButtonVisible in class GeneratedVaadinTextField<NumberField,Double>clearButtonVisible - true to set the button visible,
false otherwisepublic Double getEmptyValue()
getEmptyValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<NumberField,Double>,Double>getEmptyValue in class com.vaadin.flow.component.AbstractField<NumberField,Double>public void setValue(Double value)
getValue(), fires a value change event.setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<NumberField,Double>,Double>setValue in class com.vaadin.flow.component.AbstractField<NumberField,Double>value - the new valuepublic Double getValue()
null .getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<NumberField,Double>,Double>getValue in class com.vaadin.flow.component.AbstractField<NumberField,Double>public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<NumberField,Double>,Double>setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<NumberField,Double>,Double>Copyright © 2019. All rights reserved.