java.lang.Object
javax.swing.undo.AbstractUndoableEdit
- All Implemented Interfaces:
 Serializable,UndoableEdit
- Direct Known Subclasses:
 AbstractDocument.ElementEdit,CompoundEdit,DefaultStyledDocument.AttributeUndoableEdit,StateEdit
An abstract implementation of 
UndoableEdit,
 implementing simple responses to all boolean methods in
 that interface.- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringString returned bygetRedoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used.protected static final StringString returned bygetUndoPresentationName; as of Java 2 platform v1.3.1 this field is no longer used. - 
Constructor Summary
ConstructorsConstructorDescriptionCreates anAbstractUndoableEditwhich defaultshasBeenDoneandalivetotrue. - 
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEdit(UndoableEdit anEdit) This default implementation returns false.booleancanRedo()Returnstrueif this edit isaliveandhasBeenDoneisfalse.booleancanUndo()Returns true if this edit isaliveandhasBeenDoneistrue.voiddie()Setsaliveto false.This default implementation returns "".Retreives the value from the defaults table with keyAbstractUndoableEdit.redoTextand returns that value followed by a space, followed bygetPresentationName.Retreives the value from the defaults table with keyAbstractUndoableEdit.undoTextand returns that value followed by a space, followed bygetPresentationName.booleanThis default implementation returns true.voidredo()ThrowsCannotRedoExceptionifcanRedoreturns false.booleanreplaceEdit(UndoableEdit anEdit) This default implementation returns false.toString()Returns a string that displays and identifies this object's properties.voidundo()ThrowsCannotUndoExceptionifcanUndoreturnsfalse. 
- 
Field Details
- 
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:
 
 - 
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:
 
 
 - 
 - 
Constructor Details
- 
AbstractUndoableEdit
public AbstractUndoableEdit()Creates anAbstractUndoableEditwhich defaultshasBeenDoneandalivetotrue. 
 - 
 - 
Method Details
- 
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:
 
 - 
undo
ThrowsCannotUndoExceptionifcanUndoreturnsfalse. 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
public boolean canUndo()Returns true if this edit isaliveandhasBeenDoneistrue.- Specified by:
 canUndoin interfaceUndoableEdit- Returns:
 - true if this edit is 
aliveandhasBeenDoneistrue - See Also:
 
 - 
redo
ThrowsCannotRedoExceptionifcanRedoreturns 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
public boolean canRedo()Returnstrueif this edit isaliveandhasBeenDoneisfalse.- Specified by:
 canRedoin interfaceUndoableEdit- Returns:
 trueif this edit isaliveandhasBeenDoneisfalse- See Also:
 
 - 
addEdit
This default implementation returns false.- Specified by:
 addEditin interfaceUndoableEdit- Parameters:
 anEdit- the edit to be added- Returns:
 - false
 - See Also:
 
 - 
replaceEdit
This default implementation returns false.- Specified by:
 replaceEditin interfaceUndoableEdit- Parameters:
 anEdit- the edit to replace- Returns:
 - false
 - See Also:
 
 - 
isSignificant
public boolean isSignificant()This default implementation returns true.- Specified by:
 isSignificantin interfaceUndoableEdit- Returns:
 - true
 - See Also:
 
 - 
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
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:
 
 - 
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:
 
 - 
toString
Returns a string that displays and identifies this object's properties. 
 -