javax.swing.undo
Class AbstractUndoableEdit

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.undo.AbstractUndoableEdit
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Direct Known Subclasses:
AbstractDocument.ElementEdit sample code for javax.swing.text.AbstractDocument.ElementEdit definition code for javax.swing.text.AbstractDocument.ElementEdit , CompoundEdit sample code for javax.swing.undo.CompoundEdit definition code for javax.swing.undo.CompoundEdit , DefaultStyledDocument.AttributeUndoableEdit sample code for javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit definition code for javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit , StateEdit sample code for javax.swing.undo.StateEdit definition code for javax.swing.undo.StateEdit

public class AbstractUndoableEdit
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit , Serializable sample code for java.io.Serializable definition code for java.io.Serializable

An abstract implementation of UndoableEdit, implementing simple responses to all boolean methods in that interface.

See Also:
Serialized Form

Field Summary
protected static String sample code for java.lang.String definition code for java.lang.String RedoName sample code for javax.swing.undo.AbstractUndoableEdit.RedoName definition code for javax.swing.undo.AbstractUndoableEdit.RedoName
          String returned by getRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.
protected static String sample code for java.lang.String definition code for java.lang.String UndoName sample code for javax.swing.undo.AbstractUndoableEdit.UndoName definition code for javax.swing.undo.AbstractUndoableEdit.UndoName
          String returned by getUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.
 
Constructor Summary
AbstractUndoableEdit sample code for javax.swing.undo.AbstractUndoableEdit.AbstractUndoableEdit() definition code for javax.swing.undo.AbstractUndoableEdit.AbstractUndoableEdit() ()
          Creates an AbstractUndoableEdit which defaults and alive to true.
 
Method Summary
 boolean addEdit sample code for javax.swing.undo.AbstractUndoableEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.AbstractUndoableEdit.addEdit(javax.swing.undo.UndoableEdit) (UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  anEdit)
          This default implementation returns false.
 boolean canRedo sample code for javax.swing.undo.AbstractUndoableEdit.canRedo() definition code for javax.swing.undo.AbstractUndoableEdit.canRedo() ()
          Returns true if this edit is alive and hasBeenDone is false.
 boolean canUndo sample code for javax.swing.undo.AbstractUndoableEdit.canUndo() definition code for javax.swing.undo.AbstractUndoableEdit.canUndo() ()
          Returns true if this edit is alive and hasBeenDone is true.
 void die sample code for javax.swing.undo.AbstractUndoableEdit.die() definition code for javax.swing.undo.AbstractUndoableEdit.die() ()
          Sets alive to false.
 String sample code for java.lang.String definition code for java.lang.String getPresentationName sample code for javax.swing.undo.AbstractUndoableEdit.getPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getPresentationName() ()
          This default implementation returns "".
 String sample code for java.lang.String definition code for java.lang.String getRedoPresentationName sample code for javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName() ()
          Retreives the value from the defaults table with key AbstractUndoableEdit.redoText and returns that value followed by a space, followed by getPresentationName.
 String sample code for java.lang.String definition code for java.lang.String getUndoPresentationName sample code for javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName() ()
          Retreives the value from the defaults table with key AbstractUndoableEdit.undoText and returns that value followed by a space, followed by getPresentationName.
 boolean isSignificant sample code for javax.swing.undo.AbstractUndoableEdit.isSignificant() definition code for javax.swing.undo.AbstractUndoableEdit.isSignificant() ()
          This default implementation returns true.
 void redo sample code for javax.swing.undo.AbstractUndoableEdit.redo() definition code for javax.swing.undo.AbstractUndoableEdit.redo() ()
          Throws CannotRedoException if canRedo returns false.
 boolean replaceEdit sample code for javax.swing.undo.AbstractUndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.AbstractUndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) (UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  anEdit)
          This default implementation returns false.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.swing.undo.AbstractUndoableEdit.toString() definition code for javax.swing.undo.AbstractUndoableEdit.toString() ()
          Returns a string that displays and identifies this object's properties.
 void undo sample code for javax.swing.undo.AbstractUndoableEdit.undo() definition code for javax.swing.undo.AbstractUndoableEdit.undo() ()
          Throws CannotUndoException if canUndo returns false.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

UndoName sample code for javax.swing.undo.AbstractUndoableEdit.UndoName

protected static final String sample code for java.lang.String definition code for java.lang.String  UndoName
String returned by getUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. This value is now localized and comes from the defaults table with key AbstractUndoableEdit.undoText.

