Interface SelectionModel
- All Known Implementing Classes:
SingleSelectionModel
SelectionSegment.- Since:
- 24
-
Property Summary
PropertiesTypePropertyDescriptionAnchor position property.Caret position property.Selection property. -
Method Summary
Modifier and TypeMethodDescriptionAnchor position property.Caret position property.voidclear()Clears the selection.voidextendSelection(StyledTextModel model, TextPos pos) Extends selection to the specified position.Returns the current selection.Selection property.voidsetSelection(StyledTextModel model, TextPos anchor, TextPos caret) Replaced existing selection, if any, with the new one.
-
Property Details
-
caretPosition
ReadOnlyProperty<TextPos> caretPositionPropertyCaret position property. The value can be null, indicating no selection. When the caret position isnull, theselectionPropertyand theanchorPositionPropertyare alsonull.Note:
selectionProperty(),anchorPositionProperty(), andcaretPositionProperty()are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.- Default value:
- null
- See Also:
-
anchorPosition
ReadOnlyProperty<TextPos> anchorPositionPropertyAnchor position property. The value can be null, indicating no selection. When the anchor position isnull, theselectionPropertyand thecaretPositionPropertyare alsonull.Note:
selectionProperty(),anchorPositionProperty(), andcaretPositionProperty()are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.- Default value:
- null
- See Also:
-
selection
ReadOnlyProperty<SelectionSegment> selectionPropertySelection property. The value can be null, indicating no selection. When the selection segment isnull, theanchorPositionPropertyand thecaretPositionPropertyare alsonull.- Default value:
- null
- See Also:
-
-
Method Details
-
clear
void clear()Clears the selection. This setsselectionProperty,anchorPositionProperty, andcaretPositionPropertyto null. -
setSelection
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 ofanchorPositionProperty, andcaretPositionPropertymust always remain within the valid range for the document.- Parameters:
model- the model, must be non-nullanchor- the anchor position, must be non-nullcaret- the caret position, must be non-null
-
extendSelection
Extends selection to the specified position. Internally, the position will be normalized to be within the document boundaries. This method will issue asetSelection(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, andcaretPositionPropertymust always remain within the valid range for the document.- Parameters:
model- the model, must be non-nullpos- the new caret position, must be non-null
-
caretPositionProperty
ReadOnlyProperty<TextPos> caretPositionProperty()Caret position property. The value can be null, indicating no selection. When the caret position isnull, theselectionPropertyand theanchorPositionPropertyare alsonull.Note:
selectionProperty(),anchorPositionProperty(), andcaretPositionProperty()are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.- Default value:
- null
- Returns:
- the caret position property
-
anchorPositionProperty
ReadOnlyProperty<TextPos> anchorPositionProperty()Anchor position property. The value can be null, indicating no selection. When the anchor position isnull, theselectionPropertyand thecaretPositionPropertyare alsonull.Note:
selectionProperty(),anchorPositionProperty(), andcaretPositionProperty()are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.- Default value:
- null
- Returns:
- the anchor position property
-
selectionProperty
ReadOnlyProperty<SelectionSegment> selectionProperty()Selection property. The value can be null, indicating no selection. When the selection segment isnull, theanchorPositionPropertyand thecaretPositionPropertyare alsonull.- Default value:
- null
- Returns:
- the selection property
- See Also:
-
getSelection
SelectionSegment getSelection()Returns the current selection. The value can be null, indicating no selection. When the selection segment isnull, theanchorPositionPropertyand thecaretPositionPropertyare alsonull.- Returns:
- current selection, or null
-