public interface TextSelection.TextSelectionSupport
An interface that can be returned from any Component’s
Component#getTextSelectionSupport() method to provide
text selection support on that component.Methods
Method details
getTextSelectionForBounds
public abstract TextSelection.Spans getTextSelectionForBounds(TextSelection sel, Rectangle bounds)Gets the spans that should be selected for the given bounds.
Parameters
selTextSelection- The TextSelection instance.
boundsRectangle- The bounds to check. Relative to
#getSelectionRoot()
Returns
Spans of text that should be selected.
isTextSelectionEnabled
public abstract boolean isTextSelectionEnabled(TextSelection sel)Checks if text selection is enabled for this component.
Parameters
selTextSelection- The TextSelection instance.
Returns
True if text selection is enabled.
isTextSelectionTriggerEnabled
public abstract 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
selTextSelection- The TextSelection instance.
Returns
True if text selection can be triggered on this component.
triggerSelectionAt
public abstract TextSelection.Span triggerSelectionAt(TextSelection sel, int x, int y)Trigger a text selection at a given point.
Parameters
selTextSelection- The TextSelection instance
xint- The x coordinate of the event. Relative to
#getSelectionRoot() yint- The y coordinate of the event. Relative to
#getSelectionRoot()
Returns
The span that should be selected by a long press at this point.
getTextForSpan
public abstract String getTextForSpan(TextSelection sel, TextSelection.Span span)Returns the text for a given span.
Parameters
selTextSelection- The TextSelection instance.
spanTextSelection.Span- The span describing the range of text that should be returned.
Returns
The text that is contained.