Class SelectionImpl<PS,​SEG,​S>

  • All Implemented Interfaces:
    java.lang.Comparable<SelectionImpl<PS,​SEG,​S>>, Selection<PS,​SEG,​S>

    public class SelectionImpl<PS,​SEG,​S>
    extends java.lang.Object
    implements Selection<PS,​SEG,​S>, java.lang.Comparable<SelectionImpl<PS,​SEG,​S>>
    Default implementation for Selection.
    • Constructor Detail

      • SelectionImpl

        public SelectionImpl​(java.lang.String name,
                             GenericStyledArea<PS,​SEG,​S> area)
        Creates a selection with both the start and end position at 0.
        Parameters:
        name - must be unique and is also used as a StyleClass for configuration via CSS using selectors from Path, Shape, and Node.
      • SelectionImpl

        public SelectionImpl​(java.lang.String name,
                             GenericStyledArea<PS,​SEG,​S> area,
                             java.util.function.Consumer<SelectionPath> configurePath)
        Creates a selection with customized configuration via configurePath with both the start and end position at 0.
      • SelectionImpl

        public SelectionImpl​(java.lang.String name,
                             GenericStyledArea<PS,​SEG,​S> area,
                             int startPosition,
                             int endPosition)
        Creates a selection. Name must be unique and is also used as a StyleClass for configuration via CSS using selectors from Path, Shape, and Node.
    • Method Detail

      • getRange

        public final javafx.scene.control.IndexRange getRange()
        Gets the value of the property range.
        Specified by:
        getRange in interface Selection<PS,​SEG,​S>
        Property description:
      • rangeProperty

        public final javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> rangeProperty()
        Description copied from interface: Selection
        The start and end positions in the area as an IndexRange.
        Specified by:
        rangeProperty in interface Selection<PS,​SEG,​S>
        See Also:
        getRange()
      • getLength

        public final int getLength()
        Gets the value of the property length.
        Specified by:
        getLength in interface Selection<PS,​SEG,​S>
        Property description:
      • lengthProperty

        public final javafx.beans.value.ObservableValue<java.lang.Integer> lengthProperty()
        Description copied from interface: Selection
        The length of the selection
        Specified by:
        lengthProperty in interface Selection<PS,​SEG,​S>
        See Also:
        getLength()
      • getParagraphSpan

        public final int getParagraphSpan()
        Gets the value of the property paragraphSpan.
        Specified by:
        getParagraphSpan in interface Selection<PS,​SEG,​S>
        Property description:
      • getSelectedText

        public final java.lang.String getSelectedText()
        Gets the value of the property selectedText.
        Specified by:
        getSelectedText in interface Selection<PS,​SEG,​S>
        Property description:
      • getStartPosition

        public final int getStartPosition()
        Gets the value of the property startPosition.
        Specified by:
        getStartPosition in interface Selection<PS,​SEG,​S>
        Property description:
      • getStartParagraphIndex

        public final int getStartParagraphIndex()
        Gets the value of the property startParagraphIndex.
        Specified by:
        getStartParagraphIndex in interface Selection<PS,​SEG,​S>
        Property description:
      • getStartColumnPosition

        public final int getStartColumnPosition()
        Gets the value of the property startColumnPosition.
        Specified by:
        getStartColumnPosition in interface Selection<PS,​SEG,​S>
        Property description:
      • getEndPosition

        public final int getEndPosition()
        Gets the value of the property endPosition.
        Specified by:
        getEndPosition in interface Selection<PS,​SEG,​S>
        Property description:
      • getEndParagraphIndex

        public final int getEndParagraphIndex()
        Gets the value of the property endParagraphIndex.
        Specified by:
        getEndParagraphIndex in interface Selection<PS,​SEG,​S>
        Property description:
      • getEndColumnPosition

        public final int getEndColumnPosition()
        Gets the value of the property endColumnPosition.
        Specified by:
        getEndColumnPosition in interface Selection<PS,​SEG,​S>
        Property description:
      • getSelectionBounds

        public final java.util.Optional<javafx.geometry.Bounds> getSelectionBounds()
        Gets the value of the property selectionBounds.
        Specified by:
        getSelectionBounds in interface Selection<PS,​SEG,​S>
        Property description:
      • selectionBoundsProperty

        public final javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> selectionBoundsProperty()
        Description copied from interface: Selection
        The selectionBoundsProperty of the selection in the Screen's coordinate system if something is selected and visible in the viewport, or Optional.empty() if selection is not visible in the viewport.
        Specified by:
        selectionBoundsProperty in interface Selection<PS,​SEG,​S>
        See Also:
        getSelectionBounds()
      • beingUpdatedProperty

        public final javafx.beans.value.ObservableValue<java.lang.Boolean> beingUpdatedProperty()
        Specified by:
        beingUpdatedProperty in interface Selection<PS,​SEG,​S>
      • getSelectionName

        public java.lang.String getSelectionName()
        Description copied from interface: Selection
        Gets the name of this selection. Each selection in an area must have a unique name.
        The name is also used as a StyleClass, so the Selection can be styled using CSS selectors from Path, Shape, and Node eg:
        .styled-text-area .my-selection { -fx-fill: lime; }
        Specified by:
        getSelectionName in interface Selection<PS,​SEG,​S>
      • selectRange

        public void selectRange​(int startParagraphIndex,
                                int startColPosition,
                                int endParagraphIndex,
                                int endColPosition)
        Description copied from interface: Selection
        Selects the given range.

        Caution: see TextEditingArea.getAbsolutePosition(int, int) to know how the column index argument can affect the returned position.

        Specified by:
        selectRange in interface Selection<PS,​SEG,​S>
      • selectRange

        public void selectRange​(int startPosition,
                                int endPosition)
        Description copied from interface: Selection
        Selects the given range.
        Specified by:
        selectRange in interface Selection<PS,​SEG,​S>
      • updateStartTo

        public void updateStartTo​(int paragraphIndex,
                                  int columnPosition)
        Specified by:
        updateStartTo in interface Selection<PS,​SEG,​S>
      • updateStartByBreaksForward

        public void updateStartByBreaksForward​(int numOfBreaks,
                                               java.text.BreakIterator breakIterator)
        Specified by:
        updateStartByBreaksForward in interface Selection<PS,​SEG,​S>
      • updateStartByBreaksBackward

        public void updateStartByBreaksBackward​(int numOfBreaks,
                                                java.text.BreakIterator breakIterator)
        Specified by:
        updateStartByBreaksBackward in interface Selection<PS,​SEG,​S>
      • updateEndTo

        public void updateEndTo​(int paragraphIndex,
                                int columnPosition)
        Specified by:
        updateEndTo in interface Selection<PS,​SEG,​S>
      • updateEndByBreaksForward

        public void updateEndByBreaksForward​(int numOfBreaks,
                                             java.text.BreakIterator breakIterator)
        Specified by:
        updateEndByBreaksForward in interface Selection<PS,​SEG,​S>
      • updateEndByBreaksBackward

        public void updateEndByBreaksBackward​(int numOfBreaks,
                                              java.text.BreakIterator breakIterator)
        Specified by:
        updateEndByBreaksBackward in interface Selection<PS,​SEG,​S>
      • selectWord

        public void selectWord​(int wordPositionInArea)
        Specified by:
        selectWord in interface Selection<PS,​SEG,​S>
      • configureSelectionPath

        public void configureSelectionPath​(SelectionPath path)
        Description copied from interface: Selection
        Configures a SelectionPath that will be used to render a portion or all of this selection on a single paragraph. When the selection is a multi-paragraph selection, one path will be used to render that portion of the selection on a paragraph.
        Specified by:
        configureSelectionPath in interface Selection<PS,​SEG,​S>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(SelectionImpl<PS,​SEG,​S> o)
        Specified by:
        compareTo in interface java.lang.Comparable<PS>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • dispose

        public void dispose()
        Description copied from interface: Selection
        Disposes the selection and prevents memory leaks
        Specified by:
        dispose in interface Selection<PS,​SEG,​S>