The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

How to manage arbitrary Undo's and Redo's

Quick q. for all you programming wizards out there.  Suppose you have a program (not scripted), and you wish to have a "global" undo manager.  NOte that this is not only for text boxes, and such, but for global events such as "an increase in variable a", or "the deletion of object b".

What would be the best way to store/manage this type of thing?  Would you use something where everything has it's own undo/redo implementation, or some kind of parser/delegator?
glut
Monday, December 05, 2005
 
 
One way, if you have a command-oriented interface ( http://www.martinfowler.com/bliki/CommandOrientedInterface.html ), is to keep all your executed commands around in a stack and let them undo themselves as requested.
Matt.
Thursday, December 08, 2005
 
 
I've implemented undo/redo with varying complexity using Javas Undo Architecture. It follows a pretty simple pattern. Maybe reading about helps you:

http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/undo/package-summary.html

http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#undo


Janek.
Janek Schwarz Send private email
Friday, December 09, 2005
 
 
both were a good read, thanks!
glut
Friday, December 09, 2005
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz