public class

CompoundEdit

extends AbstractUndoableEdit
java.lang.Object
   ↳ javax.swing.undo.AbstractUndoableEdit
     ↳ javax.swing.undo.CompoundEdit
Known Direct Subclasses

Class Overview

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

Summary

[Expand]
Inherited Constants
From class javax.swing.undo.AbstractUndoableEdit
Fields
protected Vector<UndoableEdit> edits The collection of UndoableEdits undone/redone en masse by this CompoundEdit.
Public Constructors
CompoundEdit()
Public Methods
boolean addEdit(UndoableEdit anEdit)
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 UndoableEdits in edits do.
void redo()
Sends redo to all contained UndoableEdits 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.
Protected Methods
UndoableEdit lastEdit()
Returns the last UndoableEdit in edits, or null if edits is empty.
[Expand]
Inherited Methods
From class javax.swing.undo.AbstractUndoableEdit
From class java.lang.Object
From interface javax.swing.undo.UndoableEdit

Fields

protected Vector<UndoableEdit> edits

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

Public Constructors

public CompoundEdit ()

Public Methods

public boolean addEdit (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.

Parameters
anEdit the edit to be added
Returns
  • true if the edit is inProgress; otherwise returns false

public boolean canRedo ()

Returns false if isInProgress or if super returns false.

Returns
  • true if this edit is alive and hasBeenDone is false
See Also

public boolean canUndo ()

Returns false if isInProgress or if super returns false.

Returns
  • true if this edit is alive and hasBeenDone is true
See Also

public void 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 ()

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

Returns
  • the empty string ""

public String getRedoPresentationName ()

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

Returns
  • the value from the defaults table with key AbstractUndoableEdit.redoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.

public String getUndoPresentationName ()

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

Returns
  • the value from the defaults table with key AbstractUndoableEdit.undoText, followed by a space, followed by getPresentationName unless getPresentationName is "" in which case, the defaults value is returned alone.

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.

See Also

public boolean isSignificant ()

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

Returns
  • true

public void redo ()

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

public String toString ()

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

Returns
  • a String representation of this object

public void undo ()

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

Protected Methods

protected UndoableEdit lastEdit ()

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