com.raelity.jvi.swing
Class DefaultBuffer.UndoGroupManager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by com.raelity.jvi.swing.DefaultBuffer.UndoGroupManager
All Implemented Interfaces:
Serializable, EventListener, UndoableEditListener, UndoableEdit
Enclosing class:
DefaultBuffer

public static class DefaultBuffer.UndoGroupManager
extends UndoManager

UndoGroupManager is an UndoManager that allows explicit control of how UndoableEdits are coalesced into compound edits, rather than using the rules defined by the edits themselves. Other than the default usage, special handling is initiated by doing beginUndoGroup().

Three use cases are supported.

  1. Default behavior is defined by UndoManager.
  2. UnddoableEdits issued between beginUndoGroup() and endUndoGroup() are placed into a single CompoundEdit. Thus undo() and redo() treat them atomically.
  3. Use commitUndoGroup() to place any accumulated UndoableEdits into a CompoundEdit; the application does this at strategic points, such as EndOfLine entry or cursor movement.
Note that certain methods, such as undo(), automatically issue commitUndoGroup().

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
DefaultBuffer.UndoGroupManager()
           
 
Method Summary
 boolean addEdit(UndoableEdit anEdit)
           
 void beginUndoGroup()
           
 boolean canRedo()
           
 boolean canUndo()
           
 boolean canUndoOrRedo()
           
 void commitUndoGroup()
           
 void die()
           
 void discardAllEdits()
           
protected  UndoableEdit editToBeRedone()
           
protected  UndoableEdit editToBeUndone()
           
 void end()
           
 void endUndoGroup()
           
 String getPresentationName()
           
 String getRedoPresentationName()
           
 String getUndoOrRedoPresentationName()
           
 String getUndoPresentationName()
           
 boolean isSignificant()
           
 void redo()
           
protected  void redoTo(UndoableEdit edit)
           
 void undo()
           
 void undoOrRedo()
           
protected  void undoTo(UndoableEdit edit)
           
 
Methods inherited from class javax.swing.undo.UndoManager
getLimit, setLimit, toString, trimEdits, trimForLimit, undoableEditHappened
 
Methods inherited from class javax.swing.undo.CompoundEdit
isInProgress, lastEdit
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultBuffer.UndoGroupManager

public DefaultBuffer.UndoGroupManager()
Method Detail

beginUndoGroup

public void beginUndoGroup()

endUndoGroup

public void endUndoGroup()

commitUndoGroup

public void commitUndoGroup()

addEdit

public boolean addEdit(UndoableEdit anEdit)
Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class UndoManager

discardAllEdits

public void discardAllEdits()
Overrides:
discardAllEdits in class UndoManager

editToBeUndone

protected UndoableEdit editToBeUndone()
Overrides:
editToBeUndone in class UndoManager

editToBeRedone

protected UndoableEdit editToBeRedone()
Overrides:
editToBeRedone in class UndoManager

undoTo

protected void undoTo(UndoableEdit edit)
Overrides:
undoTo in class UndoManager

redoTo

protected void redoTo(UndoableEdit edit)
Overrides:
redoTo in class UndoManager

undoOrRedo

public void undoOrRedo()
Overrides:
undoOrRedo in class UndoManager

canUndoOrRedo

public boolean canUndoOrRedo()
Overrides:
canUndoOrRedo in class UndoManager

undo

public void undo()
Specified by:
undo in interface UndoableEdit
Overrides:
undo in class UndoManager

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class UndoManager

redo

public void redo()
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class UndoManager

canRedo

public boolean canRedo()
Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class UndoManager

end

public void end()
Overrides:
end in class UndoManager

getUndoOrRedoPresentationName

public String getUndoOrRedoPresentationName()
Overrides:
getUndoOrRedoPresentationName in class UndoManager

getUndoPresentationName

public String getUndoPresentationName()
Specified by:
getUndoPresentationName in interface UndoableEdit
Overrides:
getUndoPresentationName in class UndoManager

getRedoPresentationName

public String getRedoPresentationName()
Specified by:
getRedoPresentationName in interface UndoableEdit
Overrides:
getRedoPresentationName in class UndoManager

isSignificant

public boolean isSignificant()
Specified by:
isSignificant in interface UndoableEdit
Overrides:
isSignificant in class CompoundEdit

die

public void die()
Specified by:
die in interface UndoableEdit
Overrides:
die in class CompoundEdit

getPresentationName

public String getPresentationName()
Specified by:
getPresentationName in interface UndoableEdit
Overrides:
getPresentationName in class CompoundEdit