javax.swing.undo
Class UndoManager

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.undo.AbstractUndoableEdit sample code for javax.swing.undo.AbstractUndoableEdit definition code for javax.swing.undo.AbstractUndoableEdit 
      extended by javax.swing.undo.CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit 
          extended by javax.swing.undo.UndoManager
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , EventListener sample code for java.util.EventListener definition code for java.util.EventListener , UndoableEditListener sample code for javax.swing.event.UndoableEditListener definition code for javax.swing.event.UndoableEditListener , UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit

public class UndoManager
extends CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
implements UndoableEditListener sample code for javax.swing.event.UndoableEditListener definition code for javax.swing.event.UndoableEditListener

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 sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
edits sample code for javax.swing.undo.CompoundEdit.edits definition code for javax.swing.undo.CompoundEdit.edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit sample code for javax.swing.undo.AbstractUndoableEdit definition code for javax.swing.undo.AbstractUndoableEdit
RedoName sample code for javax.swing.undo.AbstractUndoableEdit.RedoName definition code for javax.swing.undo.AbstractUndoableEdit.RedoName , UndoName sample code for javax.swing.undo.AbstractUndoableEdit.UndoName definition code for javax.swing.undo.AbstractUndoableEdit.UndoName
 
Constructor Summary
UndoManager sample code for javax.swing.undo.UndoManager.UndoManager() definition code for javax.swing.undo.UndoManager.UndoManager() ()
           
 
Method Summary
 boolean addEdit sample code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) (UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  anEdit)
          If inProgress, inserts anEdit at indexOfNextAdd, and removes any old edits that were at indexOfNextAdd or later.
 boolean canRedo sample code for javax.swing.undo.UndoManager.canRedo() definition code for javax.swing.undo.UndoManager.canRedo() ()
          Overridden to preserve usual semantics: returns true if a redo operation would be successful now, false otherwise
 boolean canUndo sample code for javax.swing.undo.UndoManager.canUndo() definition code for javax.swing.undo.UndoManager.canUndo() ()
          Overridden to preserve usual semantics: returns true if an undo operation would be successful now, false otherwise
 boolean canUndoOrRedo sample code for javax.swing.undo.UndoManager.canUndoOrRedo() definition code for javax.swing.undo.UndoManager.canUndoOrRedo() ()
          Return true if calling undoOrRedo will undo or redo.
 void discardAllEdits sample code for javax.swing.undo.UndoManager.discardAllEdits() definition code for javax.swing.undo.UndoManager.discardAllEdits() ()
          Empty the undo manager, sending each edit a die message in the process.
protected  UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit editToBeRedone sample code for javax.swing.undo.UndoManager.editToBeRedone() definition code for javax.swing.undo.UndoManager.editToBeRedone() ()
          Returns the the next significant edit to be redone if redo is called.
protected  UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit editToBeUndone sample code for javax.swing.undo.UndoManager.editToBeUndone() definition code for javax.swing.undo.UndoManager.editToBeUndone() ()
          Returns the the next significant edit to be undone if undo is called.
 void end sample code for javax.swing.undo.UndoManager.end() definition code for javax.swing.undo.UndoManager.end() ()
          Sending end() to an UndoManager turns it into a plain old (ended) CompoundEdit.
 int getLimit sample code for javax.swing.undo.UndoManager.getLimit() definition code for javax.swing.undo.UndoManager.getLimit() ()
          Returns the maximum number of edits this UndoManager will hold.
 String sample code for java.lang.String definition code for java.lang.String getRedoPresentationName sample code for javax.swing.undo.UndoManager.getRedoPresentationName() definition code for javax.swing.undo.UndoManager.getRedoPresentationName() ()
          If inProgress, returns getRedoPresentationName of the significant edit that will be redone when redo() is invoked.
 String sample code for java.lang.String definition code for java.lang.String getUndoOrRedoPresentationName sample code for javax.swing.undo.UndoManager.getUndoOrRedoPresentationName() definition code for javax.swing.undo.UndoManager.getUndoOrRedoPresentationName() ()
          Return the appropriate name for a command that toggles between undo and redo.
 String sample code for java.lang.String definition code for java.lang.String getUndoPresentationName sample code for javax.swing.undo.UndoManager.getUndoPresentationName() definition code for javax.swing.undo.UndoManager.getUndoPresentationName() ()
          If inProgress, returns getUndoPresentationName of the significant edit that will be undone when undo() is invoked.
 void redo sample code for javax.swing.undo.UndoManager.redo() definition code for javax.swing.undo.UndoManager.redo() ()
          If this UndoManager is inProgress, redoes the last significant UndoableEdit at indexOfNextAdd or after, and all insignificant edits up to it.
protected  void redoTo sample code for javax.swing.undo.UndoManager.redoTo(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.redoTo(javax.swing.undo.UndoableEdit) (UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  edit)
          Redoes all changes from indexOfNextAdd to edit.
 void setLimit sample code for javax.swing.undo.UndoManager.setLimit(int) definition code for javax.swing.undo.UndoManager.setLimit(int) (int l)
          Set the maximum number of edits this UndoManager will hold.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.swing.undo.UndoManager.toString() definition code for javax.swing.undo.UndoManager.toString() ()
          Returns a string that displays and identifies this object's properties.
protected  void trimEdits sample code for javax.swing.undo.UndoManager.trimEdits(int, int) definition code for javax.swing.undo.UndoManager.trimEdits(int, int) (int from, int to)
          Tell the edits in the given range (inclusive) to die, and remove them from edits.
protected  void trimForLimit sample code for javax.swing.undo.UndoManager.trimForLimit() definition code for javax.swing.undo.UndoManager.trimForLimit() ()
          Reduce the number of queued edits to a range of size limit, centered on indexOfNextAdd.
 void undo sample code for javax.swing.undo.UndoManager.undo() definition code for javax.swing.undo.UndoManager.undo() ()
          If this UndoManager is inProgress, undo the last significant UndoableEdit before indexOfNextAdd, and all insignificant edits back to it.
 void undoableEditHappened sample code for javax.swing.undo.UndoManager.undoableEditHappened(javax.swing.event.UndoableEditEvent) definition code for javax.swing.undo.UndoManager.undoableEditHappened(javax.swing.event.UndoableEditEvent) (UndoableEditEvent sample code for javax.swing.event.UndoableEditEvent definition code for javax.swing.event.UndoableEditEvent  e)
          Called by the UndoabledEdit sources this UndoManager listens to.
 void undoOrRedo sample code for javax.swing.undo.UndoManager.undoOrRedo() definition code for javax.swing.undo.UndoManager.undoOrRedo() ()
          Undo or redo as appropriate.
protected  void undoTo sample code for javax.swing.undo.UndoManager.undoTo(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.undoTo(javax.swing.undo.UndoableEdit) (UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  edit)
          Undoes all changes from indexOfNextAdd to edit.
 
Methods inherited from class javax.swing.undo.CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
die sample code for javax.swing.undo.CompoundEdit.die() definition code for javax.swing.undo.CompoundEdit.die() , getPresentationName sample code for javax.swing.undo.CompoundEdit.getPresentationName() definition code for javax.swing.undo.CompoundEdit.getPresentationName() , isInProgress sample code for javax.swing.undo.CompoundEdit.isInProgress() definition code for javax.swing.undo.CompoundEdit.isInProgress() , isSignificant sample code for javax.swing.undo.CompoundEdit.isSignificant() definition code for javax.swing.undo.CompoundEdit.isSignificant() , lastEdit sample code for javax.swing.undo.CompoundEdit.lastEdit() definition code for javax.swing.undo.CompoundEdit.lastEdit()
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit sample code for javax.swing.undo.AbstractUndoableEdit definition code for javax.swing.undo.AbstractUndoableEdit
replaceEdit sample code for javax.swing.undo.AbstractUndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.AbstractUndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

UndoManager sample code for javax.swing.undo.UndoManager() definition code for javax.swing.undo.UndoManager()

public UndoManager()
Method Detail

getLimit sample code for javax.swing.undo.UndoManager.getLimit() definition code for javax.swing.undo.UndoManager.getLimit()

public int getLimit()
Returns the maximum number of edits this UndoManager will hold. Default value is 100.

See Also:
addEdit(javax.swing.undo.UndoableEdit) sample code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) , setLimit(int) sample code for javax.swing.undo.UndoManager.setLimit(int) definition code for javax.swing.undo.UndoManager.setLimit(int)

discardAllEdits sample code for javax.swing.undo.UndoManager.discardAllEdits() definition code for javax.swing.undo.UndoManager.discardAllEdits()

public void discardAllEdits()
Empty the undo manager, sending each edit a die message in the process.


trimForLimit sample code for javax.swing.undo.UndoManager.trimForLimit() definition code for javax.swing.undo.UndoManager.trimForLimit()

protected void trimForLimit()
Reduce the number of queued edits to a range of size limit, centered on indexOfNextAdd.


trimEdits sample code for javax.swing.undo.UndoManager.trimEdits(int, int) definition code for javax.swing.undo.UndoManager.trimEdits(int, int)

protected void trimEdits(int from,
                         int to)
Tell the edits in the given range (inclusive) to die, and remove them from edits. from > to is a no-op.


setLimit sample code for javax.swing.undo.UndoManager.setLimit(int) definition code for javax.swing.undo.UndoManager.setLimit(int)

public void setLimit(int l)
Set the maximum number of edits this UndoManager will hold. If edits need to be discarded to shrink the limit, they will be told to die in the reverse of the order that they were added.

See Also:
addEdit(javax.swing.undo.UndoableEdit) sample code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) , getLimit() sample code for javax.swing.undo.UndoManager.getLimit() definition code for javax.swing.undo.UndoManager.getLimit()

