Class AbstractSuperNumberField<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<T>
org.vaadin.miki.superfields.numbers.AbstractSuperNumberField<T,SELF>
Type Parameters:
T - Type of number supported by the field.
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<T>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<T>>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<T>>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>, com.vaadin.flow.component.shared.HasClearButton, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.value.HasValueChangeMode, Serializable, TextSelectionNotifier<SELF>, CanReceiveSelectionEventsFromClient, CanSelectText, HasHelperPositionable, HasId, HasLabelPositionable, HasLocale, HasNullValueOptionallyAllowed<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>, HasPlaceholder, HasRequired, HasTextInputMode, WithClearButtonMixin<SELF>, WithHelperMixin<SELF>, WithHelperPositionableMixin<SELF>, WithIdMixin<SELF>, WithLabelMixin<SELF>, WithLabelPositionableMixin<SELF>, WithLocaleMixin<SELF>, WithNullValueOptionallyAllowedMixin<SELF,com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>, WithPlaceholderMixin<SELF>, WithReceivingSelectionEventsFromClientMixin<SELF>, WithRequiredMixin<SELF>, WithTextInputModeMixin<SELF>, WithTooltipMixin<SELF>, WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T,SELF>
Direct Known Subclasses:
AbstractSuperFloatingPointField, SuperIntegerField, SuperLongField

