Methods Summary |
---|
public boolean | addEdit(javax.swing.undo.UndoableEdit anEdit)If this edit is 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 .
if (!inProgress) {
return false;
} else {
UndoableEdit last = lastEdit();
// If this is the first subedit received, just add it.
// Otherwise, give the last one a chance to absorb the new
// one. If it won't, give the new one a chance to absorb
// the last one.
if (last == null) {
edits.addElement(anEdit);
}
else if (!last.addEdit(anEdit)) {
if (anEdit.replaceEdit(last)) {
edits.removeElementAt(edits.size()-1);
}
edits.addElement(anEdit);
}
return true;
}
|
public boolean | canRedo()Returns false if isInProgress or if super
returns false.
return !isInProgress() && super.canRedo();
|
public boolean | canUndo()Returns false if isInProgress or if super
returns false.
return !isInProgress() && super.canUndo();
|
public void | die()Sends die to each subedit,
in the reverse of the order that they were added.
int size = edits.size();
for (int i = size-1; i >= 0; i--)
{
UndoableEdit e = (UndoableEdit)edits.elementAt(i);
// System.out.println("CompoundEdit(" + i + "): Discarding " +
// e.getUndoPresentationName());
e.die();
}
super.die();
|
public void | end()Sets inProgress to false.
inProgress = false;
|
public java.lang.String | getPresentationName()Returns getPresentationName from the
last UndoableEdit added to
edits . If edits is empty,
calls super.
UndoableEdit last = lastEdit();
if (last != null) {
return last.getPresentationName();
} else {
return super.getPresentationName();
}
|
public java.lang.String | getRedoPresentationName()Returns getRedoPresentationName
from the last UndoableEdit
added to edits .
If edits is empty, calls super.
UndoableEdit last = lastEdit();
if (last != null) {
return last.getRedoPresentationName();
} else {
return super.getRedoPresentationName();
}
|
public java.lang.String | getUndoPresentationName()Returns getUndoPresentationName
from the last UndoableEdit
added to edits .
If edits is empty, calls super.
UndoableEdit last = lastEdit();
if (last != null) {
return last.getUndoPresentationName();
} else {
return super.getUndoPresentationName();
}
|
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.
return inProgress;
|
public boolean | isSignificant()Returns true if any of the UndoableEdit s
in edits do.
Returns false if they all return false.
Enumeration cursor = edits.elements();
while (cursor.hasMoreElements()) {
if (((UndoableEdit)cursor.nextElement()).isSignificant()) {
return true;
}
}
return false;
|
protected javax.swing.undo.UndoableEdit | lastEdit()Returns the last UndoableEdit in
edits , or null
if edits is empty.
int count = edits.size();
if (count > 0)
return (UndoableEdit)edits.elementAt(count-1);
else
return null;
|
public void | redo()Sends redo to all contained
UndoableEdit s in the order in
which they were added.
super.redo();
Enumeration cursor = edits.elements();
while (cursor.hasMoreElements()) {
((UndoableEdit)cursor.nextElement()).redo();
}
|
public java.lang.String | toString()Returns a string that displays and identifies this
object's properties.
return super.toString()
+ " inProgress: " + inProgress
+ " edits: " + edits;
|
public void | undo()Sends undo to all contained
UndoableEdits in the reverse of
the order in which they were added.
super.undo();
int i = edits.size();
while (i-- > 0) {
UndoableEdit e = (UndoableEdit)edits.elementAt(i);
e.undo();
}
|