tyler wright - undo history with flight
DESCRIPTION
Undo & redo is a core feature to many applications, yet it's missing from your Flash and Flex projects. Learn how to easily add history to your applications with little effort. This session covers the concepts, benefits and the techniques of history management. It breaks down the complexity of undo & redo implementation into simple code, illustrating the use of the Command Pattern and providing the tools necessary to get up and running within minutes. This session is targeted toward intermediate developers, but will be a great overview of application history for beginners and non-programmers.TRANSCRIPT
![Page 1: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/1.jpg)
Undo History with FlightChange the Past.
![Page 2: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/2.jpg)
IntoductionTyler Wright – www.xtyler.com
Flight Framework – www.flightxd.comRobert Taylor – www.roboncode.comJacob Wright – jacwright.com
Resources: www.xtyler.com/history
![Page 3: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/3.jpg)
Ctrl+Z
Desktop Applications
Browser TextFields
What about Rich Internet Applications?
Users can enjoy making mistakes
![Page 4: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/4.jpg)
Flight Frameworkan application frameworkan undo frameworka command factorya data binding fienda way to get datesa coven of design patterns
![Page 5: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/5.jpg)
Anatomy of Undo
Undoable Actionmeans of reverting that action
recover from a single mistake
Memory of actionsqueue of undoable actions
recover from a history of mistakes
Change the past.
![Page 6: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/6.jpg)
Anatomy of Undo• Undoable Action• Action Memory
![Page 7: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/7.jpg)
Generic vs. SpecificOne-size fits all
“automatic”
centralized logic handles undo on all actions
actions must fit the mold
Everyone is special
custom
separate logic for undo on each action
every action unique
![Page 8: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/8.jpg)
Command your Actions
Methods define our system’s actions
State is represented by local data – goes away
Command: an objectified method, storing local data
Portable – pass around the system as an object
![Page 9: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/9.jpg)
Implement to an Interface
Interfaces: create types by contract
ICommandexecute():void
IUndoableCommandundo():void
redo():void
![Page 10: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/10.jpg)
CommandHistory
Undo & Redo “right out of the box”
ICommandInvokerexecuteCommand(command:ICommand):void
ICommandHistorycanUndo():Boolean, canRedo():Boolean
undo():Boolean, redo():Boolean
undoLimit:int, etc…
![Page 11: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/11.jpg)
Action Memory RealizedCommands become our undoable actionsCommandHistory becomes our memory of actions
![Page 12: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/12.jpg)
Generic heart SpecificOne-size fits all
“automatic”
single command to represent all actions
Everyone is speaical
custom
a separate Command for each action
Marriage by CommandConsolidates these approaches.Provides a single interface to undo and redo.Mix approaches or migrate from one to another without changing API.
![Page 13: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/13.jpg)
Your First History Lesson
The History PanelPhotoshop
Flash
The Project(break to code right here)
On Into the Details
![Page 14: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/14.jpg)
Short-term Memory
Undo limits
Considering stored data types
Clearing memory – release event listeners and bindings
Weak-referenced event listeners and binding
Saving history to disk
![Page 15: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/15.jpg)
Merging
Actions repeated
IMergingCommandmerge (source:Object):Boolean
Originating Command inspects fellows before discarding them – self reflection leads to a greater self
Compared to MacroCommands
![Page 16: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/16.jpg)
Flight Framework Reloaded
Offers the HistoryController as an extension of application-level Controllers
Command FactoryaddCommand(type:String, commandClass:Class):voidcreateCommand(type:String):ICommand
Enables direct upgrade from a common application to one with undo and redo, minimal changes
Much more…
![Page 17: Tyler Wright - Undo History with Flight](https://reader033.vdocument.in/reader033/viewer/2022052618/54b48b104a7959da6c8b4622/html5/thumbnails/17.jpg)
Change the Past.Tyler Wright – www.xtyler.com
Flight Framework – www.flightxd.comRobert Taylor – www.roboncode.comJacob Wright – jacwright.com
Resources: www.xtyler.com/history