- java.lang.Object
 - 
- javax.swing.undo.AbstractUndoableEdit
 
 
- 
- All Implemented Interfaces:
 Serializable,UndoableEdit
- Direct Known Subclasses:
 AbstractDocument.ElementEdit,CompoundEdit,DefaultStyledDocument.AttributeUndoableEdit,StateEdit
public class AbstractUndoableEdit extends Object implements UndoableEdit, Serializable
An abstract implementation ofUndoableEdit, implementing simple responses to all boolean methods in that interface.- See Also:
 - Serialized Form
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected static StringRedoNameString returned bygetRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.protected static StringUndoNameString returned bygetUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. 
- 
Constructor Summary
Constructors Constructor Description AbstractUndoableEdit()Creates anAbstractUndoableEditwhich defaultshasBeenDoneandalivetotrue. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEdit(UndoableEdit anEdit)This default implementation returns false.booleancanRedo()Returnstrueif this edit isaliveandhasBeenDoneisfalse.booleancanUndo()Returns true if this edit isaliveandhasBeenDoneistrue.voiddie()Setsaliveto false.StringgetPresentationName()This default implementation returns "".StringgetRedoPresentationName()Retreives the value from the defaults table with keyAbstractUndoableEdit.redoTextand returns that value followed by a space, followed bygetPresentationName.StringgetUndoPresentationName()Retreives the value from the defaults table with keyAbstractUndoableEdit.undoTextand returns that value followed by a space, followed bygetPresentationName.booleanisSignificant()This default implementation returns true.voidredo()ThrowsCannotRedoExceptionifcanRedoreturns false.booleanreplaceEdit(UndoableEdit anEdit)This default implementation returns false.StringtoString()Returns a string that displays and identifies this object's properties.voidundo()ThrowsCannotUndoExceptionifcanUndoreturnsfalse. 
 - 
 
- 
- 
Field Detail
- 
UndoName
protected static final String UndoName
String returned bygetUndoPresentationName; 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 keyAbstractUndoableEdit.undoText.- See Also:
 UIDefaults, Constant Field Values
 
- 
RedoName
protected static final String RedoName
String returned bygetRedoPresentationName; 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 keyAbstractUndoableEdit.redoText.- See Also:
 UIDefaults, Constant Field Values
 
 - 
 
- 
Method Detail
- 
die
public void die()
Setsaliveto false. Note that this is a one way operation; dead edits cannot be resurrected. Sendingundoorredoto a dead edit results in an exception being thrown.Typically an edit is killed when it is consolidated by another edit's
addEditorreplaceEditmethod, or when it is dequeued from anUndoManager.- Specified by:
 diein interfaceUndoableEdit- See Also:
 CompoundEdit.die()
 
- 
undo
public void undo() throws CannotUndoExceptionThrowsCannotUndoExceptionifcanUndoreturnsfalse. SetshasBeenDonetofalse. Subclasses should override to undo the operation represented by this edit. Override should begin with a call to super.- Specified by:
 undoin interfaceUndoableEdit- Throws:
 CannotUndoException- ifcanUndoreturnsfalse- See Also:
 canUndo()
 
- 
canUndo
public boolean canUndo()
Returns true if this edit isaliveandhasBeenDoneistrue.- Specified by:
 canUndoin interfaceUndoableEdit- Returns:
 - true if this edit is 
aliveandhasBeenDoneistrue - See Also:
 die(),undo(),redo()
 
- 
redo
public void redo() throws CannotRedoExceptionThrowsCannotRedoExceptionifcanRedoreturns false. SetshasBeenDonetotrue. Subclasses should override to redo the operation represented by this edit. Override should begin with a call to super.- Specified by:
 redoin interfaceUndoableEdit- Throws:
 CannotRedoException- ifcanRedoreturnsfalse- See Also:
 canRedo()
 
- 
canRedo
public boolean canRedo()
Returnstrueif this edit isaliveandhasBeenDoneisfalse.- Specified by:
 canRedoin interfaceUndoableEdit- Returns:
 trueif this edit isaliveandhasBeenDoneisfalse- See Also:
 die(),undo(),redo()
 
- 
addEdit
public boolean addEdit(UndoableEdit anEdit)
This default implementation returns false.- Specified by:
 addEditin interfaceUndoableEdit- Parameters:
 anEdit- the edit to be added- Returns:
 - false
 - See Also:
 UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
 
- 
replaceEdit
public boolean replaceEdit(UndoableEdit anEdit)
This default implementation returns false.- Specified by:
 replaceEditin interfaceUndoableEdit- Parameters:
 anEdit- the edit to replace- Returns:
 - false
 - See Also:
 UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)
 
- 
isSignificant
public boolean isSignificant()
This default implementation returns true.- Specified by:
 isSignificantin interfaceUndoableEdit- Returns:
 - true
 - See Also:
 UndoableEdit.isSignificant()
 
- 
getPresentationName
public String getPresentationName()
This default implementation returns "". Used bygetUndoPresentationNameandgetRedoPresentationNameto construct the strings they return. Subclasses should override to return an appropriate description of the operation this edit represents.- Specified by:
 getPresentationNamein interfaceUndoableEdit- Returns:
 - the empty string ""
 - See Also:
 getUndoPresentationName(),getRedoPresentationName()
 
- 
getUndoPresentationName
public String getUndoPresentationName()
Retreives the value from the defaults table with keyAbstractUndoableEdit.undoTextand returns that value followed by a space, followed bygetPresentationName. IfgetPresentationNamereturns "", then the defaults value is returned alone.- Specified by:
 getUndoPresentationNamein interfaceUndoableEdit- Returns:
 - the value from the defaults table with key
    
AbstractUndoableEdit.undoText, followed by a space, followed bygetPresentationNameunlessgetPresentationNameis "" in which case, the defaults value is returned alone. - See Also:
 getPresentationName()
 
- 
getRedoPresentationName
public String getRedoPresentationName()
Retreives the value from the defaults table with keyAbstractUndoableEdit.redoTextand returns that value followed by a space, followed bygetPresentationName. IfgetPresentationNamereturns "", then the defaults value is returned alone.- Specified by:
 getRedoPresentationNamein interfaceUndoableEdit- Returns:
 - the value from the defaults table with key
    
AbstractUndoableEdit.redoText, followed by a space, followed bygetPresentationNameunlessgetPresentationNameis "" in which case, the defaults value is returned alone. - See Also:
 getPresentationName()
 
 - 
 
 -