ContentWelcomeProducts Abeona Gaia Hephaistos JavaGantt Features News Documentation Programming domain objects About JavaGantt model Undo / Redo support Localization support Building a treetable Painting a chart Working with the time scale JavaGantt actions License Download Purchase Services Promote your software Contact Us Links |
Undo / Redo supportJavaGantt uses Swing undo package functionality to provide support for undo / redo operations. There are two classes in eu.beesoft.gantt.undo package for that purpose:
StateEditableObject implements javax.swing.undo.StateEditable interface. Its constructor takes one object, and StateEditableObject can this object introspect and remember changed properties. UndoStep is the descendant of javax.swing.undo.CompoundEdit class. It serves as a container of all operations for one undo / redo step. It offers two methods:
If you want to process undo / redo, you have to:
Here is a code: // before any change occurs // object1 ... objectN are objects they could be changed UndoStep undo = new UndoStep (); undo.registerObject (object1); undo.registerObject (object2); ... undo.registerObject (objectN); // action code here ! ... // end of changes undo.end (); gantt.getUndoManager ().addEdit (undo);
|