APIdia Launch Partner
Top Description Fields Constructors Methods
javax.swing.undo

public Class CompoundEdit

extends AbstractUndoableEdit
Class Inheritance
Known Direct Subclasses
javax.swing.undo.UndoManager, javax.swing.text.AbstractDocument.DefaultDocumentEvent
Annotations
@SuppressWarnings:serial
Imports
java.util.*

A concrete subclass of AbstractUndoableEdit, used to assemble little UndoableEdits into great big ones.
Author
Ray Ryan

Field Summary

Modifier and TypeField and Description
protected Vector<UndoableEdit>
edits

The collection of UndoableEdits undone/redone en masse by this CompoundEdit.

pack-priv boolean
inProgress

True if this edit has never received end.

Inherited from javax.swing.undo.AbstractUndoableEdit:
alivehasBeenDoneRedoNameUndoName

Constructor Summary

AccessConstructor and Description
public
CompoundEdit()

Constructs a CompoundEdit.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the edit is inProgress; otherwise returns false
addEdit
(UndoableEdit
the edit to be added
anEdit
)

Overrides javax.swing.undo.AbstractUndoableEdit.addEdit.

Implements javax.swing.undo.UndoableEdit.addEdit.

If this edit is inProgress, accepts anEdit and returns true.

public boolean
canRedo()

Overrides javax.swing.undo.AbstractUndoableEdit.canRedo.

Implements javax.swing.undo.UndoableEdit.canRedo.

Returns false if isInProgress or if super returns false.

public boolean
canUndo()

Overrides javax.swing.undo.AbstractUndoableEdit.canUndo.

Implements javax.swing.undo.UndoableEdit.canUndo.

Returns false if isInProgress or if super returns false.

public void
die()

Overrides javax.swing.undo.AbstractUndoableEdit.die.

Implements javax.swing.undo.UndoableEdit.die.

Sends die to each subedit, in the reverse of the order that they were added.

public void
end()

Sets inProgress to false.

public String
getPresentationName()

Overrides javax.swing.undo.AbstractUndoableEdit.getPresentationName.

Implements javax.swing.undo.UndoableEdit.getPresentationName.

Returns getPresentationName from the last UndoableEdit added to edits.

public String
getRedoPresentationName()

Overrides javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName.

Implements javax.swing.undo.UndoableEdit.getRedoPresentationName.

Returns getRedoPresentationName from the last UndoableEdit added to edits.

public String
getUndoPresentationName()

Overrides javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName.

Implements javax.swing.undo.UndoableEdit.getUndoPresentationName.

Returns getUndoPresentationName from the last UndoableEdit added to edits.

public boolean

Returns:

whether this edit is in progress
isInProgress
()

Returns true if this edit is in progress--that is, it has not received end.

public boolean
isSignificant()

Overrides javax.swing.undo.AbstractUndoableEdit.isSignificant.

Implements javax.swing.undo.UndoableEdit.isSignificant.

Returns true if any of the UndoableEdits in edits do.

protected UndoableEdit

Returns:

the last UndoableEdit in edits, or null if edits is empty.
lastEdit
()

Returns the last UndoableEdit in edits, or null if edits is empty.

public void
redo()

Overrides javax.swing.undo.AbstractUndoableEdit.redo.

Implements javax.swing.undo.UndoableEdit.redo.

Sends redo to all contained UndoableEdits in the order in which they were added.

public String

Returns:

a String representation of this object
toString
()

Overrides javax.swing.undo.AbstractUndoableEdit.toString.

Returns a string that displays and identifies this object's properties.

public void
undo()

Overrides javax.swing.undo.AbstractUndoableEdit.undo.

Implements javax.swing.undo.UndoableEdit.undo.

Sends undo to all contained UndoableEdits in the reverse of the order in which they were added.

Inherited from javax.swing.undo.AbstractUndoableEdit:
replaceEdit

Field Detail

