Serializable
, UndoableEdit
AbstractDocument.DefaultDocumentEvent
, UndoManager
public class CompoundEdit extends AbstractUndoableEdit
Modifier and Type | Field | Description |
---|---|---|
protected Vector |
edits |
The collection of UndoableEdit s undone/redone en masse by this CompoundEdit . |
RedoName, UndoName
Constructor | Description |
---|---|
CompoundEdit() |
Constructs a CompoundEdit . |
Modifier and Type | Method | Description |
---|---|---|
boolean |
addEdit |
If this edit is inProgress , accepts anEdit and returns true. |
boolean |
canRedo() |
Returns false if isInProgress or if super returns false. |
boolean |
canUndo() |
Returns false if isInProgress or if super returns false. |
void |
die() |
Sends die to each subedit, in the reverse of the order that they were added. |
void |
end() |
Sets inProgress to false. |
String |
getPresentationName() |
Returns getPresentationName from the last UndoableEdit added to edits . |
String |
getRedoPresentationName() |
Returns getRedoPresentationName from the last UndoableEdit added to edits . |
String |
getUndoPresentationName() |
Returns getUndoPresentationName from the last UndoableEdit added to edits . |
boolean |
isInProgress() |
Returns true if this edit is in progress--that is, it has not received end. |
boolean |
isSignificant() |
Returns true if any of the UndoableEdit s in edits do. |
protected UndoableEdit |
lastEdit() |
Returns the last UndoableEdit in edits , or null if edits is empty. |
void |
redo() |
Sends redo to all contained UndoableEdit s in the order in which they were added. |
String |
toString() |
Returns a string that displays and identifies this object's properties. |
void |
undo() |
Sends undo to all contained UndoableEdits in the reverse of the order in which they were added. |
replaceEdit
protected Vector<UndoableEdit> edits
UndoableEdit
s undone/redone en masse by this CompoundEdit
.public CompoundEdit()
CompoundEdit
.public void undo() throws CannotUndoException
undo
to all contained UndoableEdits
in the reverse of the order in which they were added.undo
in interface UndoableEdit
undo
in class AbstractUndoableEdit
CannotUndoException
- if canUndo
returns false
public void redo() throws CannotRedoException
redo
to all contained UndoableEdit
s in the order in which they were added.redo
in interface UndoableEdit
redo
in class AbstractUndoableEdit
CannotRedoException
- if canRedo
returns false
protected UndoableEdit lastEdit()
UndoableEdit
in edits
, or null
if edits
is empty.UndoableEdit
in edits
, or null
if edits
is empty.public void die()
die
to each subedit, in the reverse of the order that they were added.die
in interface UndoableEdit
die
in class AbstractUndoableEdit
public boolean addEdit(UndoableEdit anEdit)
inProgress
, accepts anEdit
and returns true. The last edit added to this CompoundEdit
is given a chance to addEdit(anEdit)
. If it refuses (returns false), anEdit
is given a chance to replaceEdit
the last edit. If anEdit
returns false here, it is added to edits
.
addEdit
in interface UndoableEdit
addEdit
in class AbstractUndoableEdit
anEdit
- the edit to be addedinProgress
; otherwise returns falsepublic void end()
inProgress
to false.public boolean canUndo()
isInProgress
or if super returns false.canUndo
in interface UndoableEdit
canUndo
in class AbstractUndoableEdit
alive
and hasBeenDone
is true
public boolean canRedo()
isInProgress
or if super returns false.canRedo
in interface UndoableEdit
canRedo
in class AbstractUndoableEdit
true
if this edit is alive
and hasBeenDone
is false
public boolean isInProgress()
public boolean isSignificant()
UndoableEdit
s in edits
do. Returns false if they all return false.isSignificant
in interface UndoableEdit
isSignificant
in class AbstractUndoableEdit
public String getPresentationName()
getPresentationName
from the last UndoableEdit
added to edits
. If edits
is empty, calls super.getPresentationName
in interface UndoableEdit
getPresentationName
in class AbstractUndoableEdit
public String getUndoPresentationName()
getUndoPresentationName
from the last UndoableEdit
added to edits
. If edits
is empty, calls super.getUndoPresentationName
in interface UndoableEdit
getUndoPresentationName
in class AbstractUndoableEdit
AbstractUndoableEdit.undoText
, followed by a space, followed by getPresentationName
unless getPresentationName
is "" in which case, the defaults value is returned alone.public String getRedoPresentationName()
getRedoPresentationName
from the last UndoableEdit
added to edits
. If edits
is empty, calls super.getRedoPresentationName
in interface UndoableEdit
getRedoPresentationName
in class AbstractUndoableEdit
AbstractUndoableEdit.redoText
, followed by a space, followed by getPresentationName
unless getPresentationName
is "" in which case, the defaults value is returned alone.public String toString()
toString
in class AbstractUndoableEdit
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/undo/CompoundEdit.html