Possible Duplicate:
Design Pattern for Undo Engine
In general, how do you deal with supporting an "undo" feature in your application? I have worked on web apps and desktop apps alike, and I have never really felt comfortable with any "undo" system I've made.
There are two main software development patterns that are the obvious choices when dealing with operations like undo and redo: Memento and Command patterns.
Memento pattern is used to restore state of an object to a previous state. As your application is progressing, you may want to save checkpoints in your application and restore back to those checkpoints later. originator : the object for which the state is to be saved.
I believe it should be Command design pattern.
Here is article about multilevel Undo/Redo with Command pattern.
EDIT: Here is second about multilevel Undo/Redo with Memento pattern.
So probably it can be done with both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With