Interface TextSelection.TextSelectionSupport

Enclosing class:
TextSelection

public static interface TextSelection.TextSelectionSupport
An interface that can be returned from any Component's Component#getTextSelectionSupport() method to provide text selection support on that component.
  • Method Details

    • getTextSelectionForBounds

      TextSelection.Spans getTextSelectionForBounds(TextSelection sel, Rectangle bounds)

      Gets the spans that should be selected for the given bounds.

      Parameters
      • sel: The TextSelection instance.

      • bounds: The bounds to check. Relative to #getSelectionRoot()

      Returns

      Spans of text that should be selected.

    • isTextSelectionEnabled

      boolean isTextSelectionEnabled(TextSelection sel)

      Checks if text selection is enabled for this component.

      Parameters
      • sel: The TextSelection instance.
      Returns

      True if text selection is enabled.

    • isTextSelectionTriggerEnabled

      boolean isTextSelectionTriggerEnabled(TextSelection sel)

      Checks if this component can be used to trigger a text selection. On mobile devices text selection is triggered with a long press over a component.

      Parameters
      • sel: The TextSelection instance.
      Returns

      True if text selection can be triggered on this component.

    • triggerSelectionAt

      TextSelection.Span triggerSelectionAt(TextSelection sel, int x, int y)

      Trigger a text selection at a given point.

      Parameters
      • sel: The TextSelection instance

      • x: The x coordinate of the event. Relative to #getSelectionRoot()

      • y: The y coordinate of the event. Relative to #getSelectionRoot()

      Returns

      The span that should be selected by a long press at this point.

    • getTextForSpan

      String getTextForSpan(TextSelection sel, TextSelection.Span span)

      Returns the text for a given span.

      Parameters
      • sel: The TextSelection instance.

      • span: The span describing the range of text that should be returned.

      Returns

      The text that is contained.