- java.lang.Object
- 
- javax.swing.undo.AbstractUndoableEdit
- 
- javax.swing.undo.CompoundEdit
 
 
- 
- All Implemented Interfaces:
- Serializable,- UndoableEdit
 - Direct Known Subclasses:
- AbstractDocument.DefaultDocumentEvent,- UndoManager
 
 public class CompoundEdit extends AbstractUndoableEdit A concrete subclass of AbstractUndoableEdit, used to assemble little UndoableEdits into great big ones.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected Vector<UndoableEdit>editsThe collection ofUndoableEdits undone/redone en masse by thisCompoundEdit.- 
Fields declared in class javax.swing.undo.AbstractUndoableEditRedoName, UndoName
 
- 
 - 
Constructor SummaryConstructors Constructor Description CompoundEdit()Constructs aCompoundEdit.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEdit(UndoableEdit anEdit)If this edit isinProgress, acceptsanEditand returns true.booleancanRedo()Returns false ifisInProgressor if super returns false.booleancanUndo()Returns false ifisInProgressor if super returns false.voiddie()Sendsdieto each subedit, in the reverse of the order that they were added.voidend()SetsinProgressto false.StringgetPresentationName()ReturnsgetPresentationNamefrom the lastUndoableEditadded toedits.StringgetRedoPresentationName()ReturnsgetRedoPresentationNamefrom the lastUndoableEditadded toedits.StringgetUndoPresentationName()ReturnsgetUndoPresentationNamefrom the lastUndoableEditadded toedits.booleanisInProgress()Returns true if this edit is in progress--that is, it has not received end.booleanisSignificant()Returns true if any of theUndoableEdits ineditsdo.protected UndoableEditlastEdit()Returns the lastUndoableEditinedits, ornullifeditsis empty.voidredo()Sendsredoto all containedUndoableEdits in the order in which they were added.StringtoString()Returns a string that displays and identifies this object's properties.voidundo()Sendsundoto all containedUndoableEditsin the reverse of the order in which they were added.- 
Methods declared in class javax.swing.undo.AbstractUndoableEditreplaceEdit
 
- 
 
- 
- 
- 
Field Detail- 
editsprotected Vector<UndoableEdit> edits The collection ofUndoableEdits undone/redone en masse by thisCompoundEdit.
 
- 
 - 
Method Detail- 
undopublic void undo() throws CannotUndoExceptionSendsundoto all containedUndoableEditsin the reverse of the order in which they were added.- Specified by:
- undoin interface- UndoableEdit
- Overrides:
- undoin class- AbstractUndoableEdit
- Throws:
- CannotUndoException- if- canUndoreturns- false
- See Also:
- AbstractUndoableEdit.canUndo()
 
 - 
redopublic void redo() throws CannotRedoExceptionSendsredoto all containedUndoableEdits in the order in which they were added.- Specified by:
- redoin interface- UndoableEdit
- Overrides:
- redoin class- AbstractUndoableEdit
- Throws:
- CannotRedoException- if- canRedoreturns- false
- See Also:
- AbstractUndoableEdit.canRedo()
 
 - 
lastEditprotected UndoableEdit lastEdit() Returns the lastUndoableEditinedits, ornullifeditsis empty.- Returns:
- the last UndoableEditinedits, ornullifeditsis empty.
 
 - 
diepublic void die() Sendsdieto each subedit, in the reverse of the order that they were added.- Specified by:
- diein interface- UndoableEdit
- Overrides:
- diein class- AbstractUndoableEdit
- See Also:
- die()
 
 - 
addEditpublic boolean addEdit(UndoableEdit anEdit) If this edit isinProgress, acceptsanEditand returns true.The last edit added to this CompoundEditis given a chance toaddEdit(anEdit). If it refuses (returns false),anEditis given a chance toreplaceEditthe last edit. IfanEditreturns false here, it is added toedits.- Specified by:
- addEditin interface- UndoableEdit
- Overrides:
- addEditin class- AbstractUndoableEdit
- Parameters:
- anEdit- the edit to be added
- Returns:
- true if the edit is inProgress; otherwise returns false
- See Also:
- UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
 
 - 
canUndopublic boolean canUndo() Returns false ifisInProgressor if super returns false.- Specified by:
- canUndoin interface- UndoableEdit
- Overrides:
- canUndoin class- AbstractUndoableEdit
- Returns:
- true if this edit is aliveandhasBeenDoneistrue
- See Also:
- isInProgress()
 
 - 
canRedopublic boolean canRedo() Returns false ifisInProgressor if super returns false.- Specified by:
- canRedoin interface- UndoableEdit
- Overrides:
- canRedoin class- AbstractUndoableEdit
- Returns:
- trueif this edit is- aliveand- hasBeenDoneis- false
- See Also:
- isInProgress()
 
 - 
isInProgresspublic boolean isInProgress() Returns true if this edit is in progress--that is, it has not received end. This generally means that edits are still being added to it.- Returns:
- whether this edit is in progress
- See Also:
- end()
 
 - 
isSignificantpublic boolean isSignificant() Returns true if any of theUndoableEdits ineditsdo. Returns false if they all return false.- Specified by:
- isSignificantin interface- UndoableEdit
- Overrides:
- isSignificantin class- AbstractUndoableEdit
- Returns:
- true
- See Also:
- UndoableEdit.isSignificant()
 
 - 
getPresentationNamepublic String getPresentationName() ReturnsgetPresentationNamefrom the lastUndoableEditadded toedits. Ifeditsis empty, calls super.- Specified by:
- getPresentationNamein interface- UndoableEdit
- Overrides:
- getPresentationNamein class- AbstractUndoableEdit
- Returns:
- the empty string ""
- See Also:
- AbstractUndoableEdit.getUndoPresentationName(),- AbstractUndoableEdit.getRedoPresentationName()
 
 - 
getUndoPresentationNamepublic String getUndoPresentationName() ReturnsgetUndoPresentationNamefrom the lastUndoableEditadded toedits. Ifeditsis empty, calls super.- Specified by:
- getUndoPresentationNamein interface- UndoableEdit
- Overrides:
- getUndoPresentationNamein class- AbstractUndoableEdit
- Returns:
- the value from the defaults table with key
    AbstractUndoableEdit.undoText, followed by a space, followed bygetPresentationNameunlessgetPresentationNameis "" in which case, the defaults value is returned alone.
- See Also:
- AbstractUndoableEdit.getPresentationName()
 
 - 
getRedoPresentationNamepublic String getRedoPresentationName() ReturnsgetRedoPresentationNamefrom the lastUndoableEditadded toedits. Ifeditsis empty, calls super.- Specified by:
- getRedoPresentationNamein interface- UndoableEdit
- Overrides:
- getRedoPresentationNamein class- AbstractUndoableEdit
- Returns:
- the value from the defaults table with key
    AbstractUndoableEdit.redoText, followed by a space, followed bygetPresentationNameunlessgetPresentationNameis "" in which case, the defaults value is returned alone.
- See Also:
- AbstractUndoableEdit.getPresentationName()
 
 - 
toStringpublic String toString() Returns a string that displays and identifies this object's properties.- Overrides:
- toStringin class- AbstractUndoableEdit
- Returns:
- a String representation of this object
 
 
- 
 
-