java.lang.Object
javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
- All Implemented Interfaces:
Serializable,UndoableEdit
- Direct Known Subclasses:
AbstractDocument.DefaultDocumentEvent,UndoManager
A concrete subclass of AbstractUndoableEdit, used to assemble little
UndoableEdits into great big ones.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Vector<UndoableEdit> The collection ofUndoableEdits undone/redone en masse by thisCompoundEdit.Fields declared in class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEdit(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.ReturnsgetPresentationNamefrom the lastUndoableEditadded toedits.ReturnsgetRedoPresentationNamefrom the lastUndoableEditadded toedits.ReturnsgetUndoPresentationNamefrom the lastUndoableEditadded toedits.booleanReturns true if this edit is in progress--that is, it has not received end.booleanReturns 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.toString()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.AbstractUndoableEdit
replaceEdit
-
Field Details
-
edits
The collection ofUndoableEdits undone/redone en masse by thisCompoundEdit.
-
-
Constructor Details
-
CompoundEdit
public CompoundEdit()Constructs aCompoundEdit.
-
-
Method Details
-
undo
Sendsundoto all containedUndoableEditsin the reverse of the order in which they were added.- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin classAbstractUndoableEdit- Throws:
CannotUndoException- ifcanUndoreturnsfalse- See Also:
-
redo
Sendsredoto all containedUndoableEdits in the order in which they were added.- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classAbstractUndoableEdit- Throws:
CannotRedoException- ifcanRedoreturnsfalse- See Also:
-
lastEdit
Returns the lastUndoableEditinedits, ornullifeditsis empty.- Returns:
- the last
UndoableEditinedits, ornullifeditsis empty.
-
die
public void die()Sendsdieto each subedit, in the reverse of the order that they were added.- Specified by:
diein interfaceUndoableEdit- Overrides:
diein classAbstractUndoableEdit- See Also:
-
addEdit
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 interfaceUndoableEdit- Overrides:
addEditin classAbstractUndoableEdit- Parameters:
anEdit- the edit to be added- Returns:
- true if the edit is
inProgress; otherwise returns false - See Also:
-
end
public void end()SetsinProgressto false.- See Also:
-
canUndo
public boolean canUndo()Returns false ifisInProgressor if super returns false.- Specified by:
canUndoin interfaceUndoableEdit- Overrides:
canUndoin classAbstractUndoableEdit- Returns:
- true if this edit is
aliveandhasBeenDoneistrue - See Also:
-
canRedo
public boolean canRedo()Returns false ifisInProgressor if super returns false.- Specified by:
canRedoin interfaceUndoableEdit- Overrides:
canRedoin classAbstractUndoableEdit- Returns:
trueif this edit isaliveandhasBeenDoneisfalse- See Also:
-
isInProgress
public 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:
-
isSignificant
public boolean isSignificant()Returns true if any of theUndoableEdits ineditsdo. Returns false if they all return false.- Specified by:
isSignificantin interfaceUndoableEdit- Overrides:
isSignificantin classAbstractUndoableEdit- Returns:
- true
- See Also:
-
getPresentationName
ReturnsgetPresentationNamefrom the lastUndoableEditadded toedits. Ifeditsis empty, calls super.- Specified by:
getPresentationNamein interfaceUndoableEdit- Overrides:
getPresentationNamein classAbstractUndoableEdit- Returns:
- the empty string ""
- See Also:
-
getUndoPresentationName
ReturnsgetUndoPresentationNamefrom the lastUndoableEditadded toedits. Ifeditsis empty, calls super.- Specified by:
getUndoPresentationNamein interfaceUndoableEdit- Overrides:
getUndoPresentationNamein classAbstractUndoableEdit- 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:
-
getRedoPresentationName
ReturnsgetRedoPresentationNamefrom the lastUndoableEditadded toedits. Ifeditsis empty, calls super.- Specified by:
getRedoPresentationNamein interfaceUndoableEdit- Overrides:
getRedoPresentationNamein classAbstractUndoableEdit- 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:
-
toString
Returns a string that displays and identifies this object's properties.- Overrides:
toStringin classAbstractUndoableEdit- Returns:
- a String representation of this object
-