/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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 <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
-import java.beans.*;
-import java.io.*;
-import java.util.*;
+import jalview.analysis.AlignmentSorter;
+import jalview.analysis.TreeModel;
+import jalview.bin.Cache;
+import jalview.commands.CommandI;
+import jalview.commands.OrderCommand;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.BinaryNode;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.NodeTransformI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.SequenceNode;
+import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
+import jalview.io.NewickFile;
+import jalview.jbgui.GTreePanel;
+import jalview.util.ImageMaker;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
+import java.beans.PropertyChangeEvent;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
import java.util.List;
-import javax.imageio.*;
+import javax.imageio.ImageIO;
+import javax.swing.ButtonGroup;
+import javax.swing.JMenuItem;
+import javax.swing.JRadioButtonMenuItem;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import javax.swing.*;
-
-import org.jibble.epsgraphics.*;
-import jalview.analysis.*;
-import jalview.commands.CommandI;
-import jalview.commands.OrderCommand;
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
+import org.jibble.epsgraphics.EpsGraphics2D;
/**
* DOCUMENT ME!
*/
public class TreePanel extends GTreePanel
{
- String type;
+ String substitutionMatrix;
+
+ String treeType;
- String pwtype;
+ String treeTitle; // if tree loaded
TreeCanvas treeCanvas;
- NJTree tree;
+ TreeModel tree;
AlignViewport av;
/**
* 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!
+ * @param ap
+ * @param tree
+ * @param treeType
+ * @param substitutionMatrix
*/
- public TreePanel(AlignmentPanel ap, String type, String pwtype)
+ public TreePanel(AlignmentPanel ap, TreeModel tree, String treeType,
+ String substitutionMatrix)
{
super();
- initTreePanel(ap, type, pwtype, null, null);
+ this.treeType = treeType;
+ this.substitutionMatrix = substitutionMatrix;
+ this.tree = tree;
+ initTreePanel(ap, tree);
// We know this tree has distances. JBPNote TODO: prolly should add this as
// a userdefined default
/**
* Creates a new TreePanel object.
*
- * @param av
- * DOCUMENT ME!
- * @param seqVector
- * DOCUMENT ME!
+ * @param alignPanel
* @param newtree
- * DOCUMENT ME!
- * @param type
- * DOCUMENT ME!
- * @param pwtype
- * DOCUMENT ME!
+ * @param theTitle
+ * @param inputData
*/
- public TreePanel(AlignmentPanel ap, String type, String pwtype,
- NewickFile newtree)
+ public TreePanel(AlignmentPanel alignPanel, NewickFile newtree,
+ String theTitle, AlignmentView inputData)
{
super();
- initTreePanel(ap, type, pwtype, newtree, null);
- }
-
- public TreePanel(AlignmentPanel av, String type, String pwtype,
- NewickFile newtree, AlignmentView inputData)
- {
- super();
- initTreePanel(av, type, pwtype, newtree, inputData);
+ this.treeTitle = theTitle;
+ initTreePanel(alignPanel, newtree, inputData);
}
public AlignmentI getAlignment()
return treeCanvas.av.getAlignment();
}
- public AlignViewport getViewPort()
+ public AlignmentViewport getViewPort()
{
return treeCanvas.av;
}
- void initTreePanel(AlignmentPanel ap, String type, String pwtype,
- NewickFile newTree, AlignmentView inputData)
+ /**
+ * Initialize a tree panel based on a calculated tree
+ *
+ * @param ap
+ * @param tree
+ */
+ void initTreePanel(AlignmentPanel ap, TreeModel tree)
+ {
+ buildTreeCanvas(ap);
+
+ TreeLoader tl = new TreeLoader(null, null);
+ tl.start();
+
+ }
+
+ /**
+ * Initialize a tree panel based on a loaded in tree file.
+ *
+ * @param ap
+ * @param loadedTree
+ * @param inputData
+ */
+ void initTreePanel(AlignmentPanel ap,
+ NewickFile loadedTree, AlignmentView inputData)
{
+ buildTreeCanvas(ap);
+
+ TreeLoader tl = new TreeLoader(loadedTree, inputData);
+ tl.start();
+ }
- av = ap.av;
- this.type = type;
- this.pwtype = pwtype;
+public void buildTreeCanvas(AlignmentPanel ap) {
+ av = ap.av;
treeCanvas = new TreeCanvas(this, ap, scrollPane);
scrollPane.setViewportView(treeCanvas);
+
PaintRefresher.Register(this, ap.av.getSequenceSetId());
buildAssociatedViewMenu();
av.addPropertyChangeListener(new java.beans.PropertyChangeListener()
{
+ @Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals("alignment"))
}
if (evt.getNewValue() == null)
{
- System.out
- .println("new alignment sequences vector value is null");
+ System.out.println(
+ "new alignment sequences vector value is null");
}
- tree.UpdatePlaceHolders((List<SequenceI>) evt.getNewValue());
+ tree.updatePlaceHolders((List<SequenceI>) evt.getNewValue());
treeCanvas.nameHash.clear(); // reset the mapping between canvas
// rectangles and leafnodes
repaint();
}
});
- TreeLoader tl = new TreeLoader(newTree);
- if (inputData != null)
- {
- tl.odata = inputData;
- }
- tl.start();
+
+
}
+ @Override
public void viewMenu_menuSelected()
{
buildAssociatedViewMenu();
void buildAssociatedViewMenu()
{
- AlignmentPanel[] aps = PaintRefresher.getAssociatedPanels(av
- .getSequenceSetId());
+ AlignmentPanel[] aps = PaintRefresher
+ .getAssociatedPanels(av.getSequenceSetId());
if (aps.length == 1 && treeCanvas.ap == aps[0])
{
associateLeavesMenu.setVisible(false);
associateLeavesMenu.setVisible(true);
- if ((viewMenu.getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem))
+ if ((viewMenu
+ .getItem(viewMenu.getItemCount() - 2) instanceof JMenuItem))
{
viewMenu.insertSeparator(viewMenu.getItemCount() - 1);
}
buttonGroup.add(item);
item.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
treeCanvas.applyToAllViews = false;
associateLeavesMenu.add(item);
}
- final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem("All Views");
+ final JRadioButtonMenuItem itemf = new JRadioButtonMenuItem(
+ MessageManager.getString("label.all_views"));
buttonGroup.add(itemf);
itemf.setSelected(treeCanvas.applyToAllViews);
itemf.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
treeCanvas.applyToAllViews = itemf.isSelected();
class TreeLoader extends Thread
{
- NewickFile newtree;
+ private NewickFile newTree;
- jalview.datamodel.AlignmentView odata = null;
+ private AlignmentView odata = null;
- public TreeLoader(NewickFile newtree)
+ public TreeLoader(NewickFile newickFile, AlignmentView inputData)
{
- this.newtree = newtree;
- if (newtree != null)
+ this.newTree = newickFile;
+ this.odata = inputData;
+
+ if (newTree != null)
{
// Must be outside run(), as Jalview2XML tries to
// update distance/bootstrap visibility at the same time
- showBootstrap(newtree.HasBootstrap());
- showDistances(newtree.HasDistances());
+ showBootstrap(newTree.hasBootstrap());
+ showDistances(newTree.hasDistances());
+
}
+
}
+ @Override
public void run()
{
- if (newtree != null)
- {
- if (odata == null)
- {
- tree = new NJTree(av.getAlignment().getSequencesArray(), newtree);
- }
- else
- {
- tree = new NJTree(av.getAlignment().getSequencesArray(), odata,
- newtree);
- }
- if (!tree.hasOriginalSequenceData())
- {
- allowOriginalSeqData(false);
- }
- }
- else
+ if (newTree != null)
{
- int start, end;
- SequenceI[] seqs;
- boolean selview = av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() > 1;
- AlignmentView seqStrings = av.getAlignmentView(selview);
- if (!selview)
- {
- start = 0;
- end = av.getAlignment().getWidth();
- seqs = av.getAlignment().getSequencesArray();
- }
- else
+ tree = new TreeModel(av.getAlignment().getSequencesArray(), odata,
+ newTree);
+ if (tree.getOriginalData() == null)
{
- start = av.getSelectionGroup().getStartRes();
- end = av.getSelectionGroup().getEndRes() + 1;
- seqs = av.getSelectionGroup().getSequencesInOrder(
- av.getAlignment());
+ originalSeqData.setVisible(false);
}
- tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
- showDistances(true);
+
+
}
+ showTree(tree);
+ }
+
+ public void showTree(TreeModel tree)
+ {
tree.reCount(tree.getTopNode());
tree.findHeight(tree.getTopNode());
treeCanvas.setTree(tree);
treeCanvas.repaint();
+
av.setCurrentTree(tree);
if (av.getSortByTree())
{
- sortByTree_actionPerformed(null);
+ sortByTree_actionPerformed();
}
+
}
}
treeCanvas.setMarkPlaceholders(b);
}
- private void allowOriginalSeqData(boolean b)
- {
- originalSeqData.setVisible(b);
- }
-
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
- public NJTree getTree()
+ public TreeModel getTree()
{
return tree;
}
* @param e
* DOCUMENT ME!
*/
+ @Override
public void textbox_actionPerformed(ActionEvent e)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
- StringBuffer buffer = new StringBuffer();
-
- if (type.equals("AV"))
- {
- buffer.append("Average distance tree using ");
- }
- else
- {
- buffer.append("Neighbour joining tree using ");
- }
-
- if (pwtype.equals("BL"))
- {
- buffer.append("BLOSUM62");
- }
- else
- {
- buffer.append("PID");
- }
+ String newTitle = getPanelTitle();
- jalview.io.NewickFile fout = new jalview.io.NewickFile(
- tree.getTopNode());
+ NewickFile fout = new NewickFile(tree.getTopNode());
try
{
- cap.setText(fout.print(tree.isHasBootstrap(), tree.isHasDistances(),
- tree.isHasRootDistance()));
- Desktop.addInternalFrame(cap, buffer.toString(), 500, 100);
+ cap.setText(fout.print(tree.hasBootstrap(), tree.hasDistances(),
+ tree.hasRootDistance()));
+ Desktop.addInternalFrame(cap, newTitle, 500, 100);
} catch (OutOfMemoryError oom)
{
new OOMWarning("generating newick tree file", oom);
* @param e
* DOCUMENT ME!
*/
+ @Override
public void saveAsNewick_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save tree as newick file");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(
+ MessageManager.getString("label.save_tree_as_newick"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(null);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
String choice = chooser.getSelectedFile().getPath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
- .getSelectedFile().getParent());
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ chooser.getSelectedFile().getParent());
try
{
jalview.io.NewickFile fout = new jalview.io.NewickFile(
tree.getTopNode());
- String output = fout.print(tree.isHasBootstrap(),
- tree.isHasDistances(), tree.isHasRootDistance());
+ String output = fout.print(tree.hasBootstrap(), tree.hasDistances(),
+ tree.hasRootDistance());
java.io.PrintWriter out = new java.io.PrintWriter(
new java.io.FileWriter(choice));
out.println(output);
* @param e
* DOCUMENT ME!
*/
+ @Override
public void printMenu_actionPerformed(ActionEvent e)
{
// Putting in a thread avoids Swing painting problems
treeCanvas.startPrinting();
}
+ @Override
public void originalSeqData_actionPerformed(ActionEvent e)
{
- if (!tree.hasOriginalSequenceData())
+ AlignmentView originalData = tree.getOriginalData();
+ if (originalData == null)
{
- jalview.bin.Cache.log
- .info("Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action.");
+ jalview.bin.Cache.log.info(
+ "Unexpected call to originalSeqData_actionPerformed - should have hidden this menu action.");
return;
}
// decide if av alignment is sufficiently different to original data to
} catch (Exception ex)
{
}
- ;
- Object[] alAndColsel = tree.seqData.getAlignmentAndColumnSelection(gc);
+
+ Object[] alAndColsel = originalData.getAlignmentAndHiddenColumns(gc);
if (alAndColsel != null && alAndColsel[0] != null)
{
// AlignmentOrder origorder = new AlignmentOrder(alAndColsel[0]);
- Alignment al = new Alignment((SequenceI[]) alAndColsel[0]);
- Alignment dataset = (av != null && av.getAlignment() != null) ? av
- .getAlignment().getDataset() : null;
+ AlignmentI al = new Alignment((SequenceI[]) alAndColsel[0]);
+ AlignmentI dataset = (av != null && av.getAlignment() != null)
+ ? av.getAlignment().getDataset()
+ : null;
if (dataset != null)
{
al.setDataset(dataset);
if (true)
{
// make a new frame!
- AlignFrame af = new AlignFrame(al,
- (ColumnSelection) alAndColsel[1], AlignFrame.DEFAULT_WIDTH,
- AlignFrame.DEFAULT_HEIGHT);
+ AlignFrame af = new AlignFrame(al, (HiddenColumns) alAndColsel[1],
+ AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
// >>>This is a fix for the moment, until a better solution is
// found!!<<<
// af.addSortByOrderMenuItem(ServiceName + " Ordering",
// msaorder);
- Desktop.addInternalFrame(af, "Original Data for " + this.title,
- AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
+ Desktop.addInternalFrame(af, MessageManager.formatMessage(
+ "label.original_data_for_params", new Object[]
+ { this.title }), AlignFrame.DEFAULT_WIDTH,
+ AlignFrame.DEFAULT_HEIGHT);
}
}
}
* @param e
* DOCUMENT ME!
*/
+ @Override
public void fitToWindow_actionPerformed(ActionEvent e)
{
treeCanvas.fitToWindow = fitToWindow.isSelected();
*
* @param e
*/
- public void sortByTree_actionPerformed(ActionEvent e)
+ @Override
+ public void sortByTree_actionPerformed()
{
if (treeCanvas.applyToAllViews)
{
- final ArrayList<CommandI> commands = new ArrayList<CommandI>();
- for (AlignmentPanel ap : PaintRefresher.getAssociatedPanels(av
- .getSequenceSetId()))
+ final ArrayList<CommandI> commands = new ArrayList<>();
+ for (AlignmentPanel ap : PaintRefresher
+ .getAssociatedPanels(av.getSequenceSetId()))
{
commands.add(sortAlignmentIn(ap.av.getAlignPanel()));
}
}
}
});
- for (AlignmentPanel ap : PaintRefresher.getAssociatedPanels(av
- .getSequenceSetId()))
+ for (AlignmentPanel ap : PaintRefresher
+ .getAssociatedPanels(av.getSequenceSetId()))
{
// ensure all the alignFrames refresh their GI after adding an undo item
ap.alignFrame.updateEditMenuBar();
public CommandI sortAlignmentIn(AlignmentPanel ap)
{
- AlignViewport av = ap.av;
- SequenceI[] oldOrder = av.getAlignment().getSequencesArray();
- AlignmentSorter.sortByTree(av.getAlignment(), tree);
+ // TODO: move to alignment view controller
+ AlignmentViewport viewport = ap.av;
+ SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
+ AlignmentSorter.sortByTree(viewport.getAlignment(), tree);
CommandI undo;
- undo = new OrderCommand("Tree Sort", oldOrder, av.getAlignment());
+ undo = new OrderCommand("Tree Sort", oldOrder, viewport.getAlignment());
- ap.paintAlignment(true);
+ ap.paintAlignment(true, false);
return undo;
}
* @param e
* DOCUMENT ME!
*/
+ @Override
public void font_actionPerformed(ActionEvent e)
{
if (treeCanvas == null)
return treeCanvas.font;
}
- public void setTreeFont(Font font)
+ public void setTreeFont(Font f)
{
if (treeCanvas != null)
{
- treeCanvas.setFont(font);
+ treeCanvas.setFont(f);
}
}
* @param e
* DOCUMENT ME!
*/
+ @Override
public void distanceMenu_actionPerformed(ActionEvent e)
{
treeCanvas.setShowDistances(distanceMenu.isSelected());
* @param e
* DOCUMENT ME!
*/
+ @Override
public void bootstrapMenu_actionPerformed(ActionEvent e)
{
treeCanvas.setShowBootstrap(bootstrapMenu.isSelected());
* @param e
* DOCUMENT ME!
*/
+ @Override
public void placeholdersMenu_actionPerformed(ActionEvent e)
{
treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());
* @param e
* DOCUMENT ME!
*/
+ @Override
public void epsTree_actionPerformed(ActionEvent e)
{
boolean accurateText = true;
try
{
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "eps" }, new String[]
- { "Encapsulated Postscript" }, "Encapsulated Postscript");
- chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Create EPS file from tree");
- chooser.setToolTipText("Save");
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ ImageMaker.EPS_EXTENSION, ImageMaker.EPS_EXTENSION);
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(
+ MessageManager.getString("label.create_eps_from_tree"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
- if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ if (value != JalviewFileChooser.APPROVE_OPTION)
{
return;
}
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
- .getSelectedFile().getParent());
+ Cache.setProperty("LAST_DIRECTORY",
+ chooser.getSelectedFile().getParent());
- FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());
- EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width, height);
+ FileOutputStream out = new FileOutputStream(
+ chooser.getSelectedFile());
+ EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width,
+ height);
pg.setAccurateTextMode(accurateText);
* @param e
* DOCUMENT ME!
*/
+ @Override
public void pngTree_actionPerformed(ActionEvent e)
{
int width = treeCanvas.getWidth();
try
{
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "png" }, new String[]
- { "Portable network graphics" }, "Portable network graphics");
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ ImageMaker.PNG_EXTENSION, ImageMaker.PNG_DESCRIPTION);
chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Create PNG image from tree");
- chooser.setToolTipText("Save");
+ chooser.setDialogTitle(
+ MessageManager.getString("label.create_png_from_tree"));
+ chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(this);
return;
}
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
- .getSelectedFile().getParent());
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ chooser.getSelectedFile().getParent());
- FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());
+ FileOutputStream out = new FileOutputStream(
+ chooser.getSelectedFile());
BufferedImage bi = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
tree.applyToNodes(new NodeTransformI()
{
+ @Override
public void transform(BinaryNode node)
{
if (node instanceof SequenceNode
if (sq != null)
{
// search dbrefs, features and annotation
- DBRefEntry[] refs = jalview.util.DBRefUtils.selectRefs(
- sq.getDBRef(), new String[]
+ DBRefEntry[] refs = jalview.util.DBRefUtils
+ .selectRefs(sq.getDBRefs(), new String[]
{ labelClass.toUpperCase() });
if (refs != null)
{
}
if (newname == null)
{
- SequenceFeature sf[] = sq.getSequenceFeatures();
- for (int i = 0; sf != null && i < sf.length; i++)
+ List<SequenceFeature> features = sq.getFeatures()
+ .getPositionalFeatures(labelClass);
+ for (SequenceFeature feature : features)
{
- if (sf[i].getType().equals(labelClass))
+ if (newname == null)
{
- if (newname == null)
- {
- newname = new String(sf[i].getDescription());
- }
- else
- {
- newname = newname + "; " + sf[i].getDescription();
- }
+ newname = feature.getDescription();
+ }
+ else
+ {
+ newname = newname + "; " + feature.getDescription();
}
}
}
}
if (newname != null)
{
- String oldname = ((SequenceNode) node).getName();
- // TODO : save in the undo object for this modification.
+ // String oldname = ((SequenceNode) node).getName();
+ // TODO : save oldname in the undo object for this modification.
((SequenceNode) node).setName(newname);
}
}
}
});
}
+
+ /**
+ * Formats a localised title for the tree panel, like
+ * <p>
+ * Neighbour Joining Using BLOSUM62
+ * <p>
+ * For a tree loaded from file, just uses the file name
+ *
+ * @return
+ */
+ public String getPanelTitle() // to be moved/fixed
+ {
+ if (treeTitle != null)
+ {
+ return treeTitle;
+ }
+ else
+ {
+ /*
+ * i18n description of Neighbour Joining or Average Distance method
+ */
+ String treecalcnm = MessageManager
+ .getString("label.tree_calc_" + treeType.toLowerCase());
+
+ /*
+ * short score model name (long description can be too long)
+ */
+ String smn = substitutionMatrix;
+
+ /*
+ * put them together as <method> Using <model>
+ */
+ final String ttl = MessageManager
+ .formatMessage("label.treecalc_title", treecalcnm, smn);
+ return ttl;
+ }
+ }
}