@CssImport("./styles/form-layout-number-field-styles.css") public abstract class AbstractSuperNumberField<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>> extends com.vaadin.flow.component.customfield.CustomField<T> implements CanSelectText, CanReceiveSelectionEventsFromClient, WithReceivingSelectionEventsFromClientMixin<SELF>, TextSelectionNotifier<SELF>, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.data.value.HasValueChangeMode, WithLocaleMixin<SELF>, WithLabelMixin<SELF>, WithPlaceholderMixin<SELF>, WithValueMixin<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T,SELF>, WithIdMixin<SELF>, WithNullValueOptionallyAllowedMixin<SELF,com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,T>,T>, WithHelperMixin<SELF>, WithHelperPositionableMixin<SELF>, WithClearButtonMixin<SELF>, WithRequiredMixin<SELF>, WithLabelPositionableMixin<SELF>, WithTooltipMixin<SELF>, WithTextInputModeMixin<SELF>
Base class for super number fields.
Since:
2020-04-07
Author:
miki
See Also:
  • Constructor Details

    • AbstractSuperNumberField

      protected AbstractSuperNumberField(T defaultValue, com.vaadin.flow.function.SerializablePredicate<T> negativityPredicate, com.vaadin.flow.function.SerializableFunction<T,T> turnToPositiveOperator, String label, Locale locale, int maxFractionDigits)
      Creates the field.
      Parameters:
      defaultValue - Default value to use on startup and when there are errors.
      negativityPredicate - Check for whether or not given value is negative.
      turnToPositiveOperator - Operation to turn number into a positive one.
      label - Label of the field.
      locale - Locale to use.
      maxFractionDigits - Max number of fraction digits. Overwrites the settings in format obtained based on locale. Negative value means leaving whatever is supported by the format.
  • Method Details

    • setLocale

      public void setLocale(Locale locale)
      Sets the locale of the component. The locale (or more precisely, its corresponding NumberFormat) is used to format how the number is displayed. Contrary to setDecimalFormat(DecimalFormat) this method preserves the precision of the number.
      Specified by:
      setLocale in interface HasLocale
      Parameters:
      locale - Locale to use. When null, Locale.getDefault() will be used.
      See Also:
    • getLocale

      public Locale getLocale()
      Description copied from interface: HasLocale
      Returns locale associated with this object.
      Specified by:
      getLocale in interface HasLocale
      Overrides:
      getLocale in class com.vaadin.flow.component.Component
      Returns:
      A Locale. Never null.
    • setDecimalFormat

      public void setDecimalFormat(DecimalFormat format)
      Sets the format definition used to displaying the value. Note: subclasses may overwrite the data in the format to make sure it follows type-specific constraints. Also note: changes to the format object may result in unpredictable behaviour of this component.
      Parameters:
      format - DecimalFormat to use. When null, NumberFormat.getNumberInstance() will be used.
    • isIntegerPartOptional

      protected boolean isIntegerPartOptional()
      Checks whether the integer part of a floating-point number is optional.
      Returns:
      Whether the integer part is optional (false by default - integer part is required).
    • setIntegerPartOptional

      protected void setIntegerPartOptional(boolean optional)
      Sets whether the integer part of a floating-point number is optional. If it is set as optional, numbers can be entered without the integer part, which will be defaulted to zero.
      Parameters:
      optional - Whether the integer part is optional.
    • setMinimumFractionDigits

      protected void setMinimumFractionDigits(int digits)
      Sets the minimum number of fraction digits displayed. Overwrites the value in the underlying DecimalFormat. Will be overwritten by calls to setDecimalFormat(DecimalFormat). Calls to setLocale(Locale) will preserve this value. Note: this is non-destructive, the underlying value of the field will not change (even though the representation will).
      Parameters:
      digits - Number of digits to use.
    • setMaximumFractionDigits

      protected void setMaximumFractionDigits(int digits)
      Sets the maximum number of fraction digits displayed and allowed. Overwrites the value in the underlying DecimalFormat. Will be overwritten by calls to setDecimalFormat(DecimalFormat). Calls to setLocale(Locale) will preserve this value. Note: this is non-destructive, the underlying value of the field will not change (even though the representation will).
      Parameters:
      digits - Number of digits to use.
    • setMaximumIntegerDigits

      public void setMaximumIntegerDigits(int digits)
      Sets the maximum number of integer digits (before decimal point) displayed and allowed. Overwrites the value in the underlying DecimalFormat. Will be overwritten by calls to setDecimalFormat(DecimalFormat). Calls to setLocale(Locale) will preserve this value. Note: this is non-destructive, the underlying value of the field will not change (even though the representation will).
      Parameters:
      digits - Number of digits to use.
    • withMaximumIntegerDigits

      public final SELF withMaximumIntegerDigits(int digits)
      Chains setMaximumIntegerDigits(int) and returns itself.
      Parameters:
      digits - Maximum number of integer digits allowed.
      Returns:
      This.
      See Also:
    • updateRegularExpression

      protected final void updateRegularExpression(boolean ignoreValueChangeFromField)
      Builds the regular expression and optionally ignores value change events from the underlying field. Basically allows the representation of the value to be changed, but not the value itself.
      Parameters:
      ignoreValueChangeFromField - Whether to ignore value change events coming from the underlying field.
    • buildAllowedCharPattern

      protected StringBuilder buildAllowedCharPattern(StringBuilder builder)
      Specifies the allowed characters and prevents invalid input.
      Parameters:
      builder - Builder to be used. Note that the builder passed to it already starts with [\d and ] is added at the end.
      Returns:
      The passed builder with added allowed characters.
    • updateRegularExpression

      protected final void updateRegularExpression()
      Builds the regular expression for matching the input.
    • updateTextInputMode

      protected void updateTextInputMode()
      Updates the underlying field's text input mode. This shows a proper on-screen keyboard on devices that support it.
    • buildRegularExpression

      protected StringBuilder buildRegularExpression(StringBuilder builder, DecimalFormat format)
      Builds regular expression that allows neat typing of the number already formatted. Overwrite with care.
      Parameters:
      builder - Builder, initially empty.
      format - Information about the format.
      Returns:
      Builder with the regular expression.
    • updateFieldValue

      protected void updateFieldValue()
      This method is called when the field loses its focus. Do not overwrite it without a very good reason.
    • getRegexp

      public String getRegexp()
      Returns the regular expression that matches the numbers as they are typed.
      Returns:
      A string with the regular expression.
    • setPresentationValue

      protected final void setPresentationValue(T number)
      Specified by:
      setPresentationValue in class com.vaadin.flow.component.customfield.CustomField<T extends Number>
    • parseRawValue

      protected abstract T parseRawValue(String rawValue, DecimalFormat format) throws ParseException
      Parses (somewhat) raw value from the text field into a proper typed value.
      Parameters:
      rawValue - Value from text field.
      format - Format to use.
      Returns:
      Parsed value.
      Throws:
      ParseException - When parsing goes wrong.
      NullPointerException - This will also be caught by the calling function, so beware.
    • generateModelValue

      protected T generateModelValue()
      Specified by:
      generateModelValue in class com.vaadin.flow.component.customfield.CustomField<T extends Number>
    • isAutoselect

      public boolean isAutoselect()
      Whether or not the component is auto-selecting upon focus. Defaults to false.
      Returns:
      true when the component will automatically select its text upon receiving focus, false otherwise.
    • setAutoselect

      public void setAutoselect(boolean autoselect)
      Changes whether or not the component will be auto-selecting upon focus.
      Parameters:
      autoselect - true when the component should automatically select its text upon receiving focus, false otherwise.
    • withAutoselect

      public final SELF withAutoselect(boolean autoselect)
      Chains setAutoselect(boolean) and returns itself.
      Parameters:
      autoselect - Autoselection value.
      Returns:
      This.
      See Also:
    • isGroupingSeparatorHiddenOnFocus

      public boolean isGroupingSeparatorHiddenOnFocus()
      Whether or not grouping separator (used typically for thousands) should be hidden when the component gets focused. Grouping separators are always shown when the component is not focused. Defaults to false.
      Returns:
      true when the value is shown without grouping separator upon focusing, false otherwise.
    • setGroupingSeparatorHiddenOnFocus

      public void setGroupingSeparatorHiddenOnFocus(boolean groupingSeparatorHiddenOnFocus)
      Changes whether or not grouping separator (used typically for thousands) should be hidden when the component gets focused. Grouping separators are always shown when the component is not focused.
      Parameters:
      groupingSeparatorHiddenOnFocus - true when the value should be shown without grouping separator upon focusing, false otherwise.
    • withGroupingSeparatorHiddenOnFocus

      public final SELF withGroupingSeparatorHiddenOnFocus(boolean groupingSeparatorHiddenOnFocus)
      Parameters:
      groupingSeparatorHiddenOnFocus - Whether or not to hide grouping separator on component focus.
      Returns:
      This.
      See Also:
    • isNegativeValueAllowed

      public boolean isNegativeValueAllowed()
      Whether or not negative values are allowed. Defaults to true.
      Returns:
      true when negative values are allowed, false when not.
    • setNegativeValueAllowed

      public void setNegativeValueAllowed(boolean negativeValueAllowed)
      Changes whether or not negative values are allowed. If this is changed while the value entered is negative, it will be switched to positive.
      Parameters:
      negativeValueAllowed - true when negative values should be allowed, false when not.
    • withNegativeValueAllowed

      public final SELF withNegativeValueAllowed(boolean negativeValueAllowed)
      Chains setNegativeValueAllowed(boolean) and returns itself.
      Parameters:
      negativeValueAllowed - Whether or not to allow negative values.
      Returns:
      This.
      See Also:
    • setPrefixComponent

      public void setPrefixComponent(com.vaadin.flow.component.Component component)
      Specified by:
      setPrefixComponent in interface com.vaadin.flow.component.shared.HasPrefix
    • getPrefixComponent

      public com.vaadin.flow.component.Component getPrefixComponent()
      Specified by:
      getPrefixComponent in interface com.vaadin.flow.component.shared.HasPrefix
    • setSuffixComponent

      public void setSuffixComponent(com.vaadin.flow.component.Component component)
      Specified by:
      setSuffixComponent in interface com.vaadin.flow.component.shared.HasSuffix
    • getSuffixComponent

      public com.vaadin.flow.component.Component getSuffixComponent()
      Specified by:
      getSuffixComponent in interface com.vaadin.flow.component.shared.HasSuffix
    • setLabel

      public void setLabel(String label)
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
      Overrides:
      setLabel in class com.vaadin.flow.component.customfield.CustomField<T extends Number>
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface com.vaadin.flow.component.HasLabel
      Overrides:
      getLabel in class com.vaadin.flow.component.customfield.CustomField<T extends Number>
    • setPlaceholder

      public void setPlaceholder(String placeholder)
      Description copied from interface: HasPlaceholder
      Sets the placeholder text for this object.
      Specified by:
      setPlaceholder in interface HasPlaceholder
      Parameters:
      placeholder - Placeholder text. Can be null, meaning no placeholder.
    • getPlaceholder

      public String getPlaceholder()
      Description copied from interface: HasPlaceholder
      Returns current placeholder text for this object.
      Specified by:
      getPlaceholder in interface HasPlaceholder
      Returns:
      Current placeholder text. Can be null, meaning no placeholder.
    • setId

      public void setId(String id)
      Description copied from interface: HasId
      Sets this object's id.
      Specified by:
      setId in interface HasId
      Overrides:
      setId in class com.vaadin.flow.component.Component
      Parameters:
      id - A new id. Can be null to remove existing id.
    • getRawValue

      public String getRawValue()
      Returns the raw value, as currently displayed in the underlying text field. This may depend on whether the component has focus, what locale is used, etc.
      Returns:
      Raw value currently displayed in the underlying text field.
    • addThemeVariants

      public void addThemeVariants(com.vaadin.flow.component.textfield.TextFieldVariant... variants)
      Allows adding theme variants to the underlying text field.
      Parameters:
      variants - Theme variants to add.
      See Also:
      • HasThemeVariant.addThemeVariants(ThemeVariant[])
    • removeThemeVariants

      public void removeThemeVariants(com.vaadin.flow.component.textfield.TextFieldVariant... variants)
      Allows removing theme variants from the underlying text field.
      Parameters:
      variants - Theme variants to remove.
      See Also:
      • HasThemeVariant.removeThemeVariants(ThemeVariant[])
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValue<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValueAndElement<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
    • isRequiredIndicatorVisible

      public boolean isRequiredIndicatorVisible()
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Specified by:
      setErrorMessage in interface com.vaadin.flow.component.HasValidation
      Specified by:
      setErrorMessage in interface com.vaadin.flow.component.shared.HasValidationProperties
    • getErrorMessage

      public String getErrorMessage()
      Specified by:
      getErrorMessage in interface com.vaadin.flow.component.HasValidation
      Specified by:
      getErrorMessage in interface com.vaadin.flow.component.shared.HasValidationProperties
    • setInvalid

      public void setInvalid(boolean invalid)
      Specified by:
      setInvalid in interface com.vaadin.flow.component.HasValidation
      Specified by:
      setInvalid in interface com.vaadin.flow.component.shared.HasValidationProperties
    • isInvalid

      public boolean isInvalid()
      Specified by:
      isInvalid in interface com.vaadin.flow.component.HasValidation
      Specified by:
      isInvalid in interface com.vaadin.flow.component.shared.HasValidationProperties
    • select

      public void select(int from, int to)
      Description copied from interface: CanSelectText
      Selects text starting from index from (inclusive) and ending at index to (exclusive).
      Specified by:
      select in interface CanSelectText
      Parameters:
      from - Starting index (inclusive).
      to - Ending index (exclusive).
    • selectAll

      public void selectAll()
      Description copied from interface: CanSelectText
      Selects entire text in the component.
      Specified by:
      selectAll in interface CanSelectText
    • selectNone

      public void selectNone()
      Description copied from interface: CanSelectText
      Removes the current selection and selects no text.
      Specified by:
      selectNone in interface CanSelectText
    • setReceivingSelectionEventsFromClient

      public void setReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient)
      Description copied from interface: CanReceiveSelectionEventsFromClient
      Configures sending events by the client-side component. Note: this feature is by default turned off.
      Specified by:
      setReceivingSelectionEventsFromClient in interface CanReceiveSelectionEventsFromClient
      Parameters:
      receivingSelectionEventsFromClient - When false, selecting text in client-side component will not send an event to server-side component. When true, it will.
    • isReceivingSelectionEventsFromClient

      public boolean isReceivingSelectionEventsFromClient()
      Description copied from interface: CanReceiveSelectionEventsFromClient
      Check if client will inform server on selection change. Note: this feature is by default turned off.
      Specified by:
      isReceivingSelectionEventsFromClient in interface CanReceiveSelectionEventsFromClient
      Returns:
      When true, each selection change in the client-side component will result in this component broadcasting a TextSelectionEvent.
    • addTextSelectionListener

      public com.vaadin.flow.shared.Registration addTextSelectionListener(TextSelectionListener<SELF> listener)
      Description copied from interface: TextSelectionNotifier
      Adds the listener.
      Specified by:
      addTextSelectionListener in interface TextSelectionNotifier<T extends Number>
      Parameters:
      listener - A listener to add.
      Returns:
      A Registration that can be used to stop listening to the event.
    • withReceivingSelectionEventsFromClient

      public SELF withReceivingSelectionEventsFromClient(boolean receivingSelectionEventsFromClient)
      Description copied from interface: WithReceivingSelectionEventsFromClientMixin
      Chains CanReceiveSelectionEventsFromClient.setReceivingSelectionEventsFromClient(boolean) and returns itself. Note: this feature is by default turned off.
      Specified by:
      withReceivingSelectionEventsFromClient in interface WithReceivingSelectionEventsFromClientMixin<T extends Number>
      Parameters:
      receivingSelectionEventsFromClient - Whether the client should send events about text selection changes.
      Returns:
      This.
      See Also:
    • setNullValueAllowed

      public final void setNullValueAllowed(boolean allowingNullValue)
      Description copied from interface: HasNullValueOptionallyAllowed
      Sets allowance of null as this component's value.
      Specified by:
      setNullValueAllowed in interface HasNullValueOptionallyAllowed<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
      Parameters:
      allowingNullValue - Whether to allow null as a value.
    • isNullValueAllowed

      public boolean isNullValueAllowed()
      Description copied from interface: HasNullValueOptionallyAllowed
      Checks whether null is allowed as a value of the component.
      Specified by:
      isNullValueAllowed in interface HasNullValueOptionallyAllowed<T extends Number,SELF extends AbstractSuperNumberField<T,SELF>>
      Returns:
      Whether null is allowed as a value. Should default to false.
    • setHelperComponent

      public void setHelperComponent(com.vaadin.flow.component.Component component)
      Specified by:
      setHelperComponent in interface com.vaadin.flow.component.HasHelper
    • setHelperText

      public void setHelperText(String helperText)
      Specified by:
      setHelperText in interface com.vaadin.flow.component.HasHelper
    • getHelperComponent

      public com.vaadin.flow.component.Component getHelperComponent()
      Specified by:
      getHelperComponent in interface com.vaadin.flow.component.HasHelper
    • getHelperText

      public String getHelperText()
      Specified by:
      getHelperText in interface com.vaadin.flow.component.HasHelper
    • setHelperAbove

      public void setHelperAbove()
      Description copied from interface: HasHelperPositionable
      Positions the helper above the component.
      Specified by:
      setHelperAbove in interface HasHelperPositionable
    • setHelperBelow

      public void setHelperBelow()
      Description copied from interface: HasHelperPositionable
      Positions the helper below the component.
      Specified by:
      setHelperBelow in interface HasHelperPositionable
    • setHelperAbove

      public void setHelperAbove(boolean above)
      Description copied from interface: HasHelperPositionable
      Positions the helper above or below the component.
      Specified by:
      setHelperAbove in interface HasHelperPositionable
      Parameters:
      above - When true, helper should be positioned above.
      See Also:
    • isHelperAbove

      public boolean isHelperAbove()
      Description copied from interface: HasHelperPositionable
      Checks if the helper is positioned above.
      Specified by:
      isHelperAbove in interface HasHelperPositionable
      Returns:
      When true, helper should be positioned above.
    • setTooltipText

      public com.vaadin.flow.component.shared.Tooltip setTooltipText(String text)
      Specified by:
      setTooltipText in interface com.vaadin.flow.component.shared.HasTooltip
    • getTooltip

      public com.vaadin.flow.component.shared.Tooltip getTooltip()
      Specified by:
      getTooltip in interface com.vaadin.flow.component.shared.HasTooltip
    • setValueChangeMode

      public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
      Specified by:
      setValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeMode
    • getValueChangeMode

      public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()
      Specified by:
      getValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeMode
    • setValueChangeTimeout

      public void setValueChangeTimeout(int valueChangeTimeout)
      Specified by:
      setValueChangeTimeout in interface com.vaadin.flow.data.value.HasValueChangeMode
    • getValueChangeTimeout

      public int getValueChangeTimeout()
      Specified by:
      getValueChangeTimeout in interface com.vaadin.flow.data.value.HasValueChangeMode
    • isFocused

      protected final boolean isFocused()
      Checks if the field is currently focused (underlying field received a focus event). Blurring the field causes it to lose focus.
      Returns:
      true when the field has focus.
    • focus

      public void focus()
      Specified by:
      focus in interface com.vaadin.flow.component.Focusable<T extends Number>
    • blur

      public void blur()
      Specified by:
      blur in interface com.vaadin.flow.component.Focusable<T extends Number>
    • setClearButtonVisible

      public void setClearButtonVisible(boolean state)
      Specified by:
      setClearButtonVisible in interface com.vaadin.flow.component.shared.HasClearButton
    • isClearButtonVisible

      public boolean isClearButtonVisible()
      Specified by:
      isClearButtonVisible in interface com.vaadin.flow.component.shared.HasClearButton
    • setRequired

      public void setRequired(boolean required)
      Description copied from interface: HasRequired
      Sets the new required state.
      Specified by:
      setRequired in interface HasRequired
      Parameters:
      required - Whether this component should be required.
    • isRequired

      public boolean isRequired()
      Description copied from interface: HasRequired
      Checks if this object is required.
      Specified by:
      isRequired in interface HasRequired
      Returns:
      Whether this component is required.
    • setLabelPosition

      public void setLabelPosition(LabelPosition position)
      Description copied from interface: HasLabelPositionable
      Sets the label position to a new one.
      Specified by:
      setLabelPosition in interface HasLabelPositionable
      Parameters:
      position - A position to use. Setting null will reset it to the default setting.
    • getLabelPosition

      public LabelPosition getLabelPosition()
      Description copied from interface: HasLabelPositionable
      Returns current label position, if it has been set.
      Specified by:
      getLabelPosition in interface HasLabelPositionable
      Returns:
      A LabelPosition.
    • setTextInputMode

      public void setTextInputMode(TextInputMode inputMode)
      Description copied from interface: HasTextInputMode
      Changes the text input mode of this object.
      Specified by:
      setTextInputMode in interface HasTextInputMode
      Parameters:
      inputMode - New input mode. Can be null.
    • getTextInputMode

      public TextInputMode getTextInputMode()
      Description copied from interface: HasTextInputMode
      Returns the current text input mode of this object.
      Specified by:
      getTextInputMode in interface HasTextInputMode
      Returns:
      A TextInputMode, or null if none has been set.
    • isOverlappingAlternatives

      public boolean isOverlappingAlternatives()
      Checks if alternative symbols are allowed to overlap with one another and the default locale's symbols.
      Returns:
      true when overlapping between symbols is allowed; false otherwise and by default.
    • setOverlappingAlternatives

      public void setOverlappingAlternatives(boolean overlappingAlternatives)
      Allows (or disallows) alternative grouping, separator and negative sign symbols to overlap with each other and with the locale's default symbols. Note that this may lead to some unexpected results. Alternative symbols are always replaced in fixed order: negative sign, grouping symbols, decimal separator symbols.
      Parameters:
      overlappingAlternatives - When true, overlapping between symbols will be allowed.
    • withOverlappingAlternatives

      public SELF withOverlappingAlternatives(boolean overlappingAlternatives)
      Chains setOverlappingAlternatives(boolean) and returns itself.
      Parameters:
      overlappingAlternatives - Whether to allow overlapping alternatives.
      Returns:
      This.
      See Also:
    • withOverlappingAlternatives

      public SELF withOverlappingAlternatives()
      Chains setOverlappingAlternatives(boolean) with true as a parameter, and returns itself.
      Returns:
      This.
      See Also:
    • withoutOverlappingAlternatives

      public SELF withoutOverlappingAlternatives()
      Chains setOverlappingAlternatives(boolean) with false as a parameter, and returns itself.
      Returns:
      This.
      See Also:
    • setKeyboardDisallowedAlternatives

      public void setKeyboardDisallowedAlternatives(Set<Character> characters)
      Prevents specified alternative characters from being typed with keyboard. Only the characters that are also used as grouping separator, decimal separator or negative sign alternative are prevented. This alters the underlying field's allowed char pattern; it is still possible to paste text with that character.
      Parameters:
      characters - Characters to be disallowed.
    • getKeyboardDisallowedAlternatives

      public Set<Character> getKeyboardDisallowedAlternatives()
      Returns the set of characters that are prevented from being typed in. Note that this set may include more characters than the alternative symbols.
      Returns:
      A set of characters that, if they are an alternative symbol, cannot be typed in. Never null, but possibly empty.
    • withKeyboardDisallowedAlternatives

      public SELF withKeyboardDisallowedAlternatives(Set<Character> characters)
      Chains setKeyboardDisallowedAlternatives(Set) and returns itself.
      Parameters:
      characters - Characters to disallow.
      Returns:
      This.
      See Also:
    • withKeyboardDisallowedAlternatives

      public SELF withKeyboardDisallowedAlternatives(char... characters)
      Chains setKeyboardDisallowedAlternatives(Set) and returns itself.
      Parameters:
      characters - Characters to disallow.
      Returns:
      This.
      See Also:
    • getGroupingSeparatorAlternatives

      public Set<Character> getGroupingSeparatorAlternatives()
      Returns the currently accepted alternatives to the grouping (thousand) separator.
      Returns:
      Currently allowed alternatives to the main grouping separator, which is not included in the result. Never null, but possibly empty.
    • setGroupingSeparatorAlternatives

      public void setGroupingSeparatorAlternatives(Set<Character> alternatives)
      Sets grouping separator alternatives, replacing previously existing ones. Note that this preserves the automatically added SPACE when the format uses NON_BREAKING_SPACE.
      Parameters:
      alternatives - Any alternatives that are identical to the already used separators or negative sign or their alternatives are ignored.
    • withGroupingSeparatorAlternatives

      public SELF withGroupingSeparatorAlternatives(Set<Character> alternatives)
      Chains setGroupingSeparatorAlternatives(Set) and returns itself.
      Parameters:
      alternatives - Alternatives to use.
      Returns:
      This.
      See Also:
    • withGroupingSeparatorAlternatives

      public SELF withGroupingSeparatorAlternatives(char... alternatives)
      Chains setGroupingSeparatorAlternatives(Set) and returns itself.
      Parameters:
      alternatives - Alternatives to use.
      Returns:
      This.
      See Also:
    • getDecimalSeparatorAlternatives

      protected Set<Character> getDecimalSeparatorAlternatives()
      Returns the currently accepted alternatives to the decimal separator.
      Returns:
      Currently allowed alternatives to the main decimal separator, which is not included in the result. Never null, but possibly empty.
    • setDecimalSeparatorAlternatives

      protected void setDecimalSeparatorAlternatives(Set<Character> alternatives)
      Sets decimal separator alternatives, replacing previously existing ones.
      Parameters:
      alternatives - Any alternatives that are identical to the already used separators or negative sign or their alternatives are ignored.
    • withDecimalSeparatorAlternatives

      protected SELF withDecimalSeparatorAlternatives(Set<Character> alternatives)
      Chains setDecimalSeparatorAlternatives(Set) and returns itself.
      Parameters:
      alternatives - Alternatives to use.
      Returns:
      This.
      See Also:
    • withDecimalSeparatorAlternatives

      protected SELF withDecimalSeparatorAlternatives(char... alternatives)
      Chains setDecimalSeparatorAlternatives(Set) and returns itself.
      Parameters:
      alternatives - Alternatives to use.
      Returns:
      This.
      See Also:
    • getNegativeSignAlternatives

      public Set<Character> getNegativeSignAlternatives()
      Returns the currently accepted alternatives to the negative (minus) sign.
      Returns:
      Currently allowed alternatives to the main negative sign, which is not included in the result. Never null, but possibly empty.
    • setNegativeSignAlternatives

      public void setNegativeSignAlternatives(Set<Character> alternatives)
      Sets negative sign alternatives, replacing previously existing ones.
      Parameters:
      alternatives - Any alternatives that are identical to the already used separators or negative sign or their alternatives are ignored.
    • withNegativeSignAlternatives

      public SELF withNegativeSignAlternatives(Set<Character> alternatives)
      Chains setNegativeSignAlternatives(Set) and returns itself.
      Parameters:
      alternatives - Alternatives to use.
      Returns:
      This.
      See Also:
    • withNegativeSignAlternatives

      public SELF withNegativeSignAlternatives(char... alternatives)
      Chains setNegativeSignAlternatives(Set) and returns itself.
      Parameters:
      alternatives - Alternatives to use.
      Returns:
      This.
      See Also: