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 SummaryFieldsModifier 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 SummaryConstructorsConstructorDescriptionCreates anAbstractUndoableEditwhich defaultshasBeenDoneandalivetotrue.
- 
Method SummaryModifier 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- 
UndoNameString 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:
 
- 
RedoNameString 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- 
AbstractUndoableEditpublic AbstractUndoableEdit()Creates anAbstractUndoableEditwhich defaultshasBeenDoneandalivetotrue.
 
- 
- 
Method Details- 
diepublic 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 interface- UndoableEdit
- See Also:
 
- 
undoThrowsCannotUndoExceptionifcanUndoreturnsfalse. SetshasBeenDonetofalse. Subclasses should override to undo the operation represented by this edit. Override should begin with a call to super.- Specified by:
- undoin interface- UndoableEdit
- Throws:
- CannotUndoException- if- canUndoreturns- false
- See Also:
 
- 
canUndopublic boolean canUndo()Returns true if this edit isaliveandhasBeenDoneistrue.- Specified by:
- canUndoin interface- UndoableEdit
- Returns:
- true if this edit is aliveandhasBeenDoneistrue
- See Also:
 
- 
redoThrowsCannotRedoExceptionifcanRedoreturns false. SetshasBeenDonetotrue. Subclasses should override to redo the operation represented by this edit. Override should begin with a call to super.- Specified by:
- redoin interface- UndoableEdit
- Throws:
- CannotRedoException- if- canRedoreturns- false
- See Also:
 
- 
canRedopublic boolean canRedo()Returnstrueif this edit isaliveandhasBeenDoneisfalse.- Specified by:
- canRedoin interface- UndoableEdit
- Returns:
- trueif this edit is- aliveand- hasBeenDoneis- false
- See Also:
 
- 
addEditThis default implementation returns false.- Specified by:
- addEditin interface- UndoableEdit
- Parameters:
- anEdit- the edit to be added
- Returns:
- false
- See Also:
 
- 
replaceEditThis default implementation returns false.- Specified by:
- replaceEditin interface- UndoableEdit
- Parameters:
- anEdit- the edit to replace
- Returns:
- false
- See Also:
 
- 
isSignificantpublic boolean isSignificant()This default implementation returns true.- Specified by:
- isSignificantin interface- UndoableEdit
- Returns:
- true
- See Also:
 
- 
getPresentationNameThis 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 interface- UndoableEdit
- Returns:
- the empty string ""
- See Also:
 
- 
getUndoPresentationNameRetreives 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 interface- UndoableEdit
- 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:
 
- 
getRedoPresentationNameRetreives 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 interface- UndoableEdit
- 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:
 
- 
toStringReturns a string that displays and identifies this object's properties.
 
-