info.bioinfweb.treegraph.document.undo.edit
Class AssignLabelIDsEdit

java.lang.Object
  extended by info.bioinfweb.treegraph.document.undo.DocumentEdit
      extended by info.bioinfweb.treegraph.document.undo.edit.AssignLabelIDsEdit
All Implemented Interfaces:
UndoableEdit

public class AssignLabelIDsEdit
extends DocumentEdit

This edit assigns label IDs to all labels in the tree which do not have an ID.

Author:
BenStoever

Field Summary
private  Vector<String> currentIDs
           
private  Vector<String> newIDs
           
 
Fields inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
document
 
Constructor Summary
AssignLabelIDsEdit(Document document)
           
 
Method Summary
private  int assignIDsToLabelBlock(Labels labels, boolean above, int pos)
          Assigns a new label ID to each label in this label block currently without an ID.
private  void assignIDsToSubtree(Node root)
           
 boolean canUndo()
           
private  String getNewID(int pos)
           
 String getPresentationName()
           
 void redo()
           
 
Methods inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
addEdit, canRedo, die, getRedoPresentationName, getUndoPresentationName, isSignificant, replaceEdit, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentIDs

private Vector<String> currentIDs

newIDs

private Vector<String> newIDs
Constructor Detail

AssignLabelIDsEdit

public AssignLabelIDsEdit(Document document)
Method Detail

getNewID

private String getNewID(int pos)

assignIDsToLabelBlock

private int assignIDsToLabelBlock(Labels labels,
                                  boolean above,
                                  int pos)
Assigns a new label ID to each label in this label block currently without an ID.

Parameters:
labels - - the Labels-object containing the label block.
above - - whether the above label block is used
pos - - the start position in the list of new label IDs
Returns:
the position in the list of new label IDs

assignIDsToSubtree

private void assignIDsToSubtree(Node root)

redo

public void redo()
          throws CannotRedoException
Specified by:
redo in interface UndoableEdit
Overrides:
redo in class DocumentEdit
Throws:
CannotRedoException

canUndo

public boolean canUndo()
Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class DocumentEdit

getPresentationName

public String getPresentationName()