Undo/Redo, Subclasses and Lots of Listeners

J

Jason Cavett

I have some questions about implementing Undo/Redo.

Curerntly, in my application, I have a lot of fields that the user can
edit (text fields, check boxes, lists, etc). Currently I have
anonymous classes for the listeners. I found this somewhat necessary/
easy because every field causes some sort of reaction in the system
based on the user input and the reaction was different depending on
the field. (Ex: Clicking this checkbox enabled this text field and
disabled this list, or something like that.)

So, now I want to add Undo/Redo to all these components. From what I
can tell, I need to extend (most) of these components so that I can
provide undo support. I provide a way to add an UndoableEditListener
and I provide a way to post an edit. I also need to have individual
UndoableEdits which will extend AbstractUndoableEdit.

My question is this:
Do I (basically) need an UndoableEdit for every type of edit I have
out there? Additionally, how do I handle listeners? Will I need to
write a separate listener (as its own, named class) for each anonymous
listener so I can perform the "postEdit" within the action listener?

I think I have a decent understanding of what I'm supposed to
accomplish as I have already implemetned this for the JTree. I'm just
a little confused/overwhelmed with all the work that *appears* to need
to be done so I wanted to clarify before I started doing all that work
so I don't waste any time if its not necessary or if I'm missing
something fundamental.

Thanks for any advice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top