FileDocCategorySizeDatePackage
ExtendedUndoManager.javaAPI DocExample3168Mon Nov 09 12:45:50 GMT 1998None

ExtendedUndoManager

public class ExtendedUndoManager extends UndoManager implements UndoableEditListener

Fields Summary
private ExtendedUndoableEditSupport
support
private Object
source
Constructors Summary
Methods Summary
public synchronized booleanaddEdit(javax.swing.undo.UndoableEdit anEdit)

    boolean b = super.addEdit(anEdit);
    if (b)
      support.postEdit(anEdit); // if the edit was added, notify listeners
    return b;
  
public synchronized voidaddUndoableEditListener(javax.swing.event.UndoableEditListener l)

    support.addUndoableEditListener(l);
  
public synchronized javax.swing.undo.UndoableEdit[]getEdits()

    UndoableEdit[] array = new UndoableEdit[edits.size()];
    edits.copyInto(array);
    return array;
  
public synchronized javax.swing.undo.UndoableEdit[]getRedoableEdits()

    int size = edits.size();
    Vector v = new Vector(size);
    for (int i=0; i<size; i++) {
      UndoableEdit u = (UndoableEdit)edits.elementAt(i);
      if (u.canRedo() && u.isSignificant())
        v.addElement(u);
    }
    UndoableEdit[] array = new UndoableEdit[v.size()];
    v.copyInto(array);
    return array;
  
public synchronized javax.swing.undo.UndoableEdit[]getUndoableEdits()

    int size = edits.size();
    Vector v = new Vector(size);
    for (int i=size-1;i>=0;i--) {
      UndoableEdit u = (UndoableEdit)edits.elementAt(i);
      if (u.canUndo() && u.isSignificant())
        v.addElement(u);
    }
    UndoableEdit[] array = new UndoableEdit[v.size()];
    v.copyInto(array);
    return array;
  
public synchronized voidremoveUndoableEditListener(javax.swing.event.UndoableEditListener l)

    support.removeUndoableEditListener(l);
  
public synchronized voidundoableEditHappened(javax.swing.event.UndoableEditEvent ev)

    UndoableEdit ue = ev.getEdit();
    source = ev.getSource();
    addEdit(ue);