Top Description Methods
jfx.incubator.scene.control.richtext

public Interface SelectionModel

Known Direct Implementers
jfx.incubator.scene.control.richtext.SingleSelectionModel
Imports
javafx.beans.property.ReadOnlyProperty, jfx.incubator.scene.control.richtext.model.StyledTextModel

A Selection model that maintains a single SelectionSegment.
Since
24

Method Summary

Modifier and TypeMethod and Description
public ReadOnlyProperty<TextPos>

Returns:

the anchor position property
anchorPositionProperty
()

Anchor position property.

public ReadOnlyProperty<TextPos>

Returns:

the caret position property
caretPositionProperty
()

Caret position property.

public void
clear()

Clears the selection.

public void
extendSelection(StyledTextModel
the model, must be non-null
model
,
TextPos
the new caret position, must be non-null
pos
)

Extends selection to the specified position.

public SelectionSegment

Returns:

current selection, or null
getSelection
()

Returns the current selection.

public ReadOnlyProperty<SelectionSegment>

Returns:

the selection property
selectionProperty
()

Selection property.

public void
setSelection(StyledTextModel
the model, must be non-null
model
,
TextPos
the anchor position, must be non-null
anchor
,
TextPos
the caret position, must be non-null
caret
)

Replaced existing selection, if any, with the new one.

Method Detail

anchorPositionPropertyback to summary
public ReadOnlyProperty<TextPos> anchorPositionProperty()

Anchor position property. The value can be null, indicating no selection. When the anchor position is null, the selectionProperty and the caretPositionProperty are also null.

Note

selectionProperty(), anchorPositionProperty(), and caretPositionProperty() are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.

Returns:ReadOnlyProperty<TextPos>

the anchor position property

Default Value
null
caretPositionPropertyback to summary
public ReadOnlyProperty<TextPos> caretPositionProperty()

Caret position property. The value can be null, indicating no selection. When the caret position is null, the selectionProperty and the anchorPositionProperty are also null.

Note

selectionProperty(), anchorPositionProperty(), and caretPositionProperty() are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.

Returns:ReadOnlyProperty<TextPos>

the caret position property

Default Value
null
clearback to summary
public void clear()

Clears the selection. This sets selectionProperty, anchorPositionProperty, and caretPositionProperty to null.

extendSelectionback to summary
public void extendSelection(StyledTextModel model, TextPos pos)

Extends selection to the specified position. Internally, the position will be normalized to be within the document boundaries. This method will issue a setSelection(model, pos, pos) call if the model instance is different from that passed before.

While this method will accept the text position outside of the document range, the actual values of anchorPositionProperty, and caretPositionProperty must always remain within the valid range for the document.

Parameters
model:StyledTextModel

the model, must be non-null

pos:TextPos

the new caret position, must be non-null

getSelectionback to summary
public SelectionSegment getSelection()

Returns the current selection. The value can be null, indicating no selection. When the selection segment is null, the anchorPositionProperty and the caretPositionProperty are also null.

Returns:SelectionSegment

current selection, or null

selectionPropertyback to summary
public ReadOnlyProperty<SelectionSegment> selectionProperty()

Selection property. The value can be null, indicating no selection. When the selection segment is null, the anchorPositionProperty and the caretPositionProperty are also null.

Returns:ReadOnlyProperty<SelectionSegment>

the selection property

Default Value
null
setSelectionback to summary
public void setSelection(StyledTextModel model, TextPos anchor, TextPos caret)

Replaced existing selection, if any, with the new one. While this method will accept the text positions outside of the document range, the actual values of anchorPositionProperty, and caretPositionProperty must always remain within the valid range for the document.

Parameters
model:StyledTextModel

the model, must be non-null

anchor:TextPos

the anchor position, must be non-null

caret:TextPos

the caret position, must be non-null