Skip to main content
Participant
May 22, 2009
Question

UndoManager functionality gone in current builds?

  • May 22, 2009
  • 1 reply
  • 967 views

I noticed that UndoManager and IUndoManager have been removed from the most recent TLF builds and could not find anything that replaced said functionality.  Is undo/redo currently unavailable in TLF or am I mistaken?

This topic has been closed for replies.

1 reply

Adobe Employee
May 22, 2009

UndoManager and IUndoManager were moved into the flashx.undo namespace.  The functionality is not TLF specific although the code is in the TLF swc.  There is a new IOperation class in flashx.undo that defines an operation that can be managed by the UndoManager.  IOperation has two methods performUndo and performRedo which take no parameters and return void.

Still under consideration is adding new APIs to IUndoManager similar to the EditManager's beginCompositeOperation/endCompositeOperation for combining multiple operations into a single undoable unit.

Apologies for not including this in the release notes.  It went in in build 437 - I'll add something now.

Richard

May 23, 2009

I think the idea of adding/moving the composite operation behavior to the undo manager would be great!  We have been using the undo manager and operation behavior for other types of editing besides text flows.  One issue we've run into is that the CompositeOperation class will throw errors during undo/redo if the operations contained within the composite op have null textFlow.  Worked around this by extending CompositeOperation overriding the undo/redo methods though...

It would be nice if the IOperation interface included doOperation() and maybe undo() and redo().  Also, I was thinking about the possibility of having a different interface (something like IOperationManager, etc.) that classes which 'do' operations could implement, such as EditManager.  Maybe it would include a 'do op' method at the very least and maybe a few methods required for undo/redo support.  Then add ability for UndoManager to have an IOperationManager instance assigned through which it would make the undo/redo calls, instead of trying to retrieve a reference to the edit manager through the operations.

On second thought, we have cases now where we are sharing an undo manager between several edit managers...  Maybe you still keep the concept of having the new IOperationManager interface and then add a getOpMgr():IOpMgr method to the IOperation interface.  Then the FlowOperation class could just return textFlow.editMgr.

On another note, it would be useful if there was a more abstract base operation class that did not include concept of text flows and that the edit manager would still be able to 'do'.  I think that the IOperation interface could take the place of a more abstract base class if it included doOperation(), undo(), and redo()...  that's assuming that EditManager's doOp() and related methods could operate on IOperations instead of FlowOp's...

We are currently using operations and undo manager for performing operations with classes that are unrelated to TLF.  In some cases, we share undo manager instances between TLF edit managers and some of our own classes.  We had found ourselves implementing the full IEditManager interface just so that we could add operation/undo behavior, in which case 90% of the method stubs were empty and only exist to satisfy the interface (hence the suggestion for something like IOperationManager above).  BTW, the addition/separation of the IInteractionEventHandler interface is great also!

Just a few random ideas...  Hope this might shed a little light about how some of us are using the operations/undo behavior.

Thanks,

Brent