X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fappletgui%2FTreePanel.java;h=64716b0c53d604e2360deb627ff9e0bffa05ad28;hb=9876fdccf311378e690c1f9e18db52675d427b89;hp=7595a50cc71832fc0cb1625ce439577f52a99f7b;hpb=362f2db1b01f3562784864a1d6ac5f7b9be0a18a;p=jalview.git
diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java
index 7595a50..64716b0 100644
--- a/src/jalview/appletgui/TreePanel.java
+++ b/src/jalview/appletgui/TreePanel.java
@@ -1,29 +1,47 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
*
* This file is part of Jalview.
*
* 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.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.appletgui;
-import java.awt.*;
-import java.awt.event.*;
-import java.util.Hashtable;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.io.*;
+import jalview.analysis.NJTree;
+import jalview.api.analysis.ScoreModelI;
+import jalview.api.analysis.ViewBasedAnalysisI;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
+import jalview.io.NewickFile;
+import jalview.schemes.ResidueProperties;
+import jalview.util.MessageManager;
+
+import java.awt.BorderLayout;
+import java.awt.CheckboxMenuItem;
+import java.awt.Color;
+import java.awt.Menu;
+import java.awt.MenuBar;
+import java.awt.MenuItem;
+import java.awt.ScrollPane;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
public class TreePanel extends EmbmenuFrame implements ActionListener,
ItemListener
@@ -41,6 +59,7 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
TreeCanvas treeCanvas;
NJTree tree;
+
AlignmentPanel ap;
AlignViewport av;
@@ -49,10 +68,11 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
{
return tree;
}
-
- public void finalize() throws Throwable {
- ap=null;
- av=null;
+
+ public void finalize() throws Throwable
+ {
+ ap = null;
+ av = null;
super.finalize();
}
@@ -186,11 +206,11 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
{
if (odata == null)
{
- tree = new NJTree(av.alignment.getSequencesArray(), newtree);
+ tree = new NJTree(av.getAlignment().getSequencesArray(), newtree);
}
else
{
- tree = new NJTree(av.alignment.getSequencesArray(), odata,
+ tree = new NJTree(av.getAlignment().getSequencesArray(), odata,
newtree);
}
@@ -199,22 +219,43 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
{
int start, end;
SequenceI[] seqs;
- AlignmentView seqStrings = av.getAlignmentView(av
- .getSelectionGroup() != null);
- if (av.getSelectionGroup() == null)
+ boolean selview = av.getSelectionGroup() != null
+ && av.getSelectionGroup().getSize() > 1;
+ AlignmentView seqStrings = av.getAlignmentView(selview);
+ if (!selview)
{
start = 0;
- end = av.alignment.getWidth();
- seqs = av.alignment.getSequencesArray();
+ end = av.getAlignment().getWidth();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
start = av.getSelectionGroup().getStartRes();
end = av.getSelectionGroup().getEndRes() + 1;
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(
+ av.getAlignment());
+ }
+ ScoreModelI sm = ResidueProperties.getScoreModel(pwtype);
+ if (sm instanceof ViewBasedAnalysisI)
+ {
+ try
+ {
+ sm = sm.getClass().newInstance();
+ ((ViewBasedAnalysisI) sm)
+ .configureFromAlignmentView(treeCanvas.ap);
+ } catch (Exception q)
+ {
+ System.err.println("Couldn't create a scoremodel instance for "
+ + sm.getName());
+ q.printStackTrace();
+ }
+ tree = new NJTree(seqs, seqStrings, type, pwtype, sm, start, end);
+ }
+ else
+ {
+ tree = new NJTree(seqs, seqStrings, type, pwtype, null, start,
+ end);
}
-
- tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
}
tree.reCount(tree.getTopNode());
@@ -348,22 +389,24 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
setLayout(borderLayout1);
this.setBackground(Color.white);
this.setFont(new java.awt.Font("Verdana", 0, 12));
- jMenu2.setLabel("View");
- fontSize.setLabel("Font...");
+ jMenu2.setLabel(MessageManager.getString("action.view"));
+ fontSize.setLabel(MessageManager.getString("action.font"));
fontSize.addActionListener(this);
- bootstrapMenu.setLabel("Show Bootstrap Values");
+ bootstrapMenu.setLabel(MessageManager
+ .getString("label.show_bootstrap_values"));
bootstrapMenu.addItemListener(this);
- distanceMenu.setLabel("Show Distances");
+ distanceMenu.setLabel(MessageManager.getString("label.show_distances"));
distanceMenu.addItemListener(this);
- placeholdersMenu.setLabel("Mark Unassociated Leaves");
+ placeholdersMenu.setLabel(MessageManager
+ .getString("label.mark_unassociated_leaves"));
placeholdersMenu.addItemListener(this);
fitToWindow.setState(true);
- fitToWindow.setLabel("Fit To Window");
+ fitToWindow.setLabel(MessageManager.getString("label.fit_to_window"));
fitToWindow.addItemListener(this);
- fileMenu.setLabel("File");
- newickOutput.setLabel("Newick Format");
+ fileMenu.setLabel(MessageManager.getString("action.file"));
+ newickOutput.setLabel(MessageManager.getString("label.newick_format"));
newickOutput.addActionListener(this);
- inputData.setLabel("Input Data...");
+ inputData.setLabel(MessageManager.getString("label.input_data"));
add(scrollPane, BorderLayout.CENTER);
jMenuBar1.add(fileMenu);