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.voidclear()Clears the selection.voidextendSelection(StyledTextModel model, TextPos pos) Extends selection to the specified position.Gets the value of theselectionproperty.Selection property.voidsetSelection(StyledTextModel model, TextPos anchor, TextPos caret) Replaced existing selection, if any, with the new one.
-
Property Details
-
anchorPosition
- Specified by:
anchorPositionPropertyin interfaceSelectionModel- Returns:
- the anchor position property
- See Also:
-
caretPosition
- Specified by:
caretPositionPropertyin interfaceSelectionModel- Returns:
- the caret position property
- See Also:
-
selection
- Specified by:
selectionPropertyin interfaceSelectionModel- Returns:
- the selection property
- See Also:
-
-
Constructor Details
-
SingleSelectionModel
public SingleSelectionModel()The constructor.
-
-
Method Details
-
clear
public void clear()Description copied from interface:SelectionModelClears the selection. This setsselectionProperty,anchorPositionProperty, andcaretPositionPropertyto null.- Specified by:
clearin interfaceSelectionModel
-
setSelection
Description copied from interface:SelectionModelReplaced 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.- Specified by:
setSelectionin 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:SelectionModelExtends 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.- Specified by:
extendSelectionin interfaceSelectionModel- Parameters:
model- the model, must be non-nullpos- the new caret position, must be non-null
-
anchorPositionProperty
Description copied from interface:SelectionModelAnchor position property. The value can be null, indicating no selection. When the anchor position isnull, theselectionPropertyand thecaretPositionPropertyare 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:
anchorPositionPropertyin interfaceSelectionModel- Returns:
- the
anchorPositionproperty
-
caretPositionProperty
Description copied from interface:SelectionModelCaret position property. The value can be null, indicating no selection. When the caret position isnull, theselectionPropertyand theanchorPositionPropertyare 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:
caretPositionPropertyin interfaceSelectionModel- Returns:
- the
caretPositionproperty
-
selectionProperty
Description copied from interface:SelectionModelSelection property. The value can be null, indicating no selection. When the selection segment isnull, theanchorPositionPropertyand thecaretPositionPropertyare alsonull.- Specified by:
selectionPropertyin interfaceSelectionModel- Returns:
- the
selectionproperty - See Also:
-
getSelection
Gets the value of theselectionproperty.- Specified by:
getSelectionin interfaceSelectionModel- Property description:
- Returns:
- the value of the
selectionproperty - See Also:
-