@Tag(value="vaadin-big-decimal-field") @JavaScript(value="frontend://vaadin-big-decimal-field.js") @JsModule(value="./vaadin-big-decimal-field.js") public class BigDecimalField extends GeneratedVaadinTextField<BigDecimalField,BigDecimal> 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, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.data.binder.HasValidator<BigDecimal>, HasClientValidation
vaadin-big-decimal-field element. This
field uses BigDecimal as the server-side value type, which allows
handling decimal numbers with high precision. The component also prevents
users from entering characters which can't be used in a decimal number, such
as alphabets.
When setting values from the server-side, the scale of the provided
BigDecimal is preserved in the presentation format shown to the user,
as described in setValue(BigDecimal).
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>HasClientValidation.ClientValidatedEventcom.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>DEFAULT_CHANGE_TIMEOUTAUTOCOMPLETE_ATTRIBUTEAUTOCAPITALIZE_ATTRIBUTEAUTOCORRECT_ATTRIBUTE| Constructor and Description |
|---|
BigDecimalField()
Constructs an empty
BigDecimalField. |
BigDecimalField(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>> listener)
Constructs an empty
BigDecimalField with a value change listener. |
BigDecimalField(String label)
Constructs an empty
BigDecimalField with the given label. |
BigDecimalField(String label,
BigDecimal initialValue,
com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>> listener)
Constructs an empty
BigDecimalField with a label,a value change
listener and an initial value. |
BigDecimalField(String label,
BigDecimal initialValue,
String placeholder)
Constructs a
BigDecimalField with the given label, an initial
value and placeholder text. |
BigDecimalField(String label,
com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>> listener)
Constructs an empty
BigDecimalField with a label and a value
change listener. |
BigDecimalField(String label,
String placeholder)
Constructs an empty
BigDecimalField with the given label and
placeholder text. |
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.flow.shared.Registration |
addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<BigDecimal> listener) |
com.vaadin.flow.data.binder.Validator<BigDecimal> |
getDefaultValidator() |
BigDecimal |
getEmptyValue() |
String |
getErrorMessage() |
String |
getLabel()
String used for the label element.
|
Locale |
getLocale()
Gets the locale used by this BigDecimalField.
|
String |
getPlaceholder()
A hint to the user of what can be entered in the component.
|
String |
getTitle()
The text usually displayed in a tooltip popup when the mouse is over the
field.
|
BigDecimal |
getValue()
Returns the current value of the field.
|
com.vaadin.flow.data.value.ValueChangeMode |
getValueChangeMode() |
int |
getValueChangeTimeout() |
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 field.
|
protected boolean |
isEnforcedFieldValidationEnabled()
Whether the full experience validation is enforced for the component.
|
boolean |
isInvalid() |
protected void |
onAttach(com.vaadin.flow.component.AttachEvent attachEvent) |
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 text
field. |
void |
setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
|
void |
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
|
void |
setLabel(String label)
Sets the label for this component.
|
void |
setLocale(Locale locale)
Sets the locale for this BigDecimalField.
|
void |
setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
|
void |
setTitle(String title)
Description copied from corresponding location in WebComponent:
|
void |
setValue(BigDecimal value)
Sets the value of this field.
|
void |
setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode) |
void |
setValueChangeTimeout(int valueChangeTimeout) |
protected void |
validate()
Performs server-side validation of the current value.
|
addChangeListener, addInvalidChangeListener, addThemeVariants, addToInput, addToPrefix, addToSuffix, checkValidity, 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, setPattern, setPreventInvalidInput, setReadonly, setRequiredgetSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventaddValueChangeListener, isEmpty, setModelValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, 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, setSuffixComponentaddKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListeneraddCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenergetAutocomplete, setAutocompletegetAutocapitalize, setAutocapitalizeisAutocorrect, setAutocorrectgetHelperComponent, getHelperText, setHelperComponent, setHelperTextaddClientValidatedEventListeneraddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameaddFocusShortcut, blur, focus, getTabIndex, setTabIndexaddThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNamepublic BigDecimalField()
BigDecimalField.public BigDecimalField(String label)
BigDecimalField with the given label.label - the text to set as the labelpublic BigDecimalField(String label, String placeholder)
BigDecimalField with the given label and
placeholder text.label - the text to set as the labelplaceholder - the placeholder text to setpublic BigDecimalField(String label, BigDecimal initialValue, String placeholder)
BigDecimalField with the given label, an initial
value and placeholder text.label - the text to set as the labelinitialValue - the initial valueplaceholder - the placeholder text to setAbstractField.setValue(Object),
setPlaceholder(String)public BigDecimalField(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>> listener)
BigDecimalField with a value change listener.listener - the value change listenerAbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public BigDecimalField(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>> listener)
BigDecimalField with a label and a value
change listener.label - the text to set as the labellistener - the value change listenersetLabel(String),
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public BigDecimalField(String label, BigDecimal initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>> listener)
BigDecimalField with a label,a value change
listener 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 void setValueChangeTimeout(int valueChangeTimeout)
setValueChangeTimeout in interface com.vaadin.flow.data.value.HasValueChangeModepublic int getValueChangeTimeout()
getValueChangeTimeout 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<BigDecimalField,BigDecimal>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<BigDecimalField,BigDecimal>invalid - the boolean value to setpublic void setLabel(String label)
setLabel in interface com.vaadin.flow.component.HasLabelsetLabel in class GeneratedVaadinTextField<BigDecimalField,BigDecimal>label - value for the label property in the webcomponentpublic String getLabel()
getLabel in interface com.vaadin.flow.component.HasLabellabel 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<BigDecimalField,BigDecimal>placeholder - the String value to setpublic String getPlaceholder()
placeholder property from the webcomponentpublic 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<BigDecimalField,BigDecimal>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 text
field.setClearButtonVisible in class GeneratedVaadinTextField<BigDecimalField,BigDecimal>clearButtonVisible - true to set the button visible,
false otherwisepublic 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<BigDecimalField,BigDecimal>autofocus - the boolean value to setpublic boolean isAutofocus()
autofocus property from the webcomponentpublic String getTitle()
title property from the webcomponentpublic void setTitle(String title)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
The text usually displayed in a tooltip popup when the mouse is over the field.
setTitle in class GeneratedVaadinTextField<BigDecimalField,BigDecimal>title - the String value to setpublic BigDecimal getEmptyValue()
getEmptyValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>,BigDecimal>getEmptyValue in class com.vaadin.flow.component.AbstractField<BigDecimalField,BigDecimal>public void setValue(BigDecimal value)
getValue(), fires a value change event.
You can adjust how the value is presented in the field with the APIs
provided by the value type BigDecimal. For example, you can
change the number of decimal places with
BigDecimal.setScale(int). This doesn't however restrict the user
from entering values with different number of decimals. Note that
BigDecimals are immutable, so their methods will return new instances
instead of editing the existing ones. Scientific notation (such as 1e9)
is turned into plain number format for the presentation.
setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>,BigDecimal>setValue in class com.vaadin.flow.component.AbstractField<BigDecimalField,BigDecimal>value - the new valuepublic BigDecimal getValue()
null.getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<BigDecimalField,BigDecimal>,BigDecimal>getValue in class com.vaadin.flow.component.AbstractField<BigDecimalField,BigDecimal>protected void validate()
validate in class GeneratedVaadinTextField<BigDecimalField,BigDecimal>public com.vaadin.flow.data.binder.Validator<BigDecimal> getDefaultValidator()
getDefaultValidator in interface com.vaadin.flow.data.binder.HasValidator<BigDecimal>public com.vaadin.flow.shared.Registration addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<BigDecimal> listener)
addValidationStatusChangeListener in interface com.vaadin.flow.data.binder.HasValidator<BigDecimal>public void setLocale(Locale locale)
locale - the locale to set, not nullpublic Locale getLocale()
getLocale in class com.vaadin.flow.component.Componentnullprotected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
onAttach in class com.vaadin.flow.component.Componentprotected boolean isEnforcedFieldValidationEnabled()
Exposed with protected visibility to support mocking
The method requires the VaadinSession instance to obtain the
application configuration properties, otherwise, the feature is
considered disabled.
true if enabled, false otherwise.Copyright © 2025. All rights reserved.