Class EngineImpl
java.lang.Object
fr.istic.aco.editor.core.EngineImpl
- All Implemented Interfaces:
Engine
,Originator
This class represents an implementation of the Engine interface, which
controls the main editing operations of a text editor such as insert, delete, cut, copy, and paste.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Copies the text within the interval specified by the selection control object into the clipboard.void
Removes the text within the interval specified by the selection control object, from the buffer.void
delete()
Removes the contents of the selection in the bufferProvides the whole contents of the buffer, as a stringProvides the clipboard contentssaves the state of the object calling this method in a memento matching the type of the objectProvides access to the selection control objectvoid
Inserts a string in the buffer, which replaces the contents of the selectionvoid
Replaces the text within the interval specified by the selection object with the contents of the clipboard.void
setMemento
(Memento memento) sets the attributes of the object calling this method to match the attributes the memento
-
Constructor Details
-
EngineImpl
public EngineImpl()
-
-
Method Details
-
getSelection
Provides access to the selection control object- Specified by:
getSelection
in interfaceEngine
- Returns:
- the selection object
-
getBufferContents
Provides the whole contents of the buffer, as a string- Specified by:
getBufferContents
in interfaceEngine
- Returns:
- a copy of the buffer's contents
-
getClipboardContents
Provides the clipboard contents- Specified by:
getClipboardContents
in interfaceEngine
- Returns:
- a copy of the clipboard's contents
-
cutSelectedText
public void cutSelectedText()Removes the text within the interval specified by the selection control object, from the buffer.- Specified by:
cutSelectedText
in interfaceEngine
-
copySelectedText
public void copySelectedText()Copies the text within the interval specified by the selection control object into the clipboard.- Specified by:
copySelectedText
in interfaceEngine
-
pasteClipboard
public void pasteClipboard()Replaces the text within the interval specified by the selection object with the contents of the clipboard.- Specified by:
pasteClipboard
in interfaceEngine
-
insert
-
delete
-
setMemento
Description copied from interface:Originator
sets the attributes of the object calling this method to match the attributes the memento- Specified by:
setMemento
in interfaceOriginator
- Parameters:
memento
- Sets the attributes of the engine as in the memento
-
getMemento
Description copied from interface:Originator
saves the state of the object calling this method in a memento matching the type of the object- Specified by:
getMemento
in interfaceOriginator
- Returns:
- a memento of the state of the engine ie the clipboard, the selection, the buffer
-