- 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 SummaryFields 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 SummaryConstructors Constructor Description AbstractUndoableEdit()Creates anAbstractUndoableEditwhich defaultshasBeenDoneandalivetotrue.
 - 
Method SummaryAll 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- 
UndoNameprotected 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
 
 - 
RedoNameprotected 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- 
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:
- CompoundEdit.die()
 
 - 
undopublic 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 interface- UndoableEdit
- Throws:
- CannotUndoException- if- canUndoreturns- false
- See Also:
- canUndo()
 
 - 
canUndopublic boolean canUndo() Returns true if this edit isaliveandhasBeenDoneistrue.- Specified by:
- canUndoin interface- UndoableEdit
- Returns:
- true if this edit is aliveandhasBeenDoneistrue
- See Also:
- die(),- undo(),- redo()
 
 - 
redopublic 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 interface- UndoableEdit
- Throws:
- CannotRedoException- if- canRedoreturns- false
- See Also:
- canRedo()
 
 - 
canRedopublic boolean canRedo() Returnstrueif this edit isaliveandhasBeenDoneisfalse.- Specified by:
- canRedoin interface- UndoableEdit
- Returns:
- trueif this edit is- aliveand- hasBeenDoneis- false
- See Also:
- die(),- undo(),- redo()
 
 - 
addEditpublic boolean addEdit(UndoableEdit anEdit) This default implementation returns false.- Specified by:
- addEditin interface- UndoableEdit
- Parameters:
- anEdit- the edit to be added
- Returns:
- false
- See Also:
- UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
 
 - 
replaceEditpublic boolean replaceEdit(UndoableEdit anEdit) This default implementation returns false.- Specified by:
- replaceEditin interface- UndoableEdit
- Parameters:
- anEdit- the edit to replace
- Returns:
- false
- See Also:
- UndoableEdit.replaceEdit(javax.swing.undo.UndoableEdit)
 
 - 
isSignificantpublic boolean isSignificant() This default implementation returns true.- Specified by:
- isSignificantin interface- UndoableEdit
- Returns:
- true
- See Also:
- UndoableEdit.isSignificant()
 
 - 
getPresentationNamepublic 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 interface- UndoableEdit
- Returns:
- the empty string ""
- See Also:
- getUndoPresentationName(),- getRedoPresentationName()
 
 - 
getUndoPresentationNamepublic 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 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:
- getPresentationName()
 
 - 
getRedoPresentationNamepublic 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 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:
- getPresentationName()
 
 
- 
 
-