|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
com.jaxfront.core.util.undo.UndoManagerWrapper
public class UndoManagerWrapper
Concrete subclass of CompoundEdit
which can serve as a UndoableEditListener,
consolidating the UndoableEditEvents from a
variety of sources, and undoing or redoing them one at a time.
Unlike AbstractUndoableEdit and CompoundEdit,
the public methods of this
class are synchronized, and should be safe to call from multiple
threads. This should make UndoManager
a convenient marshall for sets of undoable JavaBeans.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder.
| Constructor Summary | |
|---|---|
UndoManagerWrapper()
|
|
| Method Summary | |
|---|---|
boolean |
addEdit(javax.swing.undo.UndoableEdit anEdit)
If inProgress, inserts anEdit at indexOfNextAdd, and removes any old edits that were at indexOfNextAdd or later. |
boolean |
canRedo()
Overridden to preserve usual semantics: returns true if a redo operation would be successful now, false otherwise |
boolean |
canUndo()
Overridden to preserve usual semantics: returns true if an undo operation would be successful now, false otherwise |
boolean |
canUndoOrRedo()
Return true if calling undoOrRedo will undo or redo. |
void |
discardAllEdits()
Empty the undo manager, sending each edit a die message in the process. |
void |
end()
Sending end() to an UndoManager turns it into a plain old (ended) CompoundEdit. |
int |
getLimit()
Returns the maximum number of edits this UndoManager will hold. |
java.lang.String |
getRedoPresentationName()
If inProgress, returns getRedoPresentationName of the significant edit that will be redone when redo() is invoked. |
java.lang.String |
getUndoOrRedoPresentationName()
Return the appropriate name for a command that toggles between undo and redo. |
java.lang.String |
getUndoPresentationName()
If isInProgress(), returns getUndoPresentationName of the significant edit that will be undone when undo() is invoked. |
void |
redo()
If this UndoManager is inProgress,
redoes the last significant UndoableEdit at
indexOfNextAdd or after, and all insignificant
edits up to it. |
void |
setLimit(int l)
Set the maximum number of edits this UndoManager will hold. |
java.lang.String |
toString()
Returns a string that displays and identifies this object's properties. |
void |
undo()
If this UndoManager is inProgress, undo the last significant UndoableEdit before indexOfNextAdd, and all insignificant edits back to it. |
void |
undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Called by the UndoabledEdit sources this UndoManager listens to. |
void |
undoOrRedo()
Undo or redo as appropriate. |
| Methods inherited from class javax.swing.undo.CompoundEdit |
|---|
die, getPresentationName, isInProgress, isSignificant |
| Methods inherited from class javax.swing.undo.AbstractUndoableEdit |
|---|
replaceEdit |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UndoManagerWrapper()
| Method Detail |
|---|
public int getLimit()
addEdit(javax.swing.undo.UndoableEdit),
setLimit(int)public void discardAllEdits()
public void setLimit(int l)
addEdit(javax.swing.undo.UndoableEdit),
getLimit()
public void undoOrRedo()
throws javax.swing.undo.CannotRedoException,
javax.swing.undo.CannotUndoException
javax.swing.undo.CannotRedoException
javax.swing.undo.CannotUndoExceptioncanUndoOrRedo(),
getUndoOrRedoPresentationName()public boolean canUndoOrRedo()
undoOrRedo()
public void undo()
throws javax.swing.undo.CannotUndoException
If not inProgress, indexOfNextAdd is ignored and super's routine is called.
undo in interface javax.swing.undo.UndoableEditundo in class javax.swing.undo.CompoundEditjavax.swing.undo.CannotUndoExceptionCompoundEdit.end()public boolean canUndo()
canUndo in interface javax.swing.undo.UndoableEditcanUndo in class javax.swing.undo.CompoundEdit
public void redo()
throws javax.swing.undo.CannotRedoException
UndoManager is inProgress,
redoes the last significant UndoableEdit at
indexOfNextAdd or after, and all insignificant
edits up to it. Updates indexOfNextAdd accordingly.
If not inProgress, indexOfNextAdd
is ignored and super's routine is called.
redo in interface javax.swing.undo.UndoableEditredo in class javax.swing.undo.CompoundEditjavax.swing.undo.CannotRedoExceptionCompoundEdit.end()public boolean canRedo()
canRedo in interface javax.swing.undo.UndoableEditcanRedo in class javax.swing.undo.CompoundEditpublic boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
If not inProgress, acts as a
CompoundEdit.
addEdit in interface javax.swing.undo.UndoableEditaddEdit in class javax.swing.undo.CompoundEditanEdit - the edit to be addedCompoundEdit.end(),
CompoundEdit.addEdit(javax.swing.undo.UndoableEdit)public void end()
Calls super's end() method (making inProgress false), then sends die() to the unreachable edits at indexOfNextAdd and beyond, in the reverse of the order in which they were added.
end in class javax.swing.undo.CompoundEditCompoundEdit.end()public java.lang.String getUndoOrRedoPresentationName()
public java.lang.String getUndoPresentationName()
If not inProgress, acts as a CompoundEdit
getUndoPresentationName in interface javax.swing.undo.UndoableEditgetUndoPresentationName in class javax.swing.undo.CompoundEditundo(),
CompoundEdit.getUndoPresentationName()public java.lang.String getRedoPresentationName()
If not inProgress, acts as a CompoundEdit
getRedoPresentationName in interface javax.swing.undo.UndoableEditgetRedoPresentationName in class javax.swing.undo.CompoundEditredo(),
CompoundEdit.getUndoPresentationName()public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
undoableEditHappened in interface javax.swing.event.UndoableEditListeneraddEdit(javax.swing.undo.UndoableEdit)public java.lang.String toString()
toString in class javax.swing.undo.CompoundEdit
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||