FileDocCategorySizeDatePackage
SampleUndoableEdit.javaAPI DocExample2315Thu Oct 24 20:14:26 BST 2002None

SampleUndoableEdit

public class SampleUndoableEdit extends AbstractUndoableEdit

Fields Summary
private boolean
isSignificant
private boolean
isReplacer
private int
number
private boolean
allowAdds
private Vector
addedEdits
private UndoableEdit
replaced
Constructors Summary
public SampleUndoableEdit(int number, boolean allowAdds, boolean isSignificant, boolean isReplacer)

    this.number = number;
    this.allowAdds = allowAdds;
    if (allowAdds)
      addedEdits = new Vector();
    this.isSignificant = isSignificant;
    this.isReplacer = isReplacer;
  
Methods Summary
public booleanaddEdit(javax.swing.undo.UndoableEdit anEdit)

    if (allowAdds) {
      addedEdits.addElement(anEdit);
      return true;
    }
    else
      return false;
  
public voiddumpState()

    if (allowAdds && addedEdits.size() > 0) {
      Enumeration e = addedEdits.elements();
      System.out.print(" (absorbed: ");
      while (e.hasMoreElements()) {
        System.out.print(e.nextElement());
      }
      System.out.print(")");
    }
    if (isReplacer && replaced != null) {
      System.out.print(" (replaced: " + replaced + ")");
    }
    System.out.println();
  
public booleanisSignificant()

    return isSignificant;
  
public voidredo()

    super.redo();
    System.out.print("Redo " + number);
    dumpState();
  
public booleanreplaceEdit(javax.swing.undo.UndoableEdit anEdit)

    if (isReplacer) {
      replaced = anEdit;
      return true;
    }
    else
      return false;
  
public java.lang.StringtoString()

    return "<" + number + ">";
  
public voidundo()

    super.undo();
    System.out.print("Undo " + number);
    dumpState();