Class TextFieldBase<TComponent extends TextFieldBase<TComponent,TValue>,TValue>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<TComponent,TValue>
com.vaadin.flow.component.textfield.TextFieldBase<TComponent,TValue>
Type Parameters:
TComponent - Type of the component that extends from this class
TValue - Type of the value of the extending component
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<TComponent>, com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<TComponent>, com.vaadin.flow.component.FocusNotifier<TComponent>, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasPlaceholder, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TComponent,TValue>,TValue>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TComponent,TValue>,TValue>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, HasClearButton, HasPrefix, HasSuffix, HasTooltip, HasValidationProperties, InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TComponent,TValue>,TValue>, HasAutocapitalize, HasAutocomplete, HasAutocorrect, com.vaadin.flow.data.binder.HasValidator<TValue>, com.vaadin.flow.data.value.HasValueChangeMode, Serializable
Direct Known Subclasses:
AbstractNumberField, BigDecimalField, EmailField, PasswordField, TextArea, TextField

public abstract class TextFieldBase<TComponent extends TextFieldBase<TComponent,TValue>,TValue> extends com.vaadin.flow.component.AbstractSinglePropertyField<TComponent,TValue> implements com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.Focusable<TComponent>, com.vaadin.flow.component.HasAriaLabel, HasAutocapitalize, HasAutocomplete, HasAutocorrect, HasClearButton, HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<TValue>, com.vaadin.flow.data.value.HasValueChangeMode, com.vaadin.flow.component.HasPlaceholder, HasPrefix, HasSuffix, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TComponent,TValue>,TValue>
Internal class that provides base functionality for input field components, such as TextField. Not intended to be used publicly.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField

    com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue

    com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
  • Field Summary

    Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize

    AUTOCAPITALIZE_ATTRIBUTE

    Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete

    AUTOCOMPLETE_ATTRIBUTE

    Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect

    AUTOCORRECT_ATTRIBUTE

    Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode

    DEFAULT_CHANGE_TIMEOUT
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addToInput(com.vaadin.flow.component.Component... components)
    Adds the given components as children of this component at the slot 'input'.
    protected void
    addToPrefix(com.vaadin.flow.component.Component... components)
    Adds the given components as children of this component at the slot 'prefix'.
    protected void
    addToSuffix(com.vaadin.flow.component.Component... components)
    Adds the given components as children of this component at the slot 'suffix'.
     
     
    The text usually displayed in a tooltip popup when the mouse is over the field.
    com.vaadin.flow.data.value.ValueChangeMode
    int
     
    boolean
    Specify that this control should have input focus when the page loads.
    boolean
    Specifies if the field value gets automatically selected when the field gains focus.
    boolean
    boolean
    Gets whether the user is required to provide a value.
    void
    setAriaLabel(String ariaLabel)
     
    void
     
    void
    setAutofocus(boolean autofocus)
    Sets the whether the component should automatically receive focus when the page loads.
    void
    setAutoselect(boolean autoselect)
    Set to true to always have the field value automatically selected when the field gains focus, false otherwise.
    void
     
    void
    setRequired(boolean required)
    void
    setRequiredIndicatorVisible(boolean required)
    Sets whether the user is required to provide a value.
    void
    The text usually displayed in a tooltip popup when the mouse is over the field.
    void
    setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
     
    void
    setValueChangeTimeout(int valueChangeTimeout)
     

    Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField

    getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.CompositionNotifier

    addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize

    getAutocapitalize, setAutocapitalize

    Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete

    getAutocomplete, setAutocomplete

    Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect

    isAutocorrect, setAutocorrect

    Methods inherited from interface com.vaadin.flow.component.shared.HasClearButton

    isClearButtonVisible, setClearButtonVisible

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasHelper

    getHelperComponent, getHelperText, setHelperComponent, setHelperText

    Methods inherited from interface com.vaadin.flow.component.HasLabel

    getLabel

    Methods inherited from interface com.vaadin.flow.component.HasPlaceholder

    getPlaceholder, setPlaceholder

    Methods inherited from interface com.vaadin.flow.component.shared.HasPrefix

    getPrefixComponent, setPrefixComponent

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.shared.HasSuffix

    getSuffixComponent, setSuffixComponent

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    getTooltip, setTooltipText

    Methods inherited from interface com.vaadin.flow.component.HasValidation

    setManualValidation

    Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties

    getErrorMessage, isInvalid, setErrorMessage, setInvalid

    Methods inherited from interface com.vaadin.flow.data.binder.HasValidator

    addValidationStatusChangeListener, getDefaultValidator

    Methods inherited from interface com.vaadin.flow.component.HasValue

    addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValue

    Methods inherited from interface com.vaadin.flow.component.HasValueAndElement

    isReadOnly, setReadOnly

    Methods inherited from interface com.vaadin.flow.component.InputNotifier

    addInputListener

    Methods inherited from interface com.vaadin.flow.component.KeyNotifier

    addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
  • Method Details

    • getValueChangeMode

      public com.vaadin.flow.data.value.ValueChangeMode getValueChangeMode()

      The default value is ValueChangeMode.ON_CHANGE.

      Specified by:
      getValueChangeMode in interface com.vaadin.flow.data.value.HasValueChangeMode
    • setValueChangeMode

      public void setValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode valueChangeMode)
      Specified by:
      setValueChangeMode 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
    • setAutofocus

      public void setAutofocus(boolean autofocus)
      Sets the whether the component should automatically receive focus when the page loads. Defaults to false.
      Parameters:
      autofocus - true component should automatically receive focus
    • isAutofocus

      public boolean isAutofocus()
      Specify that this control should have input focus when the page loads.
      Returns:
      the autofocus property from the webcomponent
    • getTitle

      public String getTitle()
      The text usually displayed in a tooltip popup when the mouse is over the field.
      Returns:
      the title property from the webcomponent
    • setTitle

      public void setTitle(String title)
      The text usually displayed in a tooltip popup when the mouse is over the field.
      Parameters:
      title - the String value to set
    • isAutoselect

      public boolean isAutoselect()
      Specifies if the field value gets automatically selected when the field gains focus.
      Returns:
      true if autoselect is active, false otherwise
    • setAutoselect

      public void setAutoselect(boolean autoselect)
      Set to true to always have the field value automatically selected when the field gains focus, false otherwise.
      Parameters:
      autoselect - true to set auto select on, false otherwise
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean required)
      Sets whether the user is required to provide a value. When required, an indicator appears next to the label and the field invalidates if the value is cleared.

      NOTE: The required indicator is only visible when the field has a label, see setLabel(String).

      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<TComponent extends TextFieldBase<TComponent,TValue>,TValue>
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<TComponent extends TextFieldBase<TComponent,TValue>,TValue>
      Parameters:
      required - true to make the field required, false otherwise
    • isRequiredIndicatorVisible

      public boolean isRequiredIndicatorVisible()
      Gets whether the user is required to provide a value.
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<TComponent extends TextFieldBase<TComponent,TValue>,TValue>
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<TComponent extends TextFieldBase<TComponent,TValue>,TValue>
      Returns:
      true if the field is required, false otherwise
      See Also:
    • setRequired

      public void setRequired(boolean required)
      Parameters:
      required - true to make the field required, false otherwise
    • isRequired

      public boolean isRequired()
      Returns:
      true if the field is required, false otherwise
    • setLabel

      public void setLabel(String label)
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
    • setAriaLabel

      public void setAriaLabel(String ariaLabel)
      Specified by:
      setAriaLabel in interface com.vaadin.flow.component.HasAriaLabel
    • getAriaLabel

      public Optional<String> getAriaLabel()
      Specified by:
      getAriaLabel in interface com.vaadin.flow.component.HasAriaLabel
    • setAriaLabelledBy

      public void setAriaLabelledBy(String labelledBy)
      Specified by:
      setAriaLabelledBy in interface com.vaadin.flow.component.HasAriaLabel
    • getAriaLabelledBy

      public Optional<String> getAriaLabelledBy()
      Specified by:
      getAriaLabelledBy in interface com.vaadin.flow.component.HasAriaLabel
    • addToPrefix

      protected void addToPrefix(com.vaadin.flow.component.Component... components)
      Adds the given components as children of this component at the slot 'prefix'.
      Parameters:
      components - The components to add.
      See Also:
    • addToInput

      protected void addToInput(com.vaadin.flow.component.Component... components)
      Adds the given components as children of this component at the slot 'input'.
      Parameters:
      components - The components to add.
      See Also:
    • addToSuffix

      protected void addToSuffix(com.vaadin.flow.component.Component... components)
      Adds the given components as children of this component at the slot 'suffix'.
      Parameters:
      components - The components to add.
      See Also: