Interface InputSelectionCapable<V>

Type Parameters:
V - the value type of the component that uses the selection controller
All Superinterfaces:
Serializable
All Known Subinterfaces:
FAbstractTextField
All Known Implementing Classes:
FPasswordField, FTextArea, FTextField

public interface InputSelectionCapable<V> extends Serializable
Interface providing input selection capabilities to Vaadin Flow components that do not inherently support features like cursor positioning or text selection. This interface requires the implementing component to provide an InputSelectionController.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    Returns the last known cursor position of the field as tracked on the server side.
    Returns the controller that manages input selection logic for this component.
    default void
    Selects all text in the field.
    default void
    Sets the cursor position in the field.
    default void
    setSelectionRange(int pos, int length)
    Sets the range of text to be selected and focuses the field on the client side.
  • Method Details

    • getInputSelectionController

      InputSelectionController<V> getInputSelectionController()
      Returns the controller that manages input selection logic for this component.
      Returns:
      the InputSelectionController instance
    • setCursorPosition

      default void setCursorPosition(int pos)
      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.
      Parameters:
      pos - the position to move the cursor to
    • getCursorPosition

      default int getCursorPosition()
      Returns the last known cursor position of the field as tracked on the server side. The actual cursor position on the client may differ due to asynchronous updates.
      Returns:
      the last known cursor position
    • selectAll

      default void selectAll()
      Selects all text in the field. Focuses the field and attempts to set the selection range from start to end of the current value.
    • setSelectionRange

      default void setSelectionRange(int pos, int length)
      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.
      Parameters:
      pos - the starting position of the selection
      length - the number of characters to select