Packagecom.yworks.support
Interfacepublic interface IUndoUnit
Implementors AbstractUndoUnit, CompoundUndoUnit, UndoEngine

Implements a unit that can be undone and redone.

This is main interface that implements undoability. UndoEngine can be used to manage implementations of this interface.

See also

UndoEngine


Public Properties
 PropertyDefined By
  redoName : String
[read-only] Returns the name of the redo unit.
IUndoUnit
  undoName : String
[read-only] The name of the undo unit.
IUndoUnit
Public Methods
 MethodDefined By
  
addUnit(unit:IUndoUnit):Boolean
Allows for collapsing multiple units into one.
IUndoUnit
  
canRedo():Boolean
Determines whether this instance can currently redo its work.
IUndoUnit
  
canUndo():Boolean
Determines whether this instance can currently undo its work.
IUndoUnit
  
dispose():void
Frees all used resources.
IUndoUnit
  
redo():void
Redoes the change that is represented by this unit.
IUndoUnit
  
replaceUnit(unit:IUndoUnit):Boolean
Allows for collapsing multiple units into one.
IUndoUnit
  
undo():void
Undoes the change that is represented by this unit.
IUndoUnit
Property Detail
redoNameproperty
redoName:String  [read-only]

Returns the name of the redo unit.

Depending on the implementation and context this might be a human readable representation of the redo action or a symbolic name that needs localization.


Implementation
    public function get redoName():String
undoNameproperty 
undoName:String  [read-only]

The name of the undo unit.

Depending on the implementation and context this might be a human readable representation of the undo action or a symbolic name that needs localization.


Implementation
    public function get undoName():String
Method Detail
addUnit()method
public function addUnit(unit:IUndoUnit):Boolean

Allows for collapsing multiple units into one.

Implementation should try to incorporate the change of unit into this and if successful return true. This method will be called by the UndoEngine to collapse multiple events into single events. Typically this unit has been placed onto an undo stack and unit should be placed on top of it. Both units have been done and might be undone in an upcoming action. If this method yields true, the provided unit will not be placed onto the stack but will be IDisposable.disposed.

Parameters

unit:IUndoUnit — The unit to incorporate that happened after this unit.

Returns
Boolean — Whether the state change of unit has been incorporated into this unit and unit can be disposed of.
canRedo()method 
public function canRedo():Boolean

Determines whether this instance can currently redo its work.

Returns
Boolean — Whether a call to redo will succeed.
canUndo()method 
public function canUndo():Boolean

Determines whether this instance can currently undo its work.

Returns
Boolean — Whether a call to undo will succeed.
dispose()method 
public function dispose():void

Frees all used resources.

redo()method 
public function redo():void

Redoes the change that is represented by this unit.

This method will only succeed if canRedo yields true.

See also

replaceUnit()method 
public function replaceUnit(unit:IUndoUnit):Boolean

Allows for collapsing multiple units into one.

Implementation should try to incorporate the change of unit into this and if successful return true. This method will be called by the UndoEngine to collapse multiple events into single events. Typically unit has already been placed onto an undo stack and this should be placed on top of it. Both units have been done and might be undone in an upcoming action. If this method yields true, this unit will replace the unit on the top of the stack and unit will be IDisposable.Disposed.

Parameters

unit:IUndoUnit — The unit to incorporate that happened before this unit.

Returns
Boolean — Whether the state change of unit has been incorporated into this unit and unit can be disposed of.
undo()method 
public function undo():void

Undoes the change that is represented by this unit.

This method will only succeed if canUndo yields true.

See also