See Also:
UIDefaults sample code for javax.swing.UIDefaults definition code for javax.swing.UIDefaults , Constant Field Values

RedoName sample code for javax.swing.undo.AbstractUndoableEdit.RedoName

protected static final String sample code for java.lang.String definition code for java.lang.String  RedoName
String returned by getRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. This value is now localized and comes from the defaults table with key AbstractUndoableEdit.redoText.

See Also:
UIDefaults sample code for javax.swing.UIDefaults definition code for javax.swing.UIDefaults , Constant Field Values
Constructor Detail

AbstractUndoableEdit sample code for javax.swing.undo.AbstractUndoableEdit() definition code for javax.swing.undo.AbstractUndoableEdit()

public AbstractUndoableEdit()
Creates an AbstractUndoableEdit which defaults and alive to true.

Method Detail

die sample code for javax.swing.undo.AbstractUndoableEdit.die() definition code for javax.swing.undo.AbstractUndoableEdit.die()

public void die()
Sets alive to false. Note that this is a one way operation; dead edits cannot be resurrected. Sending undo or redo to a dead edit results in an exception being thrown.

Typically an edit is killed when it is consolidated by another edit's addEdit or replaceEdit method, or when it is dequeued from an UndoManager.

Specified by:
die sample code for javax.swing.undo.UndoableEdit.die() definition code for javax.swing.undo.UndoableEdit.die() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
See Also:
CompoundEdit.die() sample code for javax.swing.undo.CompoundEdit.die() definition code for javax.swing.undo.CompoundEdit.die()

undo sample code for javax.swing.undo.AbstractUndoableEdit.undo() definition code for javax.swing.undo.AbstractUndoableEdit.undo()

public void undo()
          throws CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException 
Throws CannotUndoException if canUndo returns false. Sets hasBeenDone to false. Subclasses should override to undo the operation represented by this edit. Override should begin with a call to super.

Specified by:
undo sample code for javax.swing.undo.UndoableEdit.undo() definition code for javax.swing.undo.UndoableEdit.undo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Throws:
CannotUndoException sample code for javax.swing.undo.CannotUndoException definition code for javax.swing.undo.CannotUndoException - if canUndo returns false
See Also:
canUndo() sample code for javax.swing.undo.AbstractUndoableEdit.canUndo() definition code for javax.swing.undo.AbstractUndoableEdit.canUndo()

canUndo sample code for javax.swing.undo.AbstractUndoableEdit.canUndo() definition code for javax.swing.undo.AbstractUndoableEdit.canUndo()

public boolean canUndo()
Returns true if this edit is alive and hasBeenDone is true.

Specified by:
canUndo sample code for javax.swing.undo.UndoableEdit.canUndo() definition code for javax.swing.undo.UndoableEdit.canUndo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Returns:
true if this edit is alive and hasBeenDone is true
See Also:
die() sample code for javax.swing.undo.AbstractUndoableEdit.die() definition code for javax.swing.undo.AbstractUndoableEdit.die() , undo() sample code for javax.swing.undo.AbstractUndoableEdit.undo() definition code for javax.swing.undo.AbstractUndoableEdit.undo() , redo() sample code for javax.swing.undo.AbstractUndoableEdit.redo() definition code for javax.swing.undo.AbstractUndoableEdit.redo()

redo sample code for javax.swing.undo.AbstractUndoableEdit.redo() definition code for javax.swing.undo.AbstractUndoableEdit.redo()

public void redo()
          throws CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException 
Throws CannotRedoException if canRedo returns false. Sets hasBeenDone to true. Subclasses should override to redo the operation represented by this edit. Override should begin with a call to super.

Specified by:
redo sample code for javax.swing.undo.UndoableEdit.redo() definition code for javax.swing.undo.UndoableEdit.redo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Throws:
CannotRedoException sample code for javax.swing.undo.CannotRedoException definition code for javax.swing.undo.CannotRedoException - if canRedo returns false
See Also:
canRedo() sample code for javax.swing.undo.AbstractUndoableEdit.canRedo() definition code for javax.swing.undo.AbstractUndoableEdit.canRedo()

canRedo sample code for javax.swing.undo.AbstractUndoableEdit.canRedo() definition code for javax.swing.undo.AbstractUndoableEdit.canRedo()

public boolean canRedo()
Returns true if this edit is alive and hasBeenDone is false.

