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:
AttachNotifier, BlurNotifier<TComponent>, CompositionNotifier, DetachNotifier, Focusable<TComponent>, FocusNotifier<TComponent>, HasElement, HasEnabled, HasHelper, HasLabel, HasSize, HasStyle, HasValidation, HasValue<AbstractField.ComponentValueChangeEvent<TComponent,TValue>,TValue>, HasValueAndElement<AbstractField.ComponentValueChangeEvent<TComponent,TValue>,TValue>, InputNotifier, KeyNotifier, HasClearButton, HasClientValidation, HasPrefix, HasSuffix, HasTooltip, HasValidationProperties, HasAutocapitalize, HasAutocomplete, HasAutocorrect, HasPrefixAndSuffix, HasValidator<TValue>, HasValueChangeMode, Serializable
Direct Known Subclasses:
AbstractNumberField, BigDecimalField, EmailField, PasswordField, TextArea, TextField

public abstract class TextFieldBase<TComponent extends TextFieldBase<TComponent,TValue>,TValue> extends AbstractSinglePropertyField<TComponent,TValue> implements CompositionNotifier, Focusable<TComponent>, HasAutocapitalize, HasAutocomplete, HasAutocorrect, HasClearButton, HasClientValidation, HasHelper, HasLabel, HasPrefixAndSuffix, HasSize, HasStyle, HasTooltip, HasValidationProperties, HasValidator<TValue>, HasValueChangeMode, InputNotifier, KeyNotifier
Internal class that provides base functionality for input field components, such as TextField. Not intended to be used publicly.
See Also:
  • Method Details

    • getValueChangeMode

      public ValueChangeMode getValueChangeMode()
      Gets current value change mode of the component.

      The default value is ValueChangeMode.ON_CHANGE.

      Specified by:
      getValueChangeMode in interface HasValueChangeMode
      Returns:
      current value change mode of the component, or null if the value is not synchronized
    • setValueChangeMode

      public void setValueChangeMode(ValueChangeMode valueChangeMode)
      Description copied from interface: HasValueChangeMode
      Sets new value change mode for the component.
      Specified by:
      setValueChangeMode in interface HasValueChangeMode
      Parameters:
      valueChangeMode - new value change mode, or null to disable the value synchronization
    • setValueChangeTimeout

      public void setValueChangeTimeout(int valueChangeTimeout)
      Description copied from interface: HasValueChangeMode
      Sets how often HasValue.ValueChangeEvents are triggered when the ValueChangeMode is set to ValueChangeMode.LAZY, or ValueChangeMode.TIMEOUT.

      Implementations should use ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration).

      Specified by:
      setValueChangeTimeout in interface HasValueChangeMode
      Parameters:
      valueChangeTimeout - the timeout in milliseconds of how often HasValue.ValueChangeEvents are triggered.
    • getValueChangeTimeout

      public int getValueChangeTimeout()
      Description copied from interface: HasValueChangeMode
      Returns the currently set timeout, for how often HasValue.ValueChangeEvents are triggered when the ValueChangeMode is set to ValueChangeMode.LAZY, or ValueChangeMode.TIMEOUT.
      Specified by:
      getValueChangeTimeout in interface HasValueChangeMode
      Returns:
      the timeout in milliseconds of how often HasValue.ValueChangeEvents are triggered.
    • setPlaceholder

      public void setPlaceholder(String placeholder)
      Sets the placeholder text that should be displayed in the input element, when the user has not entered a value
      Parameters:
      placeholder - the placeholder text
    • getPlaceholder

      public String getPlaceholder()
      The placeholder text that should be displayed in the input element, when the user has not entered a value
      Returns:
      the placeholder property from the web component
    • 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
    • setRequired

      public void setRequired(boolean required)
      Specifies that the user must fill in a value.
      Parameters:
      required - the boolean value to set
    • isRequired

      public boolean isRequired()
      Determines whether the field is marked as input required.
      Returns:
      true if the input is required, false otherwise
    • addToPrefix

      protected void addToPrefix(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(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(Component... components)
      Adds the given components as children of this component at the slot 'suffix'.
      Parameters:
      components - The components to add.
      See Also: