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 TypeMethodDescriptionvoidCopies the text within the interval specified by the selection control object into the clipboard.voidRemoves the text within the interval specified by the selection control object, from the buffer.voiddelete()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 objectvoidInserts a string in the buffer, which replaces the contents of the selectionvoidReplaces the text within the interval specified by the selection object with the contents of the clipboard.voidsetMemento(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:
getSelectionin interfaceEngine- Returns:
- the selection object
-
getBufferContents
Provides the whole contents of the buffer, as a string- Specified by:
getBufferContentsin interfaceEngine- Returns:
- a copy of the buffer's contents
-
getClipboardContents
Provides the clipboard contents- Specified by:
getClipboardContentsin 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:
cutSelectedTextin interfaceEngine
-
copySelectedText
public void copySelectedText()Copies the text within the interval specified by the selection control object into the clipboard.- Specified by:
copySelectedTextin interfaceEngine
-
pasteClipboard
public void pasteClipboard()Replaces the text within the interval specified by the selection object with the contents of the clipboard.- Specified by:
pasteClipboardin interfaceEngine
-
insert
-
delete
-
setMemento
Description copied from interface:Originatorsets the attributes of the object calling this method to match the attributes the memento- Specified by:
setMementoin interfaceOriginator- Parameters:
memento- Sets the attributes of the engine as in the memento
-
getMemento
Description copied from interface:Originatorsaves the state of the object calling this method in a memento matching the type of the object- Specified by:
getMementoin interfaceOriginator- Returns:
- a memento of the state of the engine ie the clipboard, the selection, the buffer
-