X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FTreePanel.java;h=42be37b1624c65f99aefa7a8e5401e719b88d9cd;hb=80a1a1f98f80f52fbd536f5e83ebab4354e74d5e;hp=c33975b28f60003f6a3ec461c3e8f4e3e2e3327e;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index c33975b..42be37b 100755 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -1,39 +1,40 @@ /* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, 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 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. -* -* 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 - A Sequence Alignment Editor and Viewer + * Copyright (C) 2005 AM Waterhouse, J Procter, 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 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. + * + * 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 + */ package jalview.appletgui; -import jalview.datamodel.*; -import jalview.io.NewickFile; -import jalview.analysis.*; -import jalview.jbappletgui.GTreePanel; -import java.awt.event.*; import java.util.*; -import jalview.io.NewickFile; +import java.awt.event.*; -public class TreePanel extends GTreePanel +import jalview.analysis.*; +import jalview.datamodel.*; +import jalview.io.*; +import jalview.jbappletgui.*; + +public class TreePanel + extends GTreePanel { SequenceI[] seq; String type; String pwtype; - AlignViewport av; + AlignmentPanel ap; int start; int end; TreeCanvas treeCanvas; @@ -44,9 +45,46 @@ public class TreePanel extends GTreePanel return tree; } - public TreePanel(AlignViewport av, Vector seqVector, String type, String pwtype, int s, int e) + /** + * Creates a new TreePanel object. + * + * @param av DOCUMENT ME! + * @param seqVector DOCUMENT ME! + * @param type DOCUMENT ME! + * @param pwtype DOCUMENT ME! + * @param s DOCUMENT ME! + * @param e DOCUMENT ME! + */ + public TreePanel(AlignViewport av, Vector seqVector, String type, + String pwtype, int s, int e) + { + super(); + initTreePanel(av, seqVector, type, pwtype, s, e, null); + + // We know this tree has distances. JBPNote TODO: prolly should add this as a userdefined default + treeCanvas.setShowDistances(true); + } + + /** + * Creates a new TreePanel object. + * + * @param av DOCUMENT ME! + * @param seqVector DOCUMENT ME! + * @param newtree DOCUMENT ME! + * @param type DOCUMENT ME! + * @param pwtype DOCUMENT ME! + */ + public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree, + String type, String pwtype) { super(); + initTreePanel(av, seqVector, type, pwtype, 0, seqVector.size(), newtree); + } + + + void initTreePanel(AlignViewport av, Vector seqVector, String type, + String pwtype, int s, int e, NewickFile newTree) + { this.type = type; this.pwtype = pwtype; @@ -54,67 +92,55 @@ public class TreePanel extends GTreePanel start = s; end = e; - String longestName = ""; - seq = new Sequence [seqVector.size()]; - for (int i=0;i < seqVector.size();i++) - { - seq[i] = (Sequence) seqVector.elementAt(i); - if(seq[i].getName().length()>longestName.length()) - longestName = seq[i].getName(); - } + seq = new Sequence[seqVector.size()]; + for(int i=0; i