Package org.fxmisc.richtext
Class SelectionImpl<PS,SEG,S>
- java.lang.Object
-
- org.fxmisc.richtext.SelectionImpl<PS,SEG,S>
-
- All Implemented Interfaces:
Comparable<SelectionImpl<PS,SEG,S>>,Selection<PS,SEG,S>
public class SelectionImpl<PS,SEG,S> extends Object implements Selection<PS,SEG,S>, Comparable<SelectionImpl<PS,SEG,S>>
Default implementation forSelection.
-
-
Property Summary
Properties Type Property Description ObservableValue<Boolean>beingUpdatedObservableValue<Integer>endColumnPositionObservableValue<Integer>endParagraphIndexObservableValue<Integer>endPositionObservableValue<Integer>lengthThe length of the selectionObservableValue<Integer>paragraphSpanThe number of paragraphs the selection spansObservableValue<IndexRange>rangeThe start and end positions in the area as anIndexRange.ObservableValue<StyledDocument<PS,SEG,S>>selectedDocumentObservableValue<String>selectedTextObservableValue<Optional<Bounds>>selectionBoundsThe selectionBoundsProperty of the selection in the Screen's coordinate system if something is selected and visible in the viewport, orOptional.empty()if selection is not visible in the viewport.ObservableValue<Integer>startColumnPositionObservableValue<Integer>startParagraphIndexObservableValue<Integer>startPosition
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fxmisc.richtext.Selection
Selection.Direction
-
-
Constructor Summary
Constructors Constructor Description SelectionImpl(String name, GenericStyledArea<PS,SEG,S> area)Creates a selection with both the start and end position at 0.SelectionImpl(String name, GenericStyledArea<PS,SEG,S> area, int startPosition, int endPosition)Creates a selection.SelectionImpl(String name, GenericStyledArea<PS,SEG,S> area, Consumer<SelectionPath> configurePath)Creates a selection with customized configuration viaconfigurePathwith both the start and end position at 0.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObservableValue<Boolean>beingUpdatedProperty()intcompareTo(SelectionImpl<PS,SEG,S> o)voidconfigureSelectionPath(SelectionPath path)Configures aSelectionPaththat will be used to render a portion or all of this selection on a single paragraph.voiddispose()Disposes the selection and prevents memory leaksObservableValue<Integer>endColumnPositionProperty()ObservableValue<Integer>endParagraphIndexProperty()ObservableValue<Integer>endPositionProperty()booleanequals(Object obj)GenericStyledArea<PS,SEG,S>getArea()Gets the area with which this selection is associatedintgetEndColumnPosition()Gets the value of the property endColumnPosition.intgetEndParagraphIndex()Gets the value of the property endParagraphIndex.intgetEndPosition()Gets the value of the property endPosition.intgetLength()Gets the value of the property length.intgetParagraphSpan()Gets the value of the property paragraphSpan.IndexRangegetRange()Gets the value of the property range.StyledDocument<PS,SEG,S>getSelectedDocument()Gets the value of the property selectedDocument.StringgetSelectedText()Gets the value of the property selectedText.Optional<Bounds>getSelectionBounds()Gets the value of the property selectionBounds.StringgetSelectionName()Gets the name of this selection.intgetStartColumnPosition()Gets the value of the property startColumnPosition.intgetStartParagraphIndex()Gets the value of the property startParagraphIndex.intgetStartPosition()Gets the value of the property startPosition.inthashCode()booleanisBeingUpdated()ObservableValue<Integer>lengthProperty()The length of the selectionObservableValue<Integer>paragraphSpanProperty()The number of paragraphs the selection spansObservableValue<IndexRange>rangeProperty()The start and end positions in the area as anIndexRange.voidselectAll()ObservableValue<StyledDocument<PS,SEG,S>>selectedDocumentProperty()ObservableValue<String>selectedTextProperty()ObservableValue<Optional<Bounds>>selectionBoundsProperty()The selectionBoundsProperty of the selection in the Screen's coordinate system if something is selected and visible in the viewport, orOptional.empty()if selection is not visible in the viewport.voidselectParagraph(int paragraphIndex)voidselectRange(int startPosition, int endPosition)Selects the given range.voidselectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition)Selects the given range.voidselectWord(int wordPositionInArea)ObservableValue<Integer>startColumnPositionProperty()ObservableValue<Integer>startParagraphIndexProperty()ObservableValue<Integer>startPositionProperty()StringtoString()voidupdateEndBy(int amount, Selection.Direction direction)voidupdateEndByBreaksBackward(int numOfBreaks, BreakIterator breakIterator)voidupdateEndByBreaksForward(int numOfBreaks, BreakIterator breakIterator)voidupdateEndTo(int position)voidupdateEndTo(int paragraphIndex, int columnPosition)voidupdateStartBy(int amount, Selection.Direction direction)voidupdateStartByBreaksBackward(int numOfBreaks, BreakIterator breakIterator)voidupdateStartByBreaksForward(int numOfBreaks, BreakIterator breakIterator)voidupdateStartTo(int position)voidupdateStartTo(int paragraphIndex, int columnPosition)
-
-
-
Property Detail
-
range
public final ObservableValue<IndexRange> rangeProperty
- Specified by:
rangePropertyin interfaceSelection<PS,SEG,S>- See Also:
getRange()
-
length
public final ObservableValue<Integer> lengthProperty
- Specified by:
lengthPropertyin interfaceSelection<PS,SEG,S>- See Also:
getLength()
-
paragraphSpan
public final ObservableValue<Integer> paragraphSpanProperty
- Specified by:
paragraphSpanPropertyin interfaceSelection<PS,SEG,S>- See Also:
getParagraphSpan()
-
selectedDocument
public final ObservableValue<StyledDocument<PS,SEG,S>> selectedDocumentProperty
- Specified by:
selectedDocumentPropertyin interfaceSelection<PS,SEG,S>- See Also:
getSelectedDocument()
-
selectedText
public final ObservableValue<String> selectedTextProperty
- Specified by:
selectedTextPropertyin interfaceSelection<PS,SEG,S>- See Also:
getSelectedText()
-
startPosition
public final ObservableValue<Integer> startPositionProperty
- Specified by:
startPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getStartPosition()
-
startParagraphIndex
public final ObservableValue<Integer> startParagraphIndexProperty
- Specified by:
startParagraphIndexPropertyin interfaceSelection<PS,SEG,S>- See Also:
getStartParagraphIndex()
-
startColumnPosition
public final ObservableValue<Integer> startColumnPositionProperty
- Specified by:
startColumnPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getStartColumnPosition()
-
endPosition
public final ObservableValue<Integer> endPositionProperty
- Specified by:
endPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getEndPosition()
-
endParagraphIndex
public final ObservableValue<Integer> endParagraphIndexProperty
- Specified by:
endParagraphIndexPropertyin interfaceSelection<PS,SEG,S>- See Also:
getEndParagraphIndex()
-
endColumnPosition
public final ObservableValue<Integer> endColumnPositionProperty
- Specified by:
endColumnPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getEndColumnPosition()
-
selectionBounds
public final ObservableValue<Optional<Bounds>> selectionBoundsProperty
- Specified by:
selectionBoundsPropertyin interfaceSelection<PS,SEG,S>- See Also:
getSelectionBounds()
-
beingUpdated
public final ObservableValue<Boolean> beingUpdatedProperty
- Specified by:
beingUpdatedPropertyin interfaceSelection<PS,SEG,S>
-
-
Constructor Detail
-
SelectionImpl
public SelectionImpl(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(String name, GenericStyledArea<PS,SEG,S> area, Consumer<SelectionPath> configurePath)
Creates a selection with customized configuration viaconfigurePathwith both the start and end position at 0.
-
SelectionImpl
public SelectionImpl(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 IndexRange getRange()
Gets the value of the property range.
-
rangeProperty
public final ObservableValue<IndexRange> rangeProperty()
Description copied from interface:SelectionThe start and end positions in the area as anIndexRange.- Specified by:
rangePropertyin interfaceSelection<PS,SEG,S>- See Also:
getRange()
-
getLength
public final int getLength()
Gets the value of the property length.
-
lengthProperty
public final ObservableValue<Integer> lengthProperty()
Description copied from interface:SelectionThe length of the selection- Specified by:
lengthPropertyin interfaceSelection<PS,SEG,S>- See Also:
getLength()
-
getParagraphSpan
public final int getParagraphSpan()
Gets the value of the property paragraphSpan.- Specified by:
getParagraphSpanin interfaceSelection<PS,SEG,S>- Property description:
-
paragraphSpanProperty
public final ObservableValue<Integer> paragraphSpanProperty()
Description copied from interface:SelectionThe number of paragraphs the selection spans- Specified by:
paragraphSpanPropertyin interfaceSelection<PS,SEG,S>- See Also:
getParagraphSpan()
-
selectedDocumentProperty
public final ObservableValue<StyledDocument<PS,SEG,S>> selectedDocumentProperty()
- Specified by:
selectedDocumentPropertyin interfaceSelection<PS,SEG,S>- See Also:
getSelectedDocument()
-
getSelectedDocument
public final StyledDocument<PS,SEG,S> getSelectedDocument()
Gets the value of the property selectedDocument.- Specified by:
getSelectedDocumentin interfaceSelection<PS,SEG,S>- Property description:
-
getSelectedText
public final String getSelectedText()
Gets the value of the property selectedText.- Specified by:
getSelectedTextin interfaceSelection<PS,SEG,S>- Property description:
-
selectedTextProperty
public final ObservableValue<String> selectedTextProperty()
- Specified by:
selectedTextPropertyin interfaceSelection<PS,SEG,S>- See Also:
getSelectedText()
-
getStartPosition
public final int getStartPosition()
Gets the value of the property startPosition.- Specified by:
getStartPositionin interfaceSelection<PS,SEG,S>- Property description:
-
startPositionProperty
public final ObservableValue<Integer> startPositionProperty()
- Specified by:
startPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getStartPosition()
-
getStartParagraphIndex
public final int getStartParagraphIndex()
Gets the value of the property startParagraphIndex.- Specified by:
getStartParagraphIndexin interfaceSelection<PS,SEG,S>- Property description:
-
startParagraphIndexProperty
public final ObservableValue<Integer> startParagraphIndexProperty()
- Specified by:
startParagraphIndexPropertyin interfaceSelection<PS,SEG,S>- See Also:
getStartParagraphIndex()
-
getStartColumnPosition
public final int getStartColumnPosition()
Gets the value of the property startColumnPosition.- Specified by:
getStartColumnPositionin interfaceSelection<PS,SEG,S>- Property description:
-
startColumnPositionProperty
public final ObservableValue<Integer> startColumnPositionProperty()
- Specified by:
startColumnPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getStartColumnPosition()
-
getEndPosition
public final int getEndPosition()
Gets the value of the property endPosition.- Specified by:
getEndPositionin interfaceSelection<PS,SEG,S>- Property description:
-
endPositionProperty
public final ObservableValue<Integer> endPositionProperty()
- Specified by:
endPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getEndPosition()
-
getEndParagraphIndex
public final int getEndParagraphIndex()
Gets the value of the property endParagraphIndex.- Specified by:
getEndParagraphIndexin interfaceSelection<PS,SEG,S>- Property description:
-
endParagraphIndexProperty
public final ObservableValue<Integer> endParagraphIndexProperty()
- Specified by:
endParagraphIndexPropertyin interfaceSelection<PS,SEG,S>- See Also:
getEndParagraphIndex()
-
getEndColumnPosition
public final int getEndColumnPosition()
Gets the value of the property endColumnPosition.- Specified by:
getEndColumnPositionin interfaceSelection<PS,SEG,S>- Property description:
-
endColumnPositionProperty
public final ObservableValue<Integer> endColumnPositionProperty()
- Specified by:
endColumnPositionPropertyin interfaceSelection<PS,SEG,S>- See Also:
getEndColumnPosition()
-
getSelectionBounds
public final Optional<Bounds> getSelectionBounds()
Gets the value of the property selectionBounds.- Specified by:
getSelectionBoundsin interfaceSelection<PS,SEG,S>- Property description:
-
selectionBoundsProperty
public final ObservableValue<Optional<Bounds>> selectionBoundsProperty()
Description copied from interface:SelectionThe selectionBoundsProperty of the selection in the Screen's coordinate system if something is selected and visible in the viewport, orOptional.empty()if selection is not visible in the viewport.- Specified by:
selectionBoundsPropertyin interfaceSelection<PS,SEG,S>- See Also:
getSelectionBounds()
-
isBeingUpdated
public final boolean isBeingUpdated()
- Specified by:
isBeingUpdatedin interfaceSelection<PS,SEG,S>
-
beingUpdatedProperty
public final ObservableValue<Boolean> beingUpdatedProperty()
- Specified by:
beingUpdatedPropertyin interfaceSelection<PS,SEG,S>
-
getArea
public GenericStyledArea<PS,SEG,S> getArea()
Description copied from interface:SelectionGets the area with which this selection is associated
-
getSelectionName
public String getSelectionName()
Description copied from interface:SelectionGets 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:
getSelectionNamein interfaceSelection<PS,SEG,S>
-
selectRange
public void selectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition)Description copied from interface:SelectionSelects the given range.Caution: see
TextEditingArea.getAbsolutePosition(int, int)to know how the column index argument can affect the returned position.- Specified by:
selectRangein interfaceSelection<PS,SEG,S>
-
selectRange
public void selectRange(int startPosition, int endPosition)Description copied from interface:SelectionSelects the given range.- Specified by:
selectRangein interfaceSelection<PS,SEG,S>
-
updateStartBy
public void updateStartBy(int amount, Selection.Direction direction)- Specified by:
updateStartByin interfaceSelection<PS,SEG,S>
-
updateEndBy
public void updateEndBy(int amount, Selection.Direction direction)- Specified by:
updateEndByin interfaceSelection<PS,SEG,S>
-
updateStartTo
public void updateStartTo(int position)
- Specified by:
updateStartToin interfaceSelection<PS,SEG,S>
-
updateStartTo
public void updateStartTo(int paragraphIndex, int columnPosition)- Specified by:
updateStartToin interfaceSelection<PS,SEG,S>
-
updateStartByBreaksForward
public void updateStartByBreaksForward(int numOfBreaks, BreakIterator breakIterator)- Specified by:
updateStartByBreaksForwardin interfaceSelection<PS,SEG,S>
-
updateStartByBreaksBackward
public void updateStartByBreaksBackward(int numOfBreaks, BreakIterator breakIterator)- Specified by:
updateStartByBreaksBackwardin interfaceSelection<PS,SEG,S>
-
updateEndTo
public void updateEndTo(int position)
- Specified by:
updateEndToin interfaceSelection<PS,SEG,S>
-
updateEndTo
public void updateEndTo(int paragraphIndex, int columnPosition)- Specified by:
updateEndToin interfaceSelection<PS,SEG,S>
-
updateEndByBreaksForward
public void updateEndByBreaksForward(int numOfBreaks, BreakIterator breakIterator)- Specified by:
updateEndByBreaksForwardin interfaceSelection<PS,SEG,S>
-
updateEndByBreaksBackward
public void updateEndByBreaksBackward(int numOfBreaks, BreakIterator breakIterator)- Specified by:
updateEndByBreaksBackwardin interfaceSelection<PS,SEG,S>
-
selectParagraph
public void selectParagraph(int paragraphIndex)
- Specified by:
selectParagraphin interfaceSelection<PS,SEG,S>
-
selectWord
public void selectWord(int wordPositionInArea)
- Specified by:
selectWordin interfaceSelection<PS,SEG,S>
-
configureSelectionPath
public void configureSelectionPath(SelectionPath path)
Description copied from interface:SelectionConfigures aSelectionPaththat 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:
configureSelectionPathin interfaceSelection<PS,SEG,S>
-
compareTo
public int compareTo(SelectionImpl<PS,SEG,S> o)
- Specified by:
compareToin interfaceComparable<PS>
-
-