Class wobzilla_transaction

Object
   |
   +--wobzilla_transaction

class wobzilla_transaction

Transaction Handling in wobzilla. This service manages all changes to the data-model and can be used

  1. to encapsulate different elementary operations in one atomar transaction. Typically, this are operations that occur in the same user-interaction. A move, for example, consist of a remove and a insert operation.
  2. to undo of one or more transaction. Redo of the undone transactions is also possible.
  3. to notify other views, after a successful transaction, or after an undo transaction. This gives the views the oppertunity to refresh their state.

Assigned to every transaction is a wobzilla.changeLog-object, that keeps the elementary node-operations in the order of their execution. This changelog is passed to the requery methods of the views, after a successful transaction.

The inverse transaction is determined with the reversion of the order of the elementary operations and the inversion of each elementary operation. The inverses of the operations are calculated with the following table:

operationinverse operationAttribute-transformations
DOMNodeInsertedDOMNodeRemovedinverse.removeBefore=insertBefore
DOMNodeRemovedDOMNodeInsertedinverse.insertBefore=removeBefore
DOMAttrChangedDOMAttrChangedinverse.newValue=oldValue; inverse.oldValue=newValue


 
Method Summary
 function commit()
           Ends a started transaction and pushes the transaction to the undo-stack.
 function redo()
           removes a transaction from the redo-stack and inserts it into the undo-stack.
 function start()
           Starts a new transaction and clears the redo-stack.
 function undo()
           removes a transaction from the undo-stack and inserts it into the redo-stack.

Method Detail

commit

function commit()
Ends a started transaction and pushes the transaction to the undo-stack. Calls the requery-method on the root-view and passes the changeLog of the transaction as a parameter.



redo

function redo()
removes a transaction from the redo-stack and inserts it into the undo-stack. Executes the transaction and notifies the root-view.



start

function start()
Starts a new transaction and clears the redo-stack.



undo

function undo()
removes a transaction from the undo-stack and inserts it into the redo-stack. Executes the inverse transaction and notifies the root-view.