Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Confused by Undo/Redo

Thread view: 
Jason Cavett - 18 Jun 2007 23:01 GMT
I'm completely confused and lost by undo/redo.  It seems that I need
to create a separate "Edit" (extends AbstractUndoableEdit) classes for
every single component (non-text) that exists in my GUI.  This makes
no sense, though (lots of repeated code, etc).  Does anybody have a
good tutorial or explanation of a better way to implement undo/redo?
I've searched all over the net and only text components show up
because they have built in undo support.  (I'm trying JCheckBoxes,
JTree, etc, etc.  I assume it would be the same across all components,
though.)

Thanks.
Silvio Bierman - 19 Jun 2007 09:35 GMT
> I'm completely confused and lost by undo/redo.  It seems that I need
> to create a separate "Edit" (extends AbstractUndoableEdit) classes for
[quoted text clipped - 7 lines]
>
> Thanks.

There are two possible approaches.

One is to maintain an undo-stack and a redo-stack of action object that have
undo and redo methods. This usually results in very tedious internal
application structure/logic but is sometimes the only affordable way to do
this (in terms of resources/time required).

The simpler more brute force approach is simply maintaining an undo and a
redo stack of complete document (whatever the document may be) states. This
may involve lots of copying etc. but is far more simple to do. Hence the
numerous applications with limited undo-depths.

Silvio Bierman


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.