Class MoveSelection
java.lang.Object
fr.istic.aco.editor.commands.MoveSelection
- All Implemented Interfaces:
- Command,- CommandOriginator,- Originator
The 
MoveSelection class implements the functionality for selecting the text within the interval- 
Constructor SummaryConstructorsConstructorDescriptionMoveSelection(Engine engine, Invoker invoker, Recorder recorder, UndoManager undoManager) Constructs aMoveSelectionwith the specified dependencies.
- 
Method SummaryModifier and TypeMethodDescriptionvoidexecute()Executes the command to update the text selection range.Creates and returns a memento representing the current state of the selection command.voidsetMemento(Memento memento) Restores the state of the command from the provided memento.
- 
Constructor Details- 
MoveSelectionConstructs aMoveSelectionwith the specified dependencies.- Parameters:
- engine- the text editing engine responsible for text editing actions
- invoker- the invoker object that provides the text to be inserted
- recorder- the command recorder for saving and replaying the command
- undoManager- the undo manager for handling undo and redo functionality
 
 
- 
- 
Method Details- 
getMementoCreates and returns a memento representing the current state of the selection command.The memento stores the beginning and ending indices of the selection range, which are retrieved from the Invoker.- Specified by:
- getMementoin interface- Originator
- Returns:
- a memento containing the selection range (beginning and ending indices)
 
- 
setMementoRestores the state of the command from the provided memento.The beginning and ending indices stored in the memento are restored to the Invoker.- Specified by:
- setMementoin interface- Originator
- Parameters:
- memento- the memento object containing the state to restore
 
- 
executepublic void execute()Executes the command to update the text selection range.This method performs the following steps: - Saves the current state of the Enginein theUndoManagerto enable undo functionality.
- Updates the selection range using the beginning and ending indices provided by the Invoker.
- Records the command in the Recorderfor replay functionality.
 
- Saves the current state of the 
 
-