editsback to summary
protected Vector<UndoableEdit> edits

The collection of UndoableEdits undone/redone en masse by this CompoundEdit.

inProgressback to summary
pack-priv boolean inProgress

True if this edit has never received end.

Constructor Detail

CompoundEditback to summary
public CompoundEdit()

Constructs a CompoundEdit.

Method Detail

addEditback to summary
public boolean addEdit(UndoableEdit anEdit)

Overrides javax.swing.undo.AbstractUndoableEdit.addEdit.

Implements javax.swing.undo.UndoableEdit.addEdit.

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.

Parameters
anEdit:UndoableEdit

the edit to be added

Returns:boolean

true if the edit is inProgress; otherwise returns false

canRedoback to summary
public boolean canRedo()

Overrides javax.swing.undo.AbstractUndoableEdit.canRedo.

Implements javax.swing.undo.UndoableEdit.canRedo.

Returns false if isInProgress or if super returns false.

See Also
isInProgress
canUndoback to summary
public boolean canUndo()

Overrides javax.swing.undo.AbstractUndoableEdit.canUndo.

Implements javax.swing.undo.UndoableEdit.canUndo.

Returns false if isInProgress or if super returns false.

See Also
isInProgress
dieback to summary
public void die()

Overrides javax.swing.undo.AbstractUndoableEdit.die.

Implements javax.swing.undo.UndoableEdit.die.

Sends die to each subedit, in the reverse of the order that they were added.

endback to summary
public void end()

Sets inProgress to false.

See Also
canUndo, canRedo
getPresentationNameback to summary
public String getPresentationName()

Overrides javax.swing.undo.AbstractUndoableEdit.getPresentationName.

Implements javax.swing.undo.UndoableEdit.getPresentationName.

Returns getPresentationName from the last UndoableEdit added to edits. If edits is empty, calls super.

getRedoPresentationNameback to summary
public String getRedoPresentationName()

Overrides javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName.

Implements javax.swing.undo.UndoableEdit.getRedoPresentationName.

Returns getRedoPresentationName from the last UndoableEdit added to edits. If edits is empty, calls super.

getUndoPresentationNameback to summary
public String getUndoPresentationName()

Overrides javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName.

Implements javax.swing.undo.UndoableEdit.getUndoPresentationName.

Returns getUndoPresentationName from the last UndoableEdit added to edits. If edits is empty, calls super.

isInProgressback to summary
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:boolean

whether this edit is in progress

See Also
end
isSignificantback to summary
public boolean isSignificant()

Overrides javax.swing.undo.AbstractUndoableEdit.isSignificant.

Implements javax.swing.undo.UndoableEdit.isSignificant.

Returns true if any of the UndoableEdits in edits do. Returns false if they all return false.

lastEditback to summary
protected UndoableEdit lastEdit()

Returns the last UndoableEdit in edits, or null if edits is empty.

Returns:UndoableEdit

the last UndoableEdit in edits, or null if edits is empty.

redoback to summary
public void redo() throws CannotRedoException

Overrides javax.swing.undo.AbstractUndoableEdit.redo.

Implements javax.swing.undo.UndoableEdit.redo.

Sends redo to all contained UndoableEdits in the order in which they were added.

Exceptions
CannotRedoException:

Doc from javax.swing.undo.AbstractUndoableEdit.redo.

if canRedo returns false

toStringback to summary
public String toString()

Overrides javax.swing.undo.AbstractUndoableEdit.toString.

Returns a string that displays and identifies this object's properties.

Returns:String

a String representation of this object

undoback to summary
public void undo() throws CannotUndoException

Overrides javax.swing.undo.AbstractUndoableEdit.undo.

Implements javax.swing.undo.UndoableEdit.undo.

Sends undo to all contained UndoableEdits in the reverse of the order in which they were added.

Exceptions
CannotUndoException:

Doc from javax.swing.undo.AbstractUndoableEdit.undo.

if canUndo returns false