@Tag(value="super-big-decimal-field") public class SuperBigDecimalField extends AbstractSuperFloatingPointField<BigDecimal,SuperBigDecimalField>
BigDecimal values that are properly formatted.
In addition it supports entering precise numbers through scientific notation.
Note: the value entered through scientific notation will be formatted according to the settings
and as such the displayed value may differ from the actual value.com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>DEFAULT_CHANGE_TIMEOUTHELPER_ABOVE_THEME_VARIANTLABEL_POSITION_ATTRIBUTE, LABEL_POSITION_DETAILS_ATTRIBUTE| Constructor and Description |
|---|
SuperBigDecimalField()
Constructs the field with an empty label,
BigDecimal.ZERO as default value and with default Locale. |
SuperBigDecimalField(BigDecimal defaultValue,
String label)
Constructs the field with given default value and label, and with default
Locale. |
SuperBigDecimalField(BigDecimal defaultValue,
String label,
Locale locale,
int maxFractionDigits)
Constructs the field.
|
SuperBigDecimalField(Locale locale)
Constructs the field with an empty label and
BigDecimal.ZERO as default value. |
SuperBigDecimalField(Locale locale,
int maxFractionDigits)
Constructs the field with an empty label and
BigDecimal.ZERO as default value. |
SuperBigDecimalField(String label)
Constructs the field with default
Locale and BigDecimal.ZERO as default value. |
SuperBigDecimalField(String label,
Locale locale)
Constructs the field with
BigDecimal.ZERO as the default value. |
SuperBigDecimalField(String label,
Locale locale,
int maxFractionDigits)
Constructs the field with
BigDecimal.ZERO as the default value.. |
| Modifier and Type | Method and Description |
|---|---|
protected StringBuilder |
buildRegularExpression(StringBuilder builder,
DecimalFormat format)
Builds regular expression that allows neat typing of the number already formatted.
|
char |
getExponentSeparator()
Returns the current exponent separator in the scientific notation.
|
int |
getMaximumExponentDigits()
Returns the number of allowed digits in exponent.
|
int |
getMaximumSignificandFractionDigits()
Returns the maximum number of digits allowed in the fractional (decimal) part of the significand in the scientific notation.
|
int |
getMaximumSignificandIntegerDigits()
Returns the maximum number of digits allowed in the integer part of the significand in the scientific notation.
|
boolean |
isNegativeExponentAllowed()
Checks whether or not negative exponent is allowed when entering number in scientific notation.
|
boolean |
isScientificNotationEnabled()
Checks whether scientific notation input is supported (by default it is not).
|
protected BigDecimal |
parseRawValue(String rawValue,
DecimalFormat format)
Parses (somewhat) raw value from the text field into a proper typed value.
|
void |
setDecimalFormat(DecimalFormat format)
Sets the format definition used to displaying the value.
|
void |
setExponentSeparator(char exponentSeparator)
Sets the exponent separator.
|
void |
setMaximumExponentDigits(int maximumExponentDigits)
Sets maximum allowed digits in exponent.
|
void |
setMaximumSignificandFractionDigits(int maximumSignificandFractionDigits)
Sets the number of digits allowed in the fractional (decimal) part of the significand in the scientific notation.
|
void |
setMaximumSignificandIntegerDigits(int maximumSignificandIntegerDigits)
Sets the number of digits allowed in the integer part of the significand in the scientific notation.
|
void |
setNegativeExponentAllowed(boolean negativeExponentAllowed)
Allows or disallows the exponent in scientific notation to be negative.
|
protected void |
updateFieldValue()
This method is called when the field loses its focus.
|
SuperBigDecimalField |
withExponentSeparator(char exponentSeparator)
Chains
setExponentSeparator(char) and returns itself. |
SuperBigDecimalField |
withMaximumExponentDigits(int maximumExponentDigits)
Chains
setMaximumExponentDigits(int) and returns itself. |
SuperBigDecimalField |
withMaximumSignificandFractionDigits(int maximumSignificandFractionDigits)
Chains
setMaximumSignificandFractionDigits(int) and returns itself. |
SuperBigDecimalField |
withMaximumSignificandIntegerDigits(int maximumSignificandIntegerDigits)
Chains
setMaximumSignificandIntegerDigits(int) and returns itself. |
SuperBigDecimalField |
withNegativeExponentAllowed(boolean negativeExponentAllowed)
Chains
setNegativeExponentAllowed(boolean) and returns itself. |
isIntegerPartOptional, setIntegerPartOptional, setMaximumFractionDigits, setMinimumFractionDigits, withIntegerPartOptional, withIntegerPartOptional, withIntegerPartRequired, withMaximumFractionDigits, withMinimumFractionDigitsaddTextSelectionListener, addThemeVariants, blur, escapeDot, focus, generateModelValue, getErrorMessage, getHelperComponent, getHelperText, getLabel, getLabelPosition, getLocale, getPlaceholder, getPrefixComponent, getRawValue, getRegexp, getSuffixComponent, getTooltipText, getValueChangeMode, getValueChangeTimeout, isAutoselect, isClearButtonVisible, isFocused, isGroupingSeparatorHiddenOnFocus, isHelperAbove, isInvalid, isNegativeValueAllowed, isNullValueAllowed, isReadOnly, isReceivingSelectionEventsFromClient, isRequired, isRequiredIndicatorVisible, removeThemeVariants, select, selectAll, selectNone, setAutoselect, setClearButtonVisible, setErrorMessage, setGroupingSeparatorHiddenOnFocus, setHelperAbove, setHelperAbove, setHelperBelow, setHelperComponent, setHelperText, setId, setInvalid, setLabel, setLabelPosition, setLocale, setMaximumIntegerDigits, setNegativeValueAllowed, setNullValueAllowed, setPlaceholder, setPrefixComponent, setPresentationValue, setReadOnly, setReceivingSelectionEventsFromClient, setRequired, setRequiredIndicatorVisible, setSuffixComponent, setTooltipText, setValueChangeMode, setValueChangeTimeout, updateRegularExpression, updateRegularExpression, withAutoselect, withGroupingSeparatorHiddenOnFocus, withMaximumIntegerDigits, withNegativeValueAllowed, withReceivingSelectionEventsFromClientadd, remove, updateValueaddValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNamewithLocalewithLabelwithPlaceholderwithValuewithIdwithNullValueAllowedaddValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValuewithHelperComponent, withHelperTextwithHelperAbove, withHelperAbove, withHelperBelowwithClearButtonVisiblewithoutRequired, withRequired, withRequiredwithLabelPositionwithTooltipTextgetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullpublic SuperBigDecimalField()
BigDecimal.ZERO as default value and with default Locale.public SuperBigDecimalField(Locale locale)
BigDecimal.ZERO as default value.locale - Locale to use for formatting.public SuperBigDecimalField(Locale locale, int maxFractionDigits)
BigDecimal.ZERO as default value.locale - Locale to use for formatting.maxFractionDigits - Maximum number of fraction digits allowed (overwrites setting found in locale.public SuperBigDecimalField(String label)
Locale and BigDecimal.ZERO as default value.label - Label accompanying the field.public SuperBigDecimalField(String label, Locale locale)
BigDecimal.ZERO as the default value.label - Label accompanying the field.locale - Locale to use for formatting.public SuperBigDecimalField(BigDecimal defaultValue, String label)
Locale.defaultValue - Default value.label - Label that accompanies the field.public SuperBigDecimalField(String label, Locale locale, int maxFractionDigits)
BigDecimal.ZERO as the default value..label - Label accompanying the field.locale - Locale to use for formatting.maxFractionDigits - Maximum number of fraction digits allowed (overwrites setting found in locale.public SuperBigDecimalField(BigDecimal defaultValue, String label, Locale locale, int maxFractionDigits)
defaultValue - Default value.label - Label accompanying the field.locale - Locale to use for formatting.maxFractionDigits - Maximum number of fraction digits allowed (overwrites setting found in locale.public void setDecimalFormat(DecimalFormat format)
AbstractSuperNumberFieldsetDecimalFormat in class AbstractSuperNumberField<BigDecimal,SuperBigDecimalField>format - DecimalFormat to use. When null, NumberFormat.getNumberInstance() will be used.protected StringBuilder buildRegularExpression(StringBuilder builder, DecimalFormat format)
AbstractSuperNumberFieldbuildRegularExpression in class AbstractSuperNumberField<BigDecimal,SuperBigDecimalField>builder - Builder, initially empty.format - Information about the format.public final boolean isScientificNotationEnabled()
true when getExponentSeparator() is defined and getMaximumExponentDigits() is greater than zero, false otherwise.protected BigDecimal parseRawValue(String rawValue, DecimalFormat format) throws ParseException
AbstractSuperNumberFieldparseRawValue in class AbstractSuperNumberField<BigDecimal,SuperBigDecimalField>rawValue - Value from text field.format - Format to use.ParseException - When parsing goes wrong.protected void updateFieldValue()
AbstractSuperNumberFieldupdateFieldValue in class AbstractSuperNumberField<BigDecimal,SuperBigDecimalField>public void setMaximumExponentDigits(int maximumExponentDigits)
maximumExponentDigits - Number of digits allowed in the exponent part of scientific notation.isScientificNotationEnabled()public int getMaximumExponentDigits()
public final SuperBigDecimalField withMaximumExponentDigits(int maximumExponentDigits)
setMaximumExponentDigits(int) and returns itself.maximumExponentDigits - Number of digits allowed in the exponent part of scientific notation.setMaximumExponentDigits(int)public int getMaximumSignificandIntegerDigits()
AbstractSuperNumberField.getMaximumIntegerDigits().AbstractSuperNumberField.getMaximumIntegerDigits()public void setMaximumSignificandIntegerDigits(int maximumSignificandIntegerDigits)
maximumSignificandIntegerDigits - The number of digits. The lesser value of this number and AbstractSuperNumberField.getMaximumIntegerDigits() will be used.public final SuperBigDecimalField withMaximumSignificandIntegerDigits(int maximumSignificandIntegerDigits)
setMaximumSignificandIntegerDigits(int) and returns itself.maximumSignificandIntegerDigits - The number of digits allowed in the integer part of the significand.setMaximumSignificandIntegerDigits(int)public int getMaximumSignificandFractionDigits()
AbstractSuperNumberField.getMaximumFractionDigits().AbstractSuperNumberField.getMaximumFractionDigits()public void setMaximumSignificandFractionDigits(int maximumSignificandFractionDigits)
maximumSignificandFractionDigits - The number of digits. The lesser value of this number and AbstractSuperNumberField.getMaximumFractionDigits() will be used.public final SuperBigDecimalField withMaximumSignificandFractionDigits(int maximumSignificandFractionDigits)
setMaximumSignificandFractionDigits(int) and returns itself.maximumSignificandFractionDigits - The number of digits allowed in the fraction (decimal) part of the significand.setMaximumSignificandFractionDigits(int)public char getExponentSeparator()
AbstractSuperNumberField.getLocale() of this character are supported.public void setExponentSeparator(char exponentSeparator)
AbstractSuperNumberField.getLocale()) of the character will be supported.exponentSeparator - A character to use. Setting this to 0 will disable scientific notation support.isScientificNotationEnabled()public final SuperBigDecimalField withExponentSeparator(char exponentSeparator)
setExponentSeparator(char) and returns itself.exponentSeparator - A character to use as exponent separator in scientific notation.setExponentSeparator(char)public boolean isNegativeExponentAllowed()
true (default) when the exponent part can be negative number, false otherwise.public void setNegativeExponentAllowed(boolean negativeExponentAllowed)
negativeExponentAllowed - Whether or not the exponent can be negative.public final SuperBigDecimalField withNegativeExponentAllowed(boolean negativeExponentAllowed)
setNegativeExponentAllowed(boolean) and returns itself.negativeExponentAllowed - Whether or not the exponent can be negative.setNegativeExponentAllowed(boolean)Copyright © 2023 Miki. All rights reserved.