Class FTextArea

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.textfield.TextArea,String>
com.vaadin.flow.component.AbstractSinglePropertyField<com.vaadin.flow.component.textfield.TextArea,String>
com.vaadin.flow.component.textfield.TextFieldBase<com.vaadin.flow.component.textfield.TextArea,String>
com.vaadin.flow.component.textfield.TextArea
com.vaadin.featurepack.ui.FTextArea
All Implemented Interfaces:
Buffered, BufferedValidatable, Property<String>, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Field<String>, Validatable, FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, ClientConnector, FAbstractClientConnector, FSizeable, HasSizeable, FAbstractComponent, FAbstractTextField, HasInputColumns, InputSelectionCapable<String>, NullValueCapable<String>, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.textfield.TextArea>, com.vaadin.flow.component.CompositionNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.textfield.TextArea>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.textfield.TextArea>, com.vaadin.flow.component.HasAriaDescription, 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.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>, com.vaadin.flow.component.InputNotifier, com.vaadin.flow.component.KeyNotifier, com.vaadin.flow.component.shared.HasAllowedCharPattern, com.vaadin.flow.component.shared.HasClearButton, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasTextSelection, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.textfield.TextAreaVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>, com.vaadin.flow.component.textfield.HasAutocapitalize, com.vaadin.flow.component.textfield.HasAutocomplete, com.vaadin.flow.component.textfield.HasAutocorrect, com.vaadin.flow.data.binder.HasValidator<String>, com.vaadin.flow.data.value.HasValueChangeMode, Serializable

