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.
-
JUndoManager()
-
-
addEdit(UndoableEdit)
- If inProgress, inserts anEdit at index, and removes any old
edits that were at index or later.
-
canRedo()
- Overridden to preserve usual semantics: returns true if a redo
operation would be successful now, false otherwise
-
canUndo()
- Overridden to preserve usual semantics: returns true if an undo
operation would be successful now, false otherwise
-
getRedoPresentationName()
- If inProgress, returns getRedoPresentationName of the
significant edit that will be redone when redo() is invoked.
-
getUndoPresentationName()
-
If inProgress, returns getUndoPresentationName of the
significant edit that will be undone when undo() is invoked.
-
init()
- Designated initializer, called by all constructors to
initialize ivars.
-
redo()
- If this JUndoManager is inProgress, redoes the last significant
UndoableEdit at index or after, and all insignificant edits up to
it.
-
redoTo(UndoableEdit)
- Redoes all changes from index to edit.
-
toRedo()
- Returns the the next significant edit to be redone if redo is
called.
-
toUndo()
- Returns the the next significant edit to be undone if undo is
called.
-
undo()
- If this JUndoManager is inProgress, undo the last significant
UndoableEdit before index, and all insignificant edits back to
it.
-
undoableEditHappened(UndoableEditEvent)
- Called by the UndoabledEdit sources this JUndoManager listens
to.
-
undoTo(UndoableEdit)
- Undoes all changes from index to edit.
JUndoManager
public JUndoManager()
init
protected void init()
- Designated initializer, called by all constructors to
initialize ivars. Sets index to 0.
- Overrides:
- init in class JCompoundEdit
toUndo
protected UndoableEdit toUndo()
- Returns the the next significant edit to be undone if undo is
called. May return null
toRedo
protected UndoableEdit toRedo()
- Returns the the next significant edit to be redone if redo is
called. May return null
undoTo
protected void undoTo(UndoableEdit edit) throws CannotUndoException
- Undoes all changes from index to edit. Updates index accordingly.
redoTo
protected void redoTo(UndoableEdit edit) throws CannotRedoException
- Redoes all changes from index to edit. Updates index accordingly.
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
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
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
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
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
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
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
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