X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FTreePanel.java;h=0351d144ece05990d93e6c1a0d0a1a75ddf1fbec;hb=2026a420963f094072607c0495b6369ba96e60c0;hp=735a11bfd94be34941cf7809d9c559289ee194b1;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java old mode 100755 new mode 100644 index 735a11b..0351d14 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -1,20 +1,19 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) - * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This file is part of Jalview. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.appletgui; @@ -42,6 +41,7 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, TreeCanvas treeCanvas; NJTree tree; + AlignmentPanel ap; AlignViewport av; @@ -49,24 +49,30 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, { return tree; } + + public void finalize() throws Throwable { + ap=null; + av=null; + super.finalize(); + } /** * Creates a new TreePanel object. * * @param av - * DOCUMENT ME! + * DOCUMENT ME! * @param seqVector - * DOCUMENT ME! + * DOCUMENT ME! * @param type - * DOCUMENT ME! + * DOCUMENT ME! * @param pwtype - * DOCUMENT ME! + * DOCUMENT ME! * @param s - * DOCUMENT ME! + * DOCUMENT ME! * @param e - * DOCUMENT ME! + * DOCUMENT ME! */ - public TreePanel(AlignViewport av, String type, String pwtype) + public TreePanel(AlignmentPanel ap, String type, String pwtype) { try { @@ -77,24 +83,24 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, ex.printStackTrace(); } - initTreePanel(av, type, pwtype, null); + initTreePanel(ap, type, pwtype, null); } /** * Creates a new TreePanel object. * * @param av - * DOCUMENT ME! + * DOCUMENT ME! * @param seqVector - * DOCUMENT ME! + * DOCUMENT ME! * @param newtree - * DOCUMENT ME! + * DOCUMENT ME! * @param type - * DOCUMENT ME! + * DOCUMENT ME! * @param pwtype - * DOCUMENT ME! + * DOCUMENT ME! */ - public TreePanel(AlignViewport av, String type, String pwtype, + public TreePanel(AlignmentPanel ap, String type, String pwtype, NewickFile newtree) { try @@ -106,18 +112,19 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, e.printStackTrace(); } - initTreePanel(av, type, pwtype, newtree); + initTreePanel(ap, type, pwtype, newtree); } - void initTreePanel(AlignViewport av, String type, String pwtype, + void initTreePanel(AlignmentPanel ap, String type, String pwtype, NewickFile newTree) { - this.av = av; + this.ap = ap; + this.av = ap.av; this.type = type; this.pwtype = pwtype; - treeCanvas = new TreeCanvas(av, scrollPane); + treeCanvas = new TreeCanvas(ap, scrollPane); TreeLoader tl = new TreeLoader(newTree); tl.start(); embedMenuIfNeeded(treeCanvas); @@ -215,10 +222,20 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, treeCanvas.setTree(tree); if (newtree != null) { - distanceMenu.setState(newtree.HasDistances()); - bootstrapMenu.setState(newtree.HasBootstrap()); - treeCanvas.setShowBootstrap(newtree.HasBootstrap()); - treeCanvas.setShowDistances(newtree.HasDistances()); + // Set default view, paying lip service to any overriding tree view + // parameter settings + boolean showDist = newtree.HasDistances() + && av.applet.getDefaultParameter("showTreeDistances", + newtree.HasDistances()); + boolean showBoots = newtree.HasBootstrap() + && av.applet.getDefaultParameter("showTreeBootstraps", + newtree.HasBootstrap()); + distanceMenu.setState(showDist); + bootstrapMenu.setState(showBoots); + treeCanvas.setShowBootstrap(showBoots); + treeCanvas.setShowDistances(showDist); + treeCanvas.setMarkPlaceholders(av.applet.getDefaultParameter( + "showUnlinkedTreeNodes", false)); } treeCanvas.repaint(); @@ -271,8 +288,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, public void newickOutput_actionPerformed() { - jalview.io.NewickFile fout = new jalview.io.NewickFile(tree - .getTopNode()); + jalview.io.NewickFile fout = new jalview.io.NewickFile( + tree.getTopNode()); String output = fout.print(false, true); CutAndPasteTransfer cap = new CutAndPasteTransfer(false, null); cap.setText(output);