Interface AuthorSelectionModel

  • All Known Subinterfaces:
    AuthorSelectionAndCaretModel

    @API(type=NOT_EXTENDABLE,
         src=PUBLIC)
    public interface AuthorSelectionModel
    Get the Author selection model containing access to all Author selection intervals and methods for adding simple and multiple selections.
    Since:
    14
    • Method Detail

      • setSelectionInterpretationMode

        void setSelectionInterpretationMode​(SelectionInterpretationMode interpretationMode)
        Impose the interpretation mode of the actual selection from the Author editor page.
        See SelectionInterpretationMode for more details about the interpretation of selection in Author mode.
        This interpretation mode is reseted when the next caret moved is performed or another interpretation mode is imposed.
        Parameters:
        interpretationMode - The selection interpretation mode.
      • getSelectionInterpretationMode

        SelectionInterpretationMode getSelectionInterpretationMode()
        Get the interpretation mode of the actual selection from the Author editor page.
        See SelectionInterpretationMode for more details about the interpretation of selection in Author mode.
        This interpretation mode is reseted when the next caret moved is performed or another interpretation mode is imposed.
        Returns:
        The selection interpretation mode.
      • getSelectionIntervals

        java.util.List<ContentInterval> getSelectionIntervals()
        Get all Author editor page selection intervals. Each ContentInterval contains the inclusive start selection offset and the exclusive end selection offset.

        The selection intervals are added to the list in the same order in which the selections are made in the Author editor page. If the caret is not inside a selection the last selection interval points to the caret offset (both ContentInterval.getStartOffset() and ContentInterval.getEndOffset() will return the caret position). Otherwise, the last ContentInterval from the list corresponds with the last selection made in the editor.

        This method never returns null. If there is no selection, the list contains a single ContentInterval that points to the caret offset.
        Returns:
        the list containing all the Author editor page selection intervals.
      • getSelectionInterval

        ContentInterval getSelectionInterval()
        Get the current selection interval. This is the last selection made in the Author editor page (the last selection from the getSelectionIntervals() selections list). If the caret offset is not included in a selection range, the selection interval points to the caret offset (both ContentInterval.getStartOffset() and ContentInterval.getEndOffset() will return the caret position).
        The ContentInterval contains the inclusive start selection offset and the exclusive end selection offset.

        This method never returns null. If there is no selection, both the start and end offset of the interval will be the caret position.
        Returns:
        The interval of the current selection.
      • hasSelection

        boolean hasSelection()
        Check if the Author editor page has selection.
        Returns:
        true if there is a selection in Author editor page.
      • hasMultipleSelection

        boolean hasMultipleSelection()
        Check if the Author editor page has multiple selections.
        Returns:
        true if there are at least two selections in Author editor page.
      • setSelection

        void setSelection​(int startOffset,
                          int endOffset)
        Select the interval between start and end offset.
        This selection interval is considered to be the current one (the one that will be returned by the getSelectionInterval() method).

        The previous Author selections are discarded.
        Parameters:
        startOffset - Inclusive start offset
        endOffset - Exclusive end offset
      • setSelection

        void setSelection​(int startOffset,
                          int endOffset,
                          boolean scrollToBVisible)
        Select the interval between start and end offset.
        This selection interval is considered to be the current one (the one that will be returned by the getSelectionInterval() method).

        The previous Author selections are discarded.
        Parameters:
        startOffset - Inclusive start offset
        endOffset - Exclusive end offset
        scrollToBVisible - true to scroll to visible
      • addSelection

        void addSelection​(int startOffset,
                          int endOffset)
        Select the interval between start and end offset.
        This selection interval is considered to be the current one (the one that will be returned by the getSelectionInterval() method).

        The previous Author selections are kept. Call getSelectionIntervals() method to get all the selection intervals from Author editor page.
        Parameters:
        startOffset - Inclusive start offset
        endOffset - Exclusive end offset
      • setSelectionIntervals

        void setSelectionIntervals​(java.util.List<ContentInterval> intervals,
                                   boolean scrollToVisible)
        Sets the Author editor page selection intervals. Each ContentInterval contains the inclusive start selection offset and the exclusive end selection offset.

        The selection intervals are added to the Author editor page order in which they are in the list. The last selection interval end offset will set the caret position.

        Parameters:
        intervals - the list containing all the Author editor page selection intervals.
        scrollToVisible - If true the start offset of the last interval will be scrolled to visible.
        Since:
        17.1
      • addSelectionIntervals

        void addSelectionIntervals​(java.util.List<ContentInterval> intervals,
                                   boolean scrollToVisible)
        Add Author editor page selection intervals. Each ContentInterval contains the inclusive start selection offset and the exclusive end selection offset.

        The selection intervals are added to the Author editor page order in which they are in the list. The last selection interval end offset will set the caret position.

        Parameters:
        intervals - the list containing all the Author editor page selection intervals.
        scrollToVisible - If true the start offset of the last interval will be scrolled to visible.
        Since:
        18