Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Ctrl+Z To Undo
1. Ctrl-Z to Undo: Implementing a Transaction Manager in a Rich Internet Application Galen Riley galenriley@gmail.com@TotallyGreatBarCamp Chattanooga 2009
2. Agenda History of network applications Discuss advantages of RIAs Describe a transaction manager Write a simple application Implement the transaction manager
3. Client-Server Applications Client-Server Applications Installed on each machine Custom network programming Updates on the server may require updates on each client
4. Web Applications Exist entirely on a server Work in a browser – no installation! Easily managed and modified
5. Rich Internet Applications More sophisticated May require a browser plug-in Consistency across browsers Easy to do client-side execution Media
15. Checklist Stack data structure available anywhere in the program Classes to hold state information Command design pattern Method of passing messages
16. TransactionManager class privatevar _undoStack:Array; privatevar _redoStack:Array; publicfunction addTransaction( transaction:Transaction ) :void public function undo() :void public function redo() :void Dispatch events from here
17. Using the Transaction Manager Select interesting user actions Add Transaction objects to the manager Listen for TransactionEvent.UNDO and TransactionEvent.REDO Use the Transaction object to roll back the action Allow the user to Undo and Redo
18. One Last Thing Undoing an action runs code that modifies the TransactionManager’s stack Solution: Ignore transactions while executing a Undo privatevar _ignoreOutsideTransactions:Boolean; privatefunction ignoreOutsideUndoTransactions() :void privatefunction resumeOutsideUndoTransactions() :void
19. Advanced Features Multiple levels of undo privatestaticconst TRANSACTION_LIMIT:int = 10; Batch transactions Better UI Integration
20. Questions? Source code for the transaction manager and sample application are available. Email galenriley@gmail.com