editToBeUndone sample code for javax.swing.undo.UndoManager.editToBeUndone() definition code for javax.swing.undo.UndoManager.editToBeUndone()

protected UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  editToBeUndone()
Returns the the next significant edit to be undone if undo is called. May return null


editToBeRedone sample code for javax.swing.undo.UndoManager.editToBeRedone() definition code for javax.swing.undo.UndoManager.editToBeRedone()

protected UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  editToBeRedone()
Returns the the next significant edit to be redone if redo is called. May return null


undoTo sample code for javax.swing.undo.UndoManager.undoTo(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.undoTo(javax.swing.undo.UndoableEdit)

protected void undoTo(UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  edit)
               throws CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException 
Undoes all changes from indexOfNextAdd to edit. Updates indexOfNextAdd accordingly.

Throws:
CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException

redoTo sample code for javax.swing.undo.UndoManager.redoTo(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.redoTo(javax.swing.undo.UndoableEdit)

protected void redoTo(UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  edit)
               throws CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException 
Redoes all changes from indexOfNextAdd to edit. Updates indexOfNextAdd accordingly.

Throws:
CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException

undoOrRedo sample code for javax.swing.undo.UndoManager.undoOrRedo() definition code for javax.swing.undo.UndoManager.undoOrRedo()

public void undoOrRedo()
                throws CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException ,
                       CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException 
Undo or redo as appropriate. Suitable for binding to an action that toggles between these two functions. Only makes sense to send this if limit == 1.

Throws:
CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException
CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException
See Also:
canUndoOrRedo() sample code for javax.swing.undo.UndoManager.canUndoOrRedo() definition code for javax.swing.undo.UndoManager.canUndoOrRedo() , getUndoOrRedoPresentationName() sample code for javax.swing.undo.UndoManager.getUndoOrRedoPresentationName() definition code for javax.swing.undo.UndoManager.getUndoOrRedoPresentationName()

canUndoOrRedo sample code for javax.swing.undo.UndoManager.canUndoOrRedo() definition code for javax.swing.undo.UndoManager.canUndoOrRedo()

public boolean canUndoOrRedo()
Return true if calling undoOrRedo will undo or redo. Suitable for deciding to enable a command that toggles between the two functions, which only makes sense to use if limit == 1.

See Also:
undoOrRedo() sample code for javax.swing.undo.UndoManager.undoOrRedo() definition code for javax.swing.undo.UndoManager.undoOrRedo()

undo sample code for javax.swing.undo.UndoManager.undo() definition code for javax.swing.undo.UndoManager.undo()

public void undo()
          throws CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException 
If this UndoManager is inProgress, undo the last significant UndoableEdit before indexOfNextAdd, and all insignificant edits back to it. Updates indexOfNextAdd accordingly.

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

Specified by:
undo sample code for javax.swing.undo.UndoableEdit.undo() definition code for javax.swing.undo.UndoableEdit.undo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
undo sample code for javax.swing.undo.CompoundEdit.undo() definition code for javax.swing.undo.CompoundEdit.undo() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Throws:
CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException - if canUndo returns false
See Also:
CompoundEdit.end() sample code for javax.swing.undo.CompoundEdit.end() definition code for javax.swing.undo.CompoundEdit.end()

canUndo sample code for javax.swing.undo.UndoManager.canUndo() definition code for javax.swing.undo.UndoManager.canUndo()

public boolean canUndo()
Overridden to preserve usual semantics: returns true if an undo operation would be successful now, false otherwise

Specified by:
canUndo sample code for javax.swing.undo.UndoableEdit.canUndo() definition code for javax.swing.undo.UndoableEdit.canUndo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
canUndo sample code for javax.swing.undo.CompoundEdit.canUndo() definition code for javax.swing.undo.CompoundEdit.canUndo() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Returns:
true if this edit is alive and hasBeenDone is true
See Also:
CompoundEdit.isInProgress() sample code for javax.swing.undo.CompoundEdit.isInProgress() definition code for javax.swing.undo.CompoundEdit.isInProgress()

redo sample code for javax.swing.undo.UndoManager.redo() definition code for javax.swing.undo.UndoManager.redo()

public void redo()
          throws CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException 
If this 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.

Specified by:
redo sample code for javax.swing.undo.UndoableEdit.redo() definition code for javax.swing.undo.UndoableEdit.redo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
redo sample code for javax.swing.undo.CompoundEdit.redo() definition code for javax.swing.undo.CompoundEdit.redo() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Throws:
CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException - if canRedo returns false
See Also:
CompoundEdit.end() sample code for javax.swing.undo.CompoundEdit.end() definition code for javax.swing.undo.CompoundEdit.end()

canRedo sample code for javax.swing.undo.UndoManager.canRedo() definition code for javax.swing.undo.UndoManager.canRedo()

public boolean canRedo()
Overridden to preserve usual semantics: returns true if a redo operation would be successful now, false otherwise

Specified by:
canRedo sample code for javax.swing.undo.UndoableEdit.canRedo() definition code for javax.swing.undo.UndoableEdit.canRedo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
canRedo sample code for javax.swing.undo.CompoundEdit.canRedo() definition code for javax.swing.undo.CompoundEdit.canRedo() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Returns:
true if this edit is alive and hasBeenDone is false
See Also:
CompoundEdit.isInProgress() sample code for javax.swing.undo.CompoundEdit.isInProgress() definition code for javax.swing.undo.CompoundEdit.isInProgress()

addEdit sample code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit)

public boolean addEdit(UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  anEdit)
If inProgress, inserts anEdit at indexOfNextAdd, and removes any old edits that were at indexOfNextAdd or later. The die method is called on each edit that is removed is sent, in the reverse of the order the edits were added. Updates indexOfNextAdd.

If not inProgress, acts as a CompoundEdit.

Specified by:
addEdit sample code for javax.swing.undo.UndoableEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoableEdit.addEdit(javax.swing.undo.UndoableEdit) in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
addEdit sample code for javax.swing.undo.CompoundEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.CompoundEdit.addEdit(javax.swing.undo.UndoableEdit) in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Parameters:
anEdit - the edit to be added
Returns:
true if the edit is inProgress; otherwise returns false
See Also:
CompoundEdit.end() sample code for javax.swing.undo.CompoundEdit.end() definition code for javax.swing.undo.CompoundEdit.end() , CompoundEdit.addEdit(javax.swing.undo.UndoableEdit) sample code for javax.swing.undo.CompoundEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.CompoundEdit.addEdit(javax.swing.undo.UndoableEdit)

end sample code for javax.swing.undo.UndoManager.end() definition code for javax.swing.undo.UndoManager.end()

public void end()
Sending end() to an UndoManager turns it into a plain old (ended) CompoundEdit.

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.

Overrides:
end sample code for javax.swing.undo.CompoundEdit.end() definition code for javax.swing.undo.CompoundEdit.end() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
See Also:
CompoundEdit.end() sample code for javax.swing.undo.CompoundEdit.end() definition code for javax.swing.undo.CompoundEdit.end()

getUndoOrRedoPresentationName sample code for javax.swing.undo.UndoManager.getUndoOrRedoPresentationName() definition code for javax.swing.undo.UndoManager.getUndoOrRedoPresentationName()

public String sample code for java.lang.String definition code for java.lang.String  getUndoOrRedoPresentationName()
Return the appropriate name for a command that toggles between undo and redo. Only makes sense to use such a command if limit == 1 and we're not in progress.


getUndoPresentationName sample code for javax.swing.undo.UndoManager.getUndoPresentationName() definition code for javax.swing.undo.UndoManager.getUndoPresentationName()

public String sample code for java.lang.String definition code for java.lang.String  getUndoPresentationName()
If inProgress, returns getUndoPresentationName of the significant edit that will be undone when undo() is invoked. If there is none, returns AbstractUndoableEdit.undoText from the defaults table.

If not inProgress, acts as a CompoundEdit

Specified by:
getUndoPresentationName sample code for javax.swing.undo.UndoableEdit.getUndoPresentationName() definition code for javax.swing.undo.UndoableEdit.getUndoPresentationName() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
getUndoPresentationName sample code for javax.swing.undo.CompoundEdit.getUndoPresentationName() definition code for javax.swing.undo.CompoundEdit.getUndoPresentationName() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Returns:
the value from the defaults table with key AbstractUndoableEdit.undoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.
See Also:
undo() sample code for javax.swing.undo.UndoManager.undo() definition code for javax.swing.undo.UndoManager.undo() , CompoundEdit.getUndoPresentationName() sample code for javax.swing.undo.CompoundEdit.getUndoPresentationName() definition code for javax.swing.undo.CompoundEdit.getUndoPresentationName()

getRedoPresentationName sample code for javax.swing.undo.UndoManager.getRedoPresentationName() definition code for javax.swing.undo.UndoManager.getRedoPresentationName()

public String sample code for java.lang.String definition code for java.lang.String  getRedoPresentationName()
If inProgress, returns getRedoPresentationName of the significant edit that will be redone when redo() is invoked. If there is none, returns AbstractUndoableEdit.redoText from the defaults table.

If not inProgress, acts as a CompoundEdit

Specified by:
getRedoPresentationName sample code for javax.swing.undo.UndoableEdit.getRedoPresentationName() definition code for javax.swing.undo.UndoableEdit.getRedoPresentationName() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Overrides:
getRedoPresentationName sample code for javax.swing.undo.CompoundEdit.getRedoPresentationName() definition code for javax.swing.undo.CompoundEdit.getRedoPresentationName() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Returns:
the value from the defaults table with key AbstractUndoableEdit.redoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.
See Also:
redo() sample code for javax.swing.undo.UndoManager.redo() definition code for javax.swing.undo.UndoManager.redo() , CompoundEdit.getUndoPresentationName() sample code for javax.swing.undo.CompoundEdit.getUndoPresentationName() definition code for javax.swing.undo.CompoundEdit.getUndoPresentationName()

undoableEditHappened sample code for javax.swing.undo.UndoManager.undoableEditHappened(javax.swing.event.UndoableEditEvent) definition code for javax.swing.undo.UndoManager.undoableEditHappened(javax.swing.event.UndoableEditEvent)

public void undoableEditHappened(UndoableEditEvent sample code for javax.swing.event.UndoableEditEvent definition code for javax.swing.event.UndoableEditEvent  e)
Called by the UndoabledEdit sources this UndoManager listens to. Calls addEdit with e.getEdit().

Specified by:
undoableEditHappened sample code for javax.swing.event.UndoableEditListener.undoableEditHappened(javax.swing.event.UndoableEditEvent) definition code for javax.swing.event.UndoableEditListener.undoableEditHappened(javax.swing.event.UndoableEditEvent) in interface UndoableEditListener sample code for javax.swing.event.UndoableEditListener definition code for javax.swing.event.UndoableEditListener
See Also:
addEdit(javax.swing.undo.UndoableEdit) sample code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoManager.addEdit(javax.swing.undo.UndoableEdit)

toString sample code for javax.swing.undo.UndoManager.toString() definition code for javax.swing.undo.UndoManager.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string that displays and identifies this object's properties.

Overrides:
toString sample code for javax.swing.undo.CompoundEdit.toString() definition code for javax.swing.undo.CompoundEdit.toString() in class CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit
Returns:
a String representation of this object