Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.undo.AbstractUndoableEdit

java.lang.Object
  |
  +--com.sun.java.swing.undo.AbstractUndoableEdit
Subclasses:
AbstractDocument.ElementEdit, CompoundEdit, StateEdit

public class AbstractUndoableEdit
extends java.lang.Object
implements UndoableEdit
An abstract implementation of UndoableEdit, implementing simple responses to all boolean methods in that interface.


Field Summary
static java.lang.String RedoName
          String returned by getRedoPresentationName()
static java.lang.String UndoName
          String returned by getUndoPresentationName()
 
Constructor Summary
AbstractUndoableEdit()
           
 
Method Summary
boolean addEdit(UndoableEdit anEdit)
          This default implementation returns false.
boolean canRedo()
          Returns true if this edit is alive and hasBeenDone is false.
boolean canUndo()
          Returns true if this edit is alive and hasBeenDone is true.
void die()
          Sets alive to false.
java.lang.String getPresentationName()
          This default implementation returns "".
java.lang.String getRedoPresentationName()
          If getPresentationName() returns "", returns AbstractUndoableEdit.
java.lang.String getUndoPresentationName()
          If getPresentationName() returns "", returns AbstractUndoableEdit.
boolean isSignificant()
          This default implementation returns true.
void redo()
          Throws CannotRedoException if canRedo() returns false.
boolean replaceEdit(UndoableEdit anEdit)
          This default implementation returns false.
java.lang.String toString()
           
void undo()
          Throws CannotUndoException if canUndo() returns false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

UndoName

protected static final java.lang.String UndoName
String returned by getUndoPresentationName()

RedoName

protected static final java.lang.String RedoName
String returned by getRedoPresentationName()
Constructor Detail

AbstractUndoableEdit

public AbstractUndoableEdit()
Method Detail

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 in interface UndoableEdit

undo

public void undo()
         throws 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 in interface UndoableEdit
See Also:
canUndo

canUndo

public boolean canUndo()
Returns true if this edit is alive and hasBeenDone is true.
Specified by:
canUndo in interface UndoableEdit
See Also:
die, undo, redo

redo

public void redo()
         throws 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 in interface UndoableEdit
See Also:
canRedo

canRedo

public boolean canRedo()
Returns true if this edit is alive and hasBeenDone is false.
Specified by:
canRedo in interface UndoableEdit
See Also:
die, undo, redo

addEdit

public boolean addEdit(UndoableEdit anEdit)
This default implementation returns false.
Specified by:
addEdit in interface UndoableEdit
See Also:
addEdit

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
This default implementation returns false.
Specified by:
replaceEdit in interface UndoableEdit
See Also:
replaceEdit

isSignificant

public boolean isSignificant()
This default implementation returns true.
Specified by:
isSignificant in interface UndoableEdit
See Also:
isSignificant

getPresentationName

public java.lang.String getPresentationName()
This default implementation returns "". Used by getUndoPresentationName() and getRedoPresentationName() to construct the strings they return. Subclasses shoul override to return an appropriate description of the operation this edit represents.
Specified by:
getPresentationName in interface UndoableEdit
See Also:
getUndoPresentationName, getRedoPresentationName

getUndoPresentationName

public java.lang.String getUndoPresentationName()
If getPresentationName() returns "", returns AbstractUndoableEdit.UndoName. Otherwise returns AbstractUndoableEdit.UndoName followed by a space and getPresentationName()
Specified by:
getUndoPresentationName in interface UndoableEdit
See Also:
getPresentationName

getRedoPresentationName

public java.lang.String getRedoPresentationName()
If getPresentationName() returns "", returns AbstractUndoableEdit.RedoName. Otherwise returns AbstractUndoableEdit.RedoName followed by a space and getPresentationName()
Specified by:
getRedoPresentationName in interface UndoableEdit
See Also:
getPresentationName

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.