Package | com.yworks.support |
Class | public class MementoUndoUnit |
Inheritance | MementoUndoUnit AbstractUndoUnit Object |
IUndoUnit
implementation that uses a IMementoSupport
to track, undo, and redo state changes on a given subject.
Method | Defined By | ||
---|---|---|---|
MementoUndoUnit(support:IMementoSupport, subject:Object, oldState:Object, undoName:String = null, redoName:String = null)
Initializes this unit using a given support instance, the subject and the state that to which
this unit should undo initially. | MementoUndoUnit | ||
[override]
Merges this unit if unit is of this type and they describe the same subject. | MementoUndoUnit | ||
canRedo():Boolean
Determines whether this instance can currently redo its work. | AbstractUndoUnit | ||
canUndo():Boolean
Determines whether this instance can currently undo its work. | AbstractUndoUnit | ||
dispose():void
Frees all used resources. | AbstractUndoUnit | ||
redo():void
Redoes the change that is represented by this unit. | AbstractUndoUnit | ||
replaceUnit(unit:IUndoUnit):Boolean [override]
Replaces this unit if unit is of this type and they describe the same subject. | MementoUndoUnit | ||
toString():String | MementoUndoUnit | ||
undo():void
Undoes the change that is represented by this unit. | AbstractUndoUnit |
Method | Defined By | ||
---|---|---|---|
redoImpl():void [override]
Stores the current state and applies the state saved in undoImpl. | MementoUndoUnit | ||
undoImpl():void [override]
Reads the current state and applies the old one. | MementoUndoUnit |
MementoUndoUnit | () | Constructor |
public function MementoUndoUnit(support:IMementoSupport, subject:Object, oldState:Object, undoName:String = null, redoName:String = null)
Initializes this unit using a given support instance, the subject and the state that to which this unit should undo initially.
Parameterssupport:IMementoSupport — The support that will be used to update and apply the state.
| |
subject:Object — The instance that will be modified.
| |
oldState:Object — The memento state object to which the subject will be rolled back
upon the first undo operation.
| |
undoName:String (default = null ) — The name of the undo action.
| |
redoName:String (default = null ) — The name of the redo action.
|
addUnit | () | method |
override public function addUnit(unit:IUndoUnit):Boolean
Merges this unit if unit
is of this type and they describe the same subject.
Parameters
unit:IUndoUnit — The unit to add.
|
Boolean — true if the unit was added.
|
redoImpl | () | method |
override protected function redoImpl():void
Stores the current state and applies the state saved in undoImpl
.
replaceUnit | () | method |
override public function replaceUnit(unit:IUndoUnit):Boolean
Replaces this unit if unit
is of this type and they describe the same subject.
Parameters
unit:IUndoUnit — The unit to replace.
|
Boolean — true if the unit was replaced.
|
toString | () | method |
public function toString():String
ReturnsString |
undoImpl | () | method |
override protected function undoImpl():void
Reads the current state and applies the old one.