示例#1
0
 public void setClip(RootedTree tree, PhyloNode node) {
   setStateRecursive(tree, (PhyloNode) tree.getRoot(), PhyloNode.NONE);
   RootedTree clone = tree.cloneSubtree(node);
   newickString = TreeIO.createNHXString(clone);
   origTree = tree;
   origVertex = node;
   fireEvent(CLIPBOARD_UPDATED);
 }
示例#2
0
  PhyloTree loadClip() {
    if (newickString == null || newickString.length() == 0) {
      /*
       * Try loading a tree from the system clipboard.
       */
      newickString = StringClipboard.instance.fromClipboard();
    }
    if (newickString == null || newickString.length() == 0)
      throw new Error("Called TreeClipboard.paste() with empty clipboard");

    PhyloTree clipTree = new PhyloTree();
    TreeIO.parseNewickString(clipTree, newickString);

    if (origTree != null && origVertex != null) {
      setPositionRecursive(clipTree, (PhyloNode) clipTree.getRoot(), origVertex);
    }
    return clipTree;
  }