Specified by:
canRedo sample code for javax.swing.undo.UndoableEdit.canRedo() definition code for javax.swing.undo.UndoableEdit.canRedo() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Returns:
true if this edit is alive and hasBeenDone is false
See Also:
die() sample code for javax.swing.undo.AbstractUndoableEdit.die() definition code for javax.swing.undo.AbstractUndoableEdit.die() , undo() sample code for javax.swing.undo.AbstractUndoableEdit.undo() definition code for javax.swing.undo.AbstractUndoableEdit.undo() , redo() sample code for javax.swing.undo.AbstractUndoableEdit.redo() definition code for javax.swing.undo.AbstractUndoableEdit.redo()

addEdit sample code for javax.swing.undo.AbstractUndoableEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.AbstractUndoableEdit.addEdit(javax.swing.undo.UndoableEdit)

public boolean addEdit(UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  anEdit)
This default implementation returns false.

Specified by:
addEdit sample code for javax.swing.undo.UndoableEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoableEdit.addEdit(javax.swing.undo.UndoableEdit) in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Parameters:
anEdit - the edit to be added
Returns:
false
See Also:
UndoableEdit.addEdit(javax.swing.undo.UndoableEdit) sample code for javax.swing.undo.UndoableEdit.addEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)

replaceEdit sample code for javax.swing.undo.AbstractUndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.AbstractUndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)

public boolean replaceEdit(UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit  anEdit)
This default implementation returns false.

Specified by:
replaceEdit sample code for javax.swing.undo.UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Parameters:
anEdit - the edit to replace
Returns:
false
See Also:
UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) sample code for javax.swing.undo.UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit) definition code for javax.swing.undo.UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)

isSignificant sample code for javax.swing.undo.AbstractUndoableEdit.isSignificant() definition code for javax.swing.undo.AbstractUndoableEdit.isSignificant()

public boolean isSignificant()
This default implementation returns true.

Specified by:
isSignificant sample code for javax.swing.undo.UndoableEdit.isSignificant() definition code for javax.swing.undo.UndoableEdit.isSignificant() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Returns:
true
See Also:
UndoableEdit.isSignificant() sample code for javax.swing.undo.UndoableEdit.isSignificant() definition code for javax.swing.undo.UndoableEdit.isSignificant()

getPresentationName sample code for javax.swing.undo.AbstractUndoableEdit.getPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getPresentationName()

public String sample code for java.lang.String definition code for java.lang.String  getPresentationName()
This default implementation returns "". Used by getUndoPresentationName and getRedoPresentationName to construct the strings they return. Subclasses should override to return an appropriate description of the operation this edit represents.

Specified by:
getPresentationName sample code for javax.swing.undo.UndoableEdit.getPresentationName() definition code for javax.swing.undo.UndoableEdit.getPresentationName() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
Returns:
the empty string ""
See Also:
getUndoPresentationName() sample code for javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName() , getRedoPresentationName() sample code for javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName()

getUndoPresentationName sample code for javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getUndoPresentationName()

public String sample code for java.lang.String definition code for java.lang.String  getUndoPresentationName()
Retreives the value from the defaults table with key AbstractUndoableEdit.undoText and returns that value followed by a space, followed by getPresentationName. If getPresentationName returns "", then the defaults value is returned alone.

Specified by:
getUndoPresentationName sample code for javax.swing.undo.UndoableEdit.getUndoPresentationName() definition code for javax.swing.undo.UndoableEdit.getUndoPresentationName() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
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.
See Also:
getPresentationName() sample code for javax.swing.undo.AbstractUndoableEdit.getPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getPresentationName()

getRedoPresentationName sample code for javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getRedoPresentationName()

public String sample code for java.lang.String definition code for java.lang.String  getRedoPresentationName()
Retreives the value from the defaults table with key AbstractUndoableEdit.redoText and returns that value followed by a space, followed by getPresentationName. If getPresentationName returns "", then the defaults value is returned alone.

Specified by:
getRedoPresentationName sample code for javax.swing.undo.UndoableEdit.getRedoPresentationName() definition code for javax.swing.undo.UndoableEdit.getRedoPresentationName() in interface UndoableEdit sample code for javax.swing.undo.UndoableEdit definition code for javax.swing.undo.UndoableEdit
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.
See Also:
getPresentationName() sample code for javax.swing.undo.AbstractUndoableEdit.getPresentationName() definition code for javax.swing.undo.AbstractUndoableEdit.getPresentationName()

toString sample code for javax.swing.undo.AbstractUndoableEdit.toString() definition code for javax.swing.undo.AbstractUndoableEdit.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string that displays and identifies this object's properties.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a String representation of this object