All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.undo.JUndoManager

java.lang.Object
   |
   +----com.sun.java.swing.undo.JUndoableEdit
           |
           +----com.sun.java.swing.undo.JCompoundEdit
                   |
                   +----com.sun.java.swing.undo.JUndoManager

public class JUndoManager
extends JCompoundEdit
implements UndoableEditListener
Concrete subclass of JCompoundEdit which can serve as an UndoableEditListener, consolidating the UndoableEditEvents from a variety of sources, and undoing or redoing them one at a time. Unlike JUndoableEdit and JCompoundEdit, the public methods of this class are synchronized, and should be safe to call from multiple threads. This should make JUndoManager a convenient marshall for sets of undoable JavaBeans.


Constructor Index

 o JUndoManager()

Method Index

 o addEdit(UndoableEdit)
If inProgress, inserts anEdit at index, and removes any old edits that were at index or later.
 o canRedo()
Overridden to preserve usual semantics: returns true if a redo operation would be successful now, false otherwise
 o canUndo()
Overridden to preserve usual semantics: returns true if an undo operation would be successful now, false otherwise
 o getRedoPresentationName()
If inProgress, returns getRedoPresentationName of the significant edit that will be redone when redo() is invoked.
 o getUndoPresentationName()

If inProgress, returns getUndoPresentationName of the significant edit that will be undone when undo() is invoked.

 o init()
Designated initializer, called by all constructors to initialize ivars.
 o redo()
If this JUndoManager is inProgress, redoes the last significant UndoableEdit at index or after, and all insignificant edits up to it.
 o redoTo(UndoableEdit)
Redoes all changes from index to edit.
 o toRedo()
Returns the the next significant edit to be redone if redo is called.
 o toUndo()
Returns the the next significant edit to be undone if undo is called.
 o undo()
If this JUndoManager is inProgress, undo the last significant UndoableEdit before index, and all insignificant edits back to it.
 o undoableEditHappened(UndoableEditEvent)
Called by the UndoabledEdit sources this JUndoManager listens to.
 o undoTo(UndoableEdit)
Undoes all changes from index to edit.

Constructors

 o JUndoManager
 public JUndoManager()

Methods

 o init
 protected void init()
Designated initializer, called by all constructors to initialize ivars. Sets index to 0.

Overrides:
init in class JCompoundEdit
 o toUndo
 protected UndoableEdit toUndo()
Returns the the next significant edit to be undone if undo is called. May return null

 o toRedo
 protected UndoableEdit toRedo()
Returns the the next significant edit to be redone if redo is called. May return null

 o undoTo
 protected void undoTo(UndoableEdit edit) throws CannotUndoException
Undoes all changes from index to edit. Updates index accordingly.

 o redoTo
 protected void redoTo(UndoableEdit edit) throws CannotRedoException
Redoes all changes from index to edit. Updates index accordingly.

 o undo
 public synchronized void undo() throws CannotUndoException
If this JUndoManager is inProgress, undo the last significant UndoableEdit before index, and all insignificant edits back to it. Updates index accordingly.

If not inProgress, index is ignored and super's routine is called.

Overrides:
undo in class JCompoundEdit
See Also:
end
 o canUndo
 public synchronized boolean canUndo()
Overridden to preserve usual semantics: returns true if an undo operation would be successful now, false otherwise

Overrides:
canUndo in class JUndoableEdit
 o redo
 public synchronized void redo() throws CannotRedoException
If this JUndoManager is inProgress, redoes the last significant UndoableEdit at index or after, and all insignificant edits up to it. Updates index accordingly.

If not inProgress, index is ignored and super's routine is called.

Overrides:
redo in class JCompoundEdit
See Also:
end
 o canRedo
 public synchronized boolean canRedo()
Overridden to preserve usual semantics: returns true if a redo operation would be successful now, false otherwise

Overrides:
canRedo in class JUndoableEdit
 o addEdit
 public synchronized boolean addEdit(UndoableEdit anEdit)
If inProgress, inserts anEdit at index, and removes any old edits that were at index or later. Updates index.

If not inProgress, acts as a JCompoundEdit

Overrides:
addEdit in class JCompoundEdit
See Also:
end, addEdit
 o getUndoPresentationName
 public synchronized String getUndoPresentationName()

If inProgress, returns getUndoPresentationName of the significant edit that will be undone when undo() is invoked. If there is none, returns JUndoableEdit.UndoName

If not inProgress, acts as a JCompoundEdit

Overrides:
getUndoPresentationName in class JCompoundEdit
See Also:
undo, getUndoPresentationName
 o getRedoPresentationName
 public synchronized String getRedoPresentationName()
If inProgress, returns getRedoPresentationName of the significant edit that will be redone when redo() is invoked. If there is none, returns JUndoableEdit.RedoName

If not inProgress, acts as a JCompoundEdit

Overrides:
getRedoPresentationName in class JCompoundEdit
See Also:
redo, getUndoPresentationName
 o undoableEditHappened
 public void undoableEditHappened(UndoableEditEvent e)
Called by the UndoabledEdit sources this JUndoManager listens to. Calls addEdit with e.getEdit().

See Also:
addEdit

All Packages  Class Hierarchy  This Package  Previous  Next  Index