Class SingleSelectionModel
- All Implemented Interfaces:
SelectionModel
SelectionModel
supports a single selection segment.- Since:
- 24
-
Property Summary
PropertiesTypePropertyDescriptionAnchor position property.Caret position property.Selection property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAnchor position property.Caret position property.void
clear()
Clears the selection.void
extendSelection
(StyledTextModel model, TextPos pos) Extends selection to the specified position.Gets the value of theselection
property.Selection property.void
setSelection
(StyledTextModel model, TextPos anchor, TextPos caret) Replaced existing selection, if any, with the new one.
-
Property Details
-
anchorPosition
- Specified by:
anchorPositionProperty
in interfaceSelectionModel
- Returns:
- the anchor position property
- See Also:
-
caretPosition
- Specified by:
caretPositionProperty
in interfaceSelectionModel
- Returns:
- the caret position property
- See Also:
-
selection
- Specified by:
selectionProperty
in interfaceSelectionModel
- Returns:
- the selection property
- See Also:
-
-
Constructor Details
-
SingleSelectionModel
public SingleSelectionModel()The constructor.
-
-
Method Details
-
clear
public void clear()Description copied from interface:SelectionModel
Clears the selection. This setsselectionProperty
,anchorPositionProperty
, andcaretPositionProperty
to null.- Specified by:
clear
in interfaceSelectionModel
-
setSelection
Description copied from interface:SelectionModel
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
, andcaretPositionProperty
must always remain within the valid range for the document.- Specified by:
setSelection
in interfaceSelectionModel
- Parameters:
model
- the model, must be non-nullanchor
- the anchor position, must be non-nullcaret
- the caret position, must be non-null
-
extendSelection
Description copied from interface:SelectionModel
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
, andcaretPositionProperty
must always remain within the valid range for the document.- Specified by:
extendSelection
in interfaceSelectionModel
- Parameters:
model
- the model, must be non-nullpos
- the new caret position, must be non-null
-
anchorPositionProperty
Description copied from interface:SelectionModel
Anchor position property. The value can be null, indicating no selection. When the anchor position isnull
, theselectionProperty
and thecaretPositionProperty
are alsonull
.Note:
SelectionModel.selectionProperty()
,SelectionModel.anchorPositionProperty()
, andSelectionModel.caretPositionProperty()
are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.- Specified by:
anchorPositionProperty
in interfaceSelectionModel
- Returns:
- the
anchorPosition
property
-
caretPositionProperty
Description copied from interface:SelectionModel
Caret position property. The value can be null, indicating no selection. When the caret position isnull
, theselectionProperty
and theanchorPositionProperty
are alsonull
.Note:
SelectionModel.selectionProperty()
,SelectionModel.anchorPositionProperty()
, andSelectionModel.caretPositionProperty()
are logically connected. When a change occurs, the anchor position is updated first, followed by the caret position, followed by the selection segment.- Specified by:
caretPositionProperty
in interfaceSelectionModel
- Returns:
- the
caretPosition
property
-
selectionProperty
Description copied from interface:SelectionModel
Selection property. The value can be null, indicating no selection. When the selection segment isnull
, theanchorPositionProperty
and thecaretPositionProperty
are alsonull
.- Specified by:
selectionProperty
in interfaceSelectionModel
- Returns:
- the
selection
property - See Also:
-
getSelection
Gets the value of theselection
property.- Specified by:
getSelection
in interfaceSelectionModel
- Property description:
- Returns:
- the value of the
selection
property - See Also:
-