Class TextArea

    • 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<?>>
    • Constructor Summary

      Constructors 
      Constructor Description
      TextArea()
      Constructs an empty TextArea.
      TextArea​(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>> listener)
      Constructs an empty TextArea with a value change listener.
      TextArea​(String label)
      Constructs an empty TextArea with the given label.
      TextArea​(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>> listener)
      Constructs an empty TextArea with a label and a value change listener.
      TextArea​(String label, String placeholder)
      Constructs an empty TextArea with the given label and placeholder text.
      TextArea​(String label, String initialValue, com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>> listener)
      Constructs an empty TextArea with a label, a value change listener and an initial value.
      TextArea​(String label, String initialValue, String placeholder)
      Constructs a TextArea with the given label, an initial value and placeholder text.
    • Constructor Detail

      • TextArea

        public TextArea()
        Constructs an empty TextArea.
      • TextArea

        public TextArea​(String label)
        Constructs an empty TextArea with the given label.
        Parameters:
        label - the text to set as the label
      • TextArea

        public TextArea​(String label,
                        String placeholder)
        Constructs an empty TextArea with the given label and placeholder text.
        Parameters:
        label - the text to set as the label
        placeholder - the placeholder text to set
      • TextArea

        public TextArea​(String label,
                        String initialValue,
                        String placeholder)
        Constructs a TextArea with the given label, an initial value and placeholder text.
        Parameters:
        label - the text to set as the label
        initialValue - the initial value
        placeholder - the placeholder text to set
        See Also:
        AbstractField.setValue(Object), setPlaceholder(String)
      • TextArea

        public TextArea​(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>> listener)
        Constructs an empty TextArea with a value change listener.
        Parameters:
        listener - the value change listener
        See Also:
        AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
      • TextArea

        public TextArea​(String label,
                        com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>> listener)
        Constructs an empty TextArea with a label and a value change listener.
        Parameters:
        label - the text to set as the label
        listener - the value change listener
        See Also:
        setLabel(String), AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
      • TextArea

        public TextArea​(String label,
                        String initialValue,
                        com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>> listener)
        Constructs an empty TextArea with a label, a value change listener and an initial value.
        Parameters:
        label - the text to set as the label
        initialValue - the initial value
        listener - the value change listener
        See Also:
        setLabel(String), AbstractField.setValue(Object), AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)
    • Method Detail

      • 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
      • getErrorMessage

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

        public void setErrorMessage​(String errorMessage)
        Description copied from class: GeneratedVaadinTextArea

        Description copied from corresponding location in WebComponent:

        Error to show when the input value is invalid.

        Specified by:
        setErrorMessage in interface com.vaadin.flow.component.HasValidation
        Overrides:
        setErrorMessage in class GeneratedVaadinTextArea<TextArea,​String>
        Parameters:
        errorMessage - the String value to set
      • isInvalid

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

        public void setInvalid​(boolean invalid)
        Description copied from class: GeneratedVaadinTextArea

        Description copied from corresponding location in WebComponent:

        This property is set to true when the control value is invalid.

        Specified by:
        setInvalid in interface com.vaadin.flow.component.HasValidation
        Overrides:
        setInvalid in class GeneratedVaadinTextArea<TextArea,​String>
        Parameters:
        invalid - the boolean value to set
      • setLabel

        public void setLabel​(String label)
        Description copied from class: GeneratedVaadinTextArea

        Description copied from corresponding location in WebComponent:

        String used for the label element.

        Specified by:
        setLabel in interface com.vaadin.flow.component.HasLabel
        Overrides:
        setLabel in class GeneratedVaadinTextArea<TextArea,​String>
        Parameters:
        label - the String value to set
      • getLabel

        public String getLabel()
        String used for the label element.
        Specified by:
        getLabel in interface com.vaadin.flow.component.HasLabel
        Returns:
        the label property from the webcomponent
      • getPlaceholder

        public String getPlaceholder()
        A hint to the user of what can be entered in the component.
        Returns:
        the placeholder property from the webcomponent
      • 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.
        Overrides:
        setAutoselect in class GeneratedVaadinTextArea<TextArea,​String>
        Parameters:
        autoselect - true to set auto select on, false otherwise
      • setAutofocus

        public void setAutofocus​(boolean autofocus)
        Description copied from class: GeneratedVaadinTextArea

        Description copied from corresponding location in WebComponent:

        Specify that this control should have input focus when the page loads.

        Overrides:
        setAutofocus in class GeneratedVaadinTextArea<TextArea,​String>
        Parameters:
        autofocus - the boolean value to set
      • isAutofocus

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

        public void setMaxLength​(int maxLength)
        Maximum number of characters (in Unicode code points) that the user can enter.
        Parameters:
        maxLength - the maximum length
      • getMaxLength

        public int getMaxLength()
        Maximum number of characters (in Unicode code points) that the user can enter.
        Returns:
        the maxlength property from the webcomponent
      • setMinLength

        public void setMinLength​(int minLength)
        Minimum number of characters (in Unicode code points) that the user can enter.
        Parameters:
        minLength - the minimum length
      • getMinLength

        public int getMinLength()
        Minimum number of characters (in Unicode code points) that the user can enter.
        Returns:
        the minlength property from the webcomponent
      • isRequired

        public boolean isRequired()
        Specifies that the user must fill in a value.
        Returns:
        the required property from the webcomponent
      • isPreventInvalidInput

        @Deprecated
        public boolean isPreventInvalidInput()
        Deprecated.
        Since 23.2, this API is deprecated.
        When set to true, user is prevented from typing a value that conflicts with the given pattern.
        Returns:
        the preventInvalidInput property from the webcomponent
      • getPattern

        public String getPattern()
        A regular expression that the value is checked against. The pattern must match the entire value, not just some subset.
        Returns:
        the pattern property
      • getEmptyValue

        public String getEmptyValue()
        Specified by:
        getEmptyValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>,​String>
        Overrides:
        getEmptyValue in class com.vaadin.flow.component.AbstractField<TextArea,​String>
      • setValue

        public void setValue​(String value)
        Sets the value of this text area. If the new value is not equal to getValue(), fires a value change event. Throws NullPointerException, if the value is null.

        Note: Binder will take care of the null conversion when integrates with text area, as long as no new converter is defined.

        Specified by:
        setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>,​String>
        Overrides:
        setValue in class com.vaadin.flow.component.AbstractField<TextArea,​String>
        Parameters:
        value - the new value, not null
      • getValue

        public String getValue()
        Returns the current value of the text area. By default, the empty text area will return an empty string.
        Specified by:
        getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>,​String>
        Overrides:
        getValue in class com.vaadin.flow.component.AbstractField<TextArea,​String>
        Returns:
        the current value.
      • setRequiredIndicatorVisible

        public void setRequiredIndicatorVisible​(boolean requiredIndicatorVisible)
        Specified by:
        setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>,​String>
        Specified by:
        setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<TextArea,​String>,​String>
      • getDefaultValidator

        public com.vaadin.flow.data.binder.Validator<String> getDefaultValidator()
        Specified by:
        getDefaultValidator in interface com.vaadin.flow.data.binder.HasValidator<String>
      • validate

        protected void validate()
        Performs server-side validation of the current value. This is needed because it is possible to circumvent the client-side validation constraints using browser development tools.
        Overrides:
        validate in class GeneratedVaadinTextArea<TextArea,​String>
      • onAttach

        protected void onAttach​(com.vaadin.flow.component.AttachEvent attachEvent)
        Overrides:
        onAttach in class com.vaadin.flow.component.Component
      • isFeatureFlagEnabled

        protected boolean isFeatureFlagEnabled​(com.vaadin.experimental.Feature feature)
        Returns true if the given feature flag is enabled, false otherwise.

        Exposed with protected visibility to support mocking

        The method requires the VaadinService instance to obtain the available feature flags, otherwise, the feature is considered disabled.

        Parameters:
        feature - the feature flag.
        Returns:
        whether the feature flag is enabled.