It is possible in Lucy to make the effect of certain actions reversible. For instance, when a user graphically changes a shape,
we want to allow that this change is undone, and the original shape is restored. Lucy provides support for this concept. This
support is based on the LuciadLightspeed functionality centering around the ILcdUndoable
and ILcdUndoableListener
interfaces and the TLcdUndoManager
class.
A TLcdUndoManager
is available in the Lucy Environment and can be retrieved with the method getUndoManager
of the ILcyLucyEnv
. This TLcdUndoManager
implements the ILcdUndoableListener
and as such can be registered with any source of undoables. Typically, this source will be an ILcdAction
. For example, an ILcdAction
could delete an object from a model. To make this action reversible, it must create an ILcdUndoable
that adds the object again when its undo
method is invoked. The action should also notify its ILcdUndoableListener
instances, typically the TLcdUndoManager
, that a new undoable is available.
For more information about the LuciadLightspeed functionality regarding undoable actions, see Adding undo/redo support and Adding undo/redo support in GXY views.