@CssImport("@vaadin/vaadin-lumo-styles/lumo.css") public class FTextArea extends com.vaadin.flow.component.textfield.TextArea implements FAbstractTextField
A Flow component that wraps a TextArea and implements v7 functionalities that the Flow counterpart does not possess.
See Also:
  • Constructor Details

    • FTextArea

      public FTextArea()
      Constructs an empty FTextArea.
    • FTextArea

      public FTextArea(String caption)
      Constructs an empty FTextArea with the provided caption.
      Parameters:
      caption - the caption to set
    • FTextArea

      public FTextArea(String caption, String value)
      Constructs a new FTextArea with the provided caption and initial value.
      Parameters:
      caption - the caption to set
      value - the initial value to set
    • FTextArea

      public FTextArea(Property dataSource)
      Constructs a new FTextArea that's bound to the specified Property.
      Parameters:
      dataSource - the Property to be edited
    • FTextArea

      public FTextArea(String caption, Property dataSource)
      Constructs a new FTextArea that's bound to the specified Property and has the provided caption String.
      Parameters:
      caption - the caption to set
      dataSource - the Property to be edited
  • Method Details

    • validate

      public void validate()
      Description copied from interface: Validatable

      Checks the validity of the validatable. If the validatable is valid this method should do nothing, and if it's not valid, it should throw Validator.InvalidValueException

      Specified by:
      validate in interface Validatable
      Overrides:
      validate in class com.vaadin.flow.component.textfield.TextArea
    • setHeight

      public void setHeight(String height)
      Description copied from interface: FSizeable
      Sets the height of the component using String presentation.

      String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size.

      The empty string ("") or null will unset the height and set the units to pixels.

      See CSS specification for more details.

      Specified by:
      setHeight in interface FSizeable
      Specified by:
      setHeight in interface com.vaadin.flow.component.HasSize
      Specified by:
      setHeight in interface HasSizeable
      Parameters:
      height - in CSS style string representation
    • setHeight

      public void setHeight(float height, com.vaadin.flow.component.Unit unit)
      Description copied from interface: FSizeable
      Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
      Specified by:
      setHeight in interface FSizeable
      Specified by:
      setHeight in interface com.vaadin.flow.component.HasSize
      Specified by:
      setHeight in interface HasSizeable
      Parameters:
      height - the height of the object.
      unit - the unit used for the width.
    • setRows

      public void setRows(int rows)
      Sets the number of rows in the text area. If the text area has a defined height, this value is disregarded. The minimum height cannot be less than that of 2 rows. The initial value is 5.
      Parameters:
      rows - the number of rows for this text area
    • getRows

      public int getRows()
      Gets the number of rows in the text area.
      Returns:
      number of explicitly set rows
    • setWordwrap

      public void setWordwrap(boolean wordwrap)
      Sets the text area's word-wrap mode on or off.
      Parameters:
      wordwrap - whether the word-wrap mode is on
    • isWordwrap

      public boolean isWordwrap()
      Returns whether the text area is in word-wrap mode. The default is true.
      Returns:
      whether the text area is in word-wrap mode, true by default
    • setValue

      public void setValue(String value)
      Sets the value of the field. If the value matches the null representation, the logical value will be null but the null representation will be displayed.
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>
      Specified by:
      setValue in interface Property<String>
      Overrides:
      setValue in class com.vaadin.flow.component.textfield.TextArea
      Parameters:
      value - the value to set
    • getValue

      public String getValue()
      Returns the logical value of the field. If the stored logical value is null, this method returns null, otherwise it returns the displayed text.
      Specified by:
      getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>
      Specified by:
      getValue in interface Property<String>
      Overrides:
      getValue in class com.vaadin.flow.component.textfield.TextArea
      Returns:
      the logical value of this field, potentially null
    • isEmpty

      public boolean isEmpty()
      Checks whether the field is logically empty. Returns true if the value is an empty string or null.
      Specified by:
      isEmpty in interface Field<String>
      Specified by:
      isEmpty in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>
      Overrides:
      isEmpty in class com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.textfield.TextArea,String>
      Returns:
      true if the value is an empty string or null, false otherwise
    • setLabel

      public void setLabel(String label)
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
      Overrides:
      setLabel in class com.vaadin.flow.component.textfield.TextFieldBase<com.vaadin.flow.component.textfield.TextArea,String>
    • setLabelComponent

      public void setLabelComponent(com.vaadin.flow.component.Component labelComponent)
      Description copied from interface: FAbstractComponent
      Sets the component's label component. Flow components that support caption component usually overrides this.
      Specified by:
      setLabelComponent in interface FAbstractComponent
      Parameters:
      labelComponent - the new label component for the component.
    • getNullValueController

      public NullValueController<String> getNullValueController()
      Provides access to the NullValueController managing null values for this field. Only for internal use.
      Specified by:
      getNullValueController in interface NullValueCapable<String>
      Returns:
      the NullValueController instance
    • getInputSelectionController

      public InputSelectionController<String> getInputSelectionController()
      Provides access to the InputSelectionController managing input selection and cursor positioning for this field. Only for internal use.
      Specified by:
      getInputSelectionController in interface InputSelectionCapable<String>
      Returns:
      the InputSelectionController instance
    • setCursorPosition

      public void setCursorPosition(int pos)
      Description copied from interface: InputSelectionCapable
      Sets the cursor position in the field. This also focuses the field on the client side. The actual cursor position on the client may differ due to asynchronous updates.
      Specified by:
      setCursorPosition in interface com.vaadin.flow.component.shared.HasTextSelection
      Specified by:
      setCursorPosition in interface InputSelectionCapable<String>
      Parameters:
      pos - the position to move the cursor to
    • selectAll

      public void selectAll()
      Description copied from interface: InputSelectionCapable
      Selects all text in the field. Focuses the field and attempts to set the selection range from start to end of the current value.
      Specified by:
      selectAll in interface com.vaadin.flow.component.shared.HasTextSelection
      Specified by:
      selectAll in interface InputSelectionCapable<String>
    • setSelectionRange

      public void setSelectionRange(int pos, int length)
      Description copied from interface: InputSelectionCapable
      Sets the range of text to be selected and focuses the field on the client side. The component will attempt to select the specified text range. If the provided indices are out of range, the actual client-side behavior may differ.
      Specified by:
      setSelectionRange in interface com.vaadin.flow.component.shared.HasTextSelection
      Specified by:
      setSelectionRange in interface InputSelectionCapable<String>
      Parameters:
      pos - the starting position of the selection
      length - the number of characters to select
    • getInputColumnController

      public InputColumnController getInputColumnController()
      Provides access to the InputColumnController managing column-based width approximation for this field. Only for internal use.
      Specified by:
      getInputColumnController in interface HasInputColumns
      Returns:
      the InputColumnController instance
    • getType

      public Class<? extends String> getType()
      Description copied from interface: Property
      Returns the type of the Property. The methods getValue and setValue must be compatible with this type: one must be able to safely cast the value returned from getValue to the given type and pass any variable assignable to this type as an argument to setValue.
      Specified by:
      getType in interface Field<String>
      Specified by:
      getType in interface Property<String>
      Returns:
      type of the Property
    • clear

      public void clear()
      Description copied from interface: FAbstractTextField
      Resets the value to the empty one.
      Specified by:
      clear in interface FAbstractTextField
      Specified by:
      clear in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.textfield.TextArea,String>,String>
    • onAttach

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

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • fireEvent

      protected void fireEvent(com.vaadin.flow.component.ComponentEvent<?> componentEvent)
      Overrides:
      fireEvent in class com.vaadin.flow.component.Component