Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document.undo
Class ComplexDocumentEdit

    java.lang.Object
      info.bioinfweb.treegraph.document.undo.DocumentEdit
          info.bioinfweb.treegraph.document.undo.ComplexDocumentEdit

All Implemented Interfaces:
  UndoableEdit

Direct Known Subclasses:
  AddSupportValuesEdit, LadderizeEdit, ReplaceInNodeDataEdit, RerootEdit, RescaleNodeDataEdit

    public abstract class ComplexDocumentEdit

extends DocumentEdit

This class is the ancestor to all edits that are too complex to have an own `undo()` method. Descendant do not specify a `redo()`- and an `undo()`-method but override the abstract method `performRedo()`.
This class outs a copy of the old tree in the document before calling `performRedo()` so all classes implementing perform redo have to translate references to elements of the old tree by using the `findEquivilant()`-methods.

Author:
  Ben Stöver

Field Summary
`private boolean` | `firstRedone`
`private Node` | `newRoot`
`private Node` | `oldRoot`

Fields inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
`document`

Constructor Summary
`ComplexDocumentEdit(Document document)`

Method Summary
`protected Branch` | `findEquivilant(Branch old)` Returns the branch in the new tree (copy of the old) with the equivilant position to `old`.
`protected Node` | `findEquivilant(Node old)` Returns the node in the new tree (copy of the old) with the equivilant position to `old`.
`protected abstract void` | `performRedo()`
`void` | `redo()`
`void` | `undo()`

Methods inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
`addEdit, canRedo, canUndo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.swing.undo.UndoableEdit
`getPresentationName`

Field Detail

### oldRoot

    private Node oldRoot

### newRoot

    private Node newRoot

### firstRedone

    private boolean firstRedone

Constructor Detail

### ComplexDocumentEdit

    public ComplexDocumentEdit(Document document)

Method Detail

### findEquivilant

    protected Node findEquivilant(Node old)

  Returns the node in the new tree (copy of the old) with the equivilant position to `old`.

  Parameters:
    `old` - the node in the old tree
  Returns:
    the node in the new tree

### findEquivilant

    protected Branch findEquivilant(Branch old)

  Returns the branch in the new tree (copy of the old) with the equivilant position to `old`.

  Parameters:
    `old` - the branch in the old tree
  Returns:
    the branch in the new tree

### performRedo

    protected abstract void performRedo()

### redo

    public void redo()
              throws CannotRedoException

  Specified by:
    `redo` in interface `UndoableEdit`
  Overrides:
    `redo` in class `DocumentEdit`
  Throws:
    `CannotRedoException`

### undo

    public void undo()
              throws CannotUndoException

  Specified by:
    `undo` in interface `UndoableEdit`
  Overrides:
    `undo` in class `DocumentEdit`
  Throws:
    `CannotUndoException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD