PDA

View Full Version : Undo support in command framework?



adepue
Nov 1st, 2004, 01:14 PM
Has any thought been given to undo? The logical place for undo support, to me anyway, would be the command framework. Provide a way for commands to undo themselves, then provide a way to manage an undo/redo stack along with additional commands out-of-the-box to undo/redo, etc...

- Andy

pdbruycker
Nov 16th, 2004, 07:23 AM
The problem with undo management is that all your commands have to be undoable, otherwise you will leave the user confused.

Look at the Windows Explorer for example: some commands are undoable, other are not, and when you're pressing ctrl-z to undo your last changes, only some will be undone.

jdigger
Nov 16th, 2004, 09:25 AM
There is definately the possibility of confusion if not everything can be "undoable", but not everything even makes sense to be undoable. However, undo functionality is extremely nice when it's available.

It would be great (brainstorming here) if the CommandManager framework would automaticly handle registering events with javax.swing.undo.UndoManager if the command implements the javax.swing.undo.UndoableEdit interface. That's not exactly a trivial interface to implement, but for those commands that are important enough to be undoable, it would be great to make it an option using Swing's standard undo framework. (Probably a Spring Rich 1.1 type feature though...)