PS
- type for StyledDocument
's paragraph style; only necessary when using the "selectedDocument"
getter or propertySEG
- type for StyledDocument
's segment type; only necessary when using the "selectedDocument"
getter or propertyS
- type for StyledDocument
's segment style; only necessary when using the "selectedDocument"
getter or propertyCaretSelectionBind<PS,SEG,S>
SelectionImpl
public interface Selection<PS,SEG,S>
"Position" refers to the place in-between characters. In other words, every "|"
in
"|t|e|x|t|"
is a valid position. There are two kinds of positions used here:
getStartPosition()
/getEndPosition()
, which refers to a position somewhere in the
entire area's content. It's bounds are 0 <= x <= area.getLength()
.
getStartColumnPosition()
/getEndColumnPosition()
, which refers to a position
somewhere in the current paragraph. It's bounds are 0 <= x <= area.getParagraphLength(index)
.
For type safety, getSelectedDocument()
requires the same generic types from StyledDocument
.
This means that one must write a lot of boilerplate for the generics:
Selection<Collection<String>, StyledText<Collection<String>>, Collection<String>> selection
.
However, this is only necessary if one is using getSelectedDocument()
or
selectedDocumentProperty()
. If you are not going to use the "selectedDocument" getter or property,
then just write the much simpler Selection<?, ?, ?> selection
.
CaretSelectionBind
,
Caret
Type | Property | Description |
---|---|---|
javafx.beans.value.ObservableValue<java.lang.Boolean> |
beingUpdated |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
endColumnPosition |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
endParagraphIndex |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
endPosition |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
length |
The length of the selection
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
paragraphSpan |
The number of paragraphs the selection spans
|
javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> |
range |
The start and end positions in the area as an
IndexRange . |
javafx.beans.value.ObservableValue<StyledDocument<PS,SEG,S>> |
selectedDocument |
|
javafx.beans.value.ObservableValue<java.lang.String> |
selectedText |
|
javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> |
selectionBounds |
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. |
javafx.beans.value.ObservableValue<java.lang.Integer> |
startColumnPosition |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
startParagraphIndex |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
startPosition |
Modifier and Type | Interface | Description |
---|---|---|
static class |
Selection.Direction |
Specifies whether to update the start/end value of a selection to the left (towards 0) or right (away from 0)
|
Modifier and Type | Method | Description |
---|---|---|
javafx.beans.value.ObservableValue<java.lang.Boolean> |
beingUpdatedProperty() |
|
void |
configureSelectionPath(SelectionPath path) |
Configures a
SelectionPath that will be used to render a portion or all of this selection
on a single paragraph. |
default void |
deselect() |
Clears the selection via
selectRange(getStartPosition(), getStartPosition()) . |
void |
dispose() |
Disposes the selection and prevents memory leaks
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
endColumnPositionProperty() |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
endParagraphIndexProperty() |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
endPositionProperty() |
|
GenericStyledArea<PS,SEG,S> |
getArea() |
Gets the area with which this selection is associated
|
int |
getEndColumnPosition() |
Gets the value of the property endColumnPosition.
|
int |
getEndParagraphIndex() |
Gets the value of the property endParagraphIndex.
|
int |
getEndPosition() |
Gets the value of the property endPosition.
|
int |
getLength() |
Gets the value of the property length.
|
int |
getParagraphSpan() |
Gets the value of the property paragraphSpan.
|
javafx.scene.control.IndexRange |
getRange() |
Gets the value of the property range.
|
StyledDocument<PS,SEG,S> |
getSelectedDocument() |
Gets the value of the property selectedDocument.
|
java.lang.String |
getSelectedText() |
Gets the value of the property selectedText.
|
java.util.Optional<javafx.geometry.Bounds> |
getSelectionBounds() |
Gets the value of the property selectionBounds.
|
java.lang.String |
getSelectionName() |
Gets the name of this selection.
|
int |
getStartColumnPosition() |
Gets the value of the property startColumnPosition.
|
int |
getStartParagraphIndex() |
Gets the value of the property startParagraphIndex.
|
int |
getStartPosition() |
Gets the value of the property startPosition.
|
boolean |
isBeingUpdated() |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
lengthProperty() |
The length of the selection
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
paragraphSpanProperty() |
The number of paragraphs the selection spans
|
javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> |
rangeProperty() |
The start and end positions in the area as an
IndexRange . |
void |
selectAll() |
|
javafx.beans.value.ObservableValue<StyledDocument<PS,SEG,S>> |
selectedDocumentProperty() |
|
javafx.beans.value.ObservableValue<java.lang.String> |
selectedTextProperty() |
|
javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> |
selectionBoundsProperty() |
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. |
void |
selectParagraph(int paragraphIndex) |
|
void |
selectRange(int startPosition,
int endPosition) |
Selects the given range.
|
void |
selectRange(int startParagraphIndex,
int startColPosition,
int endParagraphIndex,
int endColPosition) |
Selects the given range.
|
void |
selectWord(int wordPositionInArea) |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
startColumnPositionProperty() |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
startParagraphIndexProperty() |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
startPositionProperty() |
|
void |
updateEndBy(int amount,
Selection.Direction direction) |
|
void |
updateEndByBreaksBackward(int numOfBreaks,
java.text.BreakIterator breakIterator) |
|
void |
updateEndByBreaksForward(int numOfBreaks,
java.text.BreakIterator breakIterator) |
|
void |
updateEndTo(int position) |
|
void |
updateEndTo(int paragraphIndex,
int columnPosition) |
|
void |
updateStartBy(int amount,
Selection.Direction direction) |
|
void |
updateStartByBreaksBackward(int numOfBreaks,
java.text.BreakIterator breakIterator) |
|
void |
updateStartByBreaksForward(int numOfBreaks,
java.text.BreakIterator breakIterator) |
|
void |
updateStartTo(int position) |
|
void |
updateStartTo(int paragraphIndex,
int columnPosition) |
javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> rangeProperty
IndexRange
.getRange()
javafx.beans.value.ObservableValue<java.lang.Integer> lengthProperty
getLength()
javafx.beans.value.ObservableValue<java.lang.Integer> paragraphSpanProperty
getParagraphSpan()
javafx.beans.value.ObservableValue<StyledDocument<PS,SEG,S>> selectedDocumentProperty
getSelectedDocument()
javafx.beans.value.ObservableValue<java.lang.String> selectedTextProperty
getSelectedText()
javafx.beans.value.ObservableValue<java.lang.Integer> startPositionProperty
getStartPosition()
javafx.beans.value.ObservableValue<java.lang.Integer> startParagraphIndexProperty
getStartParagraphIndex()
javafx.beans.value.ObservableValue<java.lang.Integer> startColumnPositionProperty
getStartColumnPosition()
javafx.beans.value.ObservableValue<java.lang.Integer> endPositionProperty
getEndPosition()
javafx.beans.value.ObservableValue<java.lang.Integer> endParagraphIndexProperty
getEndParagraphIndex()
javafx.beans.value.ObservableValue<java.lang.Integer> endColumnPositionProperty
getEndColumnPosition()
javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> selectionBoundsProperty
Optional.empty()
if selection is not visible in the viewport.getSelectionBounds()
javafx.beans.value.ObservableValue<java.lang.Boolean> beingUpdatedProperty
javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> rangeProperty()
IndexRange
.getRange()
javafx.scene.control.IndexRange getRange()
IndexRange
.javafx.beans.value.ObservableValue<java.lang.Integer> lengthProperty()
getLength()
int getLength()
javafx.beans.value.ObservableValue<java.lang.Integer> paragraphSpanProperty()
getParagraphSpan()
int getParagraphSpan()
javafx.beans.value.ObservableValue<StyledDocument<PS,SEG,S>> selectedDocumentProperty()
getSelectedDocument()
StyledDocument<PS,SEG,S> getSelectedDocument()
javafx.beans.value.ObservableValue<java.lang.String> selectedTextProperty()
getSelectedText()
java.lang.String getSelectedText()
javafx.beans.value.ObservableValue<java.lang.Integer> startPositionProperty()
getStartPosition()
int getStartPosition()
javafx.beans.value.ObservableValue<java.lang.Integer> startParagraphIndexProperty()
getStartParagraphIndex()
int getStartParagraphIndex()
javafx.beans.value.ObservableValue<java.lang.Integer> startColumnPositionProperty()
getStartColumnPosition()
int getStartColumnPosition()
javafx.beans.value.ObservableValue<java.lang.Integer> endPositionProperty()
getEndPosition()
int getEndPosition()
javafx.beans.value.ObservableValue<java.lang.Integer> endParagraphIndexProperty()
getEndParagraphIndex()
int getEndParagraphIndex()
javafx.beans.value.ObservableValue<java.lang.Integer> endColumnPositionProperty()
getEndColumnPosition()
int getEndColumnPosition()
javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> selectionBoundsProperty()
Optional.empty()
if selection is not visible in the viewport.getSelectionBounds()
java.util.Optional<javafx.geometry.Bounds> getSelectionBounds()
Optional.empty()
if selection is not visible in the viewport.boolean isBeingUpdated()
javafx.beans.value.ObservableValue<java.lang.Boolean> beingUpdatedProperty()
void selectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition)
Caution: see TextEditingArea.getAbsolutePosition(int, int)
to
know how the column index argument can affect the returned position.
void selectRange(int startPosition, int endPosition)
void updateStartBy(int amount, Selection.Direction direction)
void updateEndBy(int amount, Selection.Direction direction)
void updateStartTo(int position)
void updateStartTo(int paragraphIndex, int columnPosition)
void updateStartByBreaksForward(int numOfBreaks, java.text.BreakIterator breakIterator)
void updateStartByBreaksBackward(int numOfBreaks, java.text.BreakIterator breakIterator)
void updateEndTo(int position)
void updateEndTo(int paragraphIndex, int columnPosition)
void updateEndByBreaksForward(int numOfBreaks, java.text.BreakIterator breakIterator)
void updateEndByBreaksBackward(int numOfBreaks, java.text.BreakIterator breakIterator)
void selectAll()
void selectParagraph(int paragraphIndex)
void selectWord(int wordPositionInArea)
default void deselect()
selectRange(getStartPosition(), getStartPosition())
.void configureSelectionPath(SelectionPath path)
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.void dispose()
java.lang.String getSelectionName()
GenericStyledArea<PS,SEG,S> getArea()