com.raelity.jvi.swing
Class DefaultBuffer.UndoGroupManager
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
javax.swing.undo.UndoManager
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.
- Default behavior is defined by
UndoManager.
-
UnddoableEdits issued between beginUndoGroup()
and endUndoGroup() are placed into a single CompoundEdit.
Thus undo() and redo() treat them atomically.
- 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
DefaultBuffer.UndoGroupManager
public DefaultBuffer.UndoGroupManager()
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