info.bioinfweb.treegraph.document.undo.format
Class BranchWidthsFromNodeDataEdit

java.lang.Object
  extended by info.bioinfweb.treegraph.document.undo.DocumentEdit
      extended by info.bioinfweb.treegraph.document.undo.format.NodeDataFormatEdit
          extended by info.bioinfweb.treegraph.document.undo.format.BranchWidthsFromNodeDataEdit
All Implemented Interfaces:
javax.swing.undo.UndoableEdit

public class BranchWidthsFromNodeDataEdit
extends NodeDataFormatEdit


Field Summary
private  NodeDataAdapter adapter
           
private  boolean changeUndefined
           
private  double factor
           
private  double min
           
private  java.util.Vector<java.lang.Float> oldWidths
           
 
Fields inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
document
 
Constructor Summary
BranchWidthsFromNodeDataEdit(Document document, NodeDataAdapter adapter, double min, double max, boolean changeUndefined)
           
 
Method Summary
 java.lang.String getPresentationName()
           
 void redo()
           
private  void saveOldWidths(Node root)
          Saves the old widths in a linear list (ordering is root, child 0..n)
private  void setNewWidths(Node root)
          Sets the branch widths according to the specified range and node data.
private  int setOldWidths(Node root, int index)
          Assigns the previously saved line widths to the branches in the subtree under root.
 void undo()
           
 
Methods inherited from class info.bioinfweb.treegraph.document.undo.format.NodeDataFormatEdit
calculateMaxNodeData
 
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
 

Field Detail

adapter

private NodeDataAdapter adapter

min

private double min

factor

private double factor

changeUndefined

private boolean changeUndefined

oldWidths

private java.util.Vector<java.lang.Float> oldWidths
Constructor Detail

BranchWidthsFromNodeDataEdit

public BranchWidthsFromNodeDataEdit(Document document,
                                    NodeDataAdapter adapter,
                                    double min,
                                    double max,
                                    boolean changeUndefined)
Method Detail

saveOldWidths

private void saveOldWidths(Node root)
Saves the old widths in a linear list (ordering is root, child 0..n)

Parameters:
root -

setNewWidths

private void setNewWidths(Node root)
Sets the branch widths according to the specified range and node data.

Parameters:
root -

redo

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

setOldWidths

private int setOldWidths(Node root,
                         int index)
Assigns the previously saved line widths to the branches in the subtree under root.

Parameters:
root -
index - - the index of the value for root in oldWidths
Returns:
the next unused index of oldWidths

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Specified by:
undo in interface javax.swing.undo.UndoableEdit
Overrides:
undo in class DocumentEdit
Throws:
javax.swing.undo.CannotUndoException

getPresentationName

public java.lang.String getPresentationName()