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

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.ColorsFromNodeDataEdit
All Implemented Interfaces:
javax.swing.undo.UndoableEdit

public class ColorsFromNodeDataEdit
extends NodeDataFormatEdit


Field Summary
private  NodeDataAdapter adapter
           
(package private)  double blueFactor
           
private  boolean changeUndefined
           
(package private)  double greenFactor
           
private  java.awt.Color min
           
private  java.util.Vector<java.awt.Color> oldBranchColors
           
private  java.util.Vector<java.awt.Color> oldNodeColors
           
(package private)  double redFactor
           
 
Fields inherited from class info.bioinfweb.treegraph.document.undo.DocumentEdit
document
 
Constructor Summary
ColorsFromNodeDataEdit(Document document, NodeDataAdapter adapter, java.awt.Color min, java.awt.Color max, boolean changeUndefined)
           
 
Method Summary
 java.lang.String getPresentationName()
           
 void redo()
           
private  void saveOldColors(Node root)
          Saves the old branch and node line colors in two linear list (ordering is root, child 0..n)
private  void setNewColors(Node root)
          Sets the line colors according to the specified border colors and node data.
private  int setOldColors(Node root, int index)
          Assigns the previously saved line colors to the branches and nodes 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 java.awt.Color min

redFactor

double redFactor

greenFactor

double greenFactor

blueFactor

double blueFactor

changeUndefined

private boolean changeUndefined

oldBranchColors

private java.util.Vector<java.awt.Color> oldBranchColors

oldNodeColors

private java.util.Vector<java.awt.Color> oldNodeColors
Constructor Detail

ColorsFromNodeDataEdit

public ColorsFromNodeDataEdit(Document document,
                              NodeDataAdapter adapter,
                              java.awt.Color min,
                              java.awt.Color max,
                              boolean changeUndefined)
Method Detail

saveOldColors

private void saveOldColors(Node root)
Saves the old branch and node line colors in two linear list (ordering is root, child 0..n)

Parameters:
root - the root of the subtree to be saved

setNewColors

private void setNewColors(Node root)
Sets the line colors according to the specified border colors 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

setOldColors

private int setOldColors(Node root,
                         int index)
Assigns the previously saved line colors to the branches and nodes in the subtree under root.

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

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()