home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / undo / AbstractUndoableEdit.class (.txt) next >
Encoding:
Java Class File  |  1979-12-31  |  1.5 KB  |  81 lines

  1. package javax.swing.undo;
  2.  
  3. import java.io.Serializable;
  4.  
  5. public class AbstractUndoableEdit implements UndoableEdit, Serializable {
  6.    protected static final String UndoName = "Undo";
  7.    protected static final String RedoName = "Redo";
  8.    boolean hasBeenDone = true;
  9.    boolean alive = true;
  10.  
  11.    public void die() {
  12.       this.alive = false;
  13.    }
  14.  
  15.    public void undo() throws CannotUndoException {
  16.       if (!this.canUndo()) {
  17.          throw new CannotUndoException();
  18.       } else {
  19.          this.hasBeenDone = false;
  20.       }
  21.    }
  22.  
  23.    public boolean canUndo() {
  24.       return this.alive && this.hasBeenDone;
  25.    }
  26.  
  27.    public void redo() throws CannotRedoException {
  28.       if (!this.canRedo()) {
  29.          throw new CannotRedoException();
  30.       } else {
  31.          this.hasBeenDone = true;
  32.       }
  33.    }
  34.  
  35.    public boolean canRedo() {
  36.       return this.alive && !this.hasBeenDone;
  37.    }
  38.  
  39.    public boolean addEdit(UndoableEdit var1) {
  40.       return false;
  41.    }
  42.  
  43.    public boolean replaceEdit(UndoableEdit var1) {
  44.       return false;
  45.    }
  46.  
  47.    public boolean isSignificant() {
  48.       return true;
  49.    }
  50.  
  51.    public String getPresentationName() {
  52.       return "";
  53.    }
  54.  
  55.    public String getUndoPresentationName() {
  56.       String var1 = this.getPresentationName();
  57.       if (var1 != "") {
  58.          var1 = "Undo " + var1;
  59.       } else {
  60.          var1 = "Undo";
  61.       }
  62.  
  63.       return var1;
  64.    }
  65.  
  66.    public String getRedoPresentationName() {
  67.       String var1 = this.getPresentationName();
  68.       if (var1 != "") {
  69.          var1 = "Redo " + var1;
  70.       } else {
  71.          var1 = "Redo";
  72.       }
  73.  
  74.       return var1;
  75.    }
  76.  
  77.    public String toString() {
  78.       return super.toString() + " hasBeenDone: " + this.hasBeenDone + " alive: " + this.alive;
  79.    }
  80. }
  81.