gabriel-cardoso/clawlab — pull request #21 by vala (2012-11-19 09:58:04+00:00)
Title: Composite action

I created the ability to create an action compound of several others, so we can have consistent behavior between UI and server side processing of actions that require several atomic ones.

As an example, I implemented the `ClipActionResize` action class so that when you call it with the appropriated params, it instanciantes 3 sub actions, namely : `ClipActionOffsetBegin`, `ClipActionOffsetEnd` and `ClipActionOffsetSource`.

When you call `#redo` on the composite action, each sub action's `#redo` is called. Same goes for `#undo` but are called on the reversed list of actions.

I had to abstract a bit the way the parent action is fetched and the way a node is added or removed from the tree so I could keep a normal behavior in atomic action's `#redo` and `#undo` while only adding composite action to the parent/children node tree when we're in that context.