From 02352c04c99e9deca64bba0ef6bf0b643ea16263 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 4 Nov 2005 10:55:28 +0000 Subject: [PATCH] Display full id in trees --- src/jalview/gui/TreePanel.java | 30 ++++++++++++++++++++++++++++++ src/jalview/jbgui/GTreePanel.java | 15 +++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 04be0fd..7677cf8 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -153,6 +153,7 @@ public class TreePanel extends GTreePanel // update distance/bootstrap visibility at the same time showBootstrap(newtree.HasBootstrap()); showDistances(newtree.HasDistances()); + showPlaceholders(true); } } @@ -169,7 +170,14 @@ public class TreePanel extends GTreePanel treeCanvas.repaint(); + + fullid.setState(treeCanvas.av.showDBPrefix); + if(!treeCanvas.av.showDBPrefix) + { + fullid_actionPerformed(null); + } } + } public void showDistances(boolean b) @@ -354,6 +362,28 @@ public class TreePanel extends GTreePanel treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected()); } + + public void fullid_actionPerformed(ActionEvent e) + { + tree.findHeight(tree.getTopNode()); + + // Now have to calculate longest name based on the leaves + Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector()); + + treeCanvas.longestName=""; + for (int i = 0; i < leaves.size(); i++) + { + SequenceNode lf = (SequenceNode) leaves.elementAt(i); + Sequence seq = (Sequence) lf.element(); + lf.setName(seq.getDisplayId(fullid.getState(), false)); + if(lf.getName().length() > treeCanvas.longestName.length()) + treeCanvas.longestName = lf.getName(); + } + + treeCanvas.repaint(); + } + + /** * DOCUMENT ME! * diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index 4301a75..8fb952d 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -41,6 +41,7 @@ public class GTreePanel JMenuItem epsTree = new JMenuItem(); JMenu saveAsMenu = new JMenu(); JMenuItem textbox = new JMenuItem(); + protected JCheckBoxMenuItem fullid = new JCheckBoxMenuItem(); public GTreePanel() { @@ -148,6 +149,14 @@ public class GTreePanel textbox_actionPerformed(e); } }); + fullid.setText("Show Full Sequence Id"); + fullid.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + fullid_actionPerformed(e); + } + }); this.getContentPane().add(scrollPane, BorderLayout.CENTER); jMenuBar1.add(jMenu1); jMenuBar1.add(jMenu2); @@ -159,6 +168,7 @@ public class GTreePanel jMenu2.add(distanceMenu); jMenu2.add(bootstrapMenu); jMenu2.add(placeholdersMenu); + jMenu2.add(fullid); saveAsMenu.add(saveAsNewick); saveAsMenu.add(epsTree); saveAsMenu.add(pngTree); @@ -203,4 +213,9 @@ public class GTreePanel public void textbox_actionPerformed(ActionEvent e) { } + + public void fullid_actionPerformed(ActionEvent e) + { + + } } -- 1.7.10.2