Display full id in trees
authoramwaterhouse <Andrew Waterhouse>
Fri, 4 Nov 2005 10:55:28 +0000 (10:55 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 4 Nov 2005 10:55:28 +0000 (10:55 +0000)
src/jalview/gui/TreePanel.java
src/jalview/jbgui/GTreePanel.java

index 04be0fd..7677cf8 100755 (executable)
@@ -153,6 +153,7 @@ public class TreePanel extends GTreePanel
           // update distance/bootstrap visibility at the same time\r
           showBootstrap(newtree.HasBootstrap());\r
           showDistances(newtree.HasDistances());\r
+          showPlaceholders(true);\r
         }\r
       }\r
 \r
@@ -169,7 +170,14 @@ public class TreePanel extends GTreePanel
 \r
         treeCanvas.repaint();\r
 \r
+\r
+        fullid.setState(treeCanvas.av.showDBPrefix);\r
+        if(!treeCanvas.av.showDBPrefix)\r
+        {\r
+          fullid_actionPerformed(null);\r
+        }\r
       }\r
+\r
     }\r
 \r
     public void showDistances(boolean b)\r
@@ -354,6 +362,28 @@ public class TreePanel extends GTreePanel
         treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());\r
     }\r
 \r
+\r
+    public void fullid_actionPerformed(ActionEvent e)\r
+    {\r
+      tree.findHeight(tree.getTopNode());\r
+\r
+      // Now have to calculate longest name based on the leaves\r
+      Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector());\r
+\r
+      treeCanvas.longestName="";\r
+      for (int i = 0; i < leaves.size(); i++)\r
+      {\r
+        SequenceNode lf = (SequenceNode) leaves.elementAt(i);\r
+        Sequence seq = (Sequence) lf.element();\r
+        lf.setName(seq.getDisplayId(fullid.getState(), false));\r
+        if(lf.getName().length() > treeCanvas.longestName.length())\r
+          treeCanvas.longestName = lf.getName();\r
+      }\r
+\r
+      treeCanvas.repaint();\r
+    }\r
+\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
index 4301a75..8fb952d 100755 (executable)
@@ -41,6 +41,7 @@ public class GTreePanel
   JMenuItem epsTree = new JMenuItem();\r
   JMenu saveAsMenu = new JMenu();\r
   JMenuItem textbox = new JMenuItem();\r
+  protected JCheckBoxMenuItem fullid = new JCheckBoxMenuItem();\r
 \r
   public GTreePanel()\r
   {\r
@@ -148,6 +149,14 @@ public class GTreePanel
         textbox_actionPerformed(e);\r
       }\r
     });\r
+    fullid.setText("Show Full Sequence Id");\r
+    fullid.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        fullid_actionPerformed(e);\r
+      }\r
+    });\r
     this.getContentPane().add(scrollPane, BorderLayout.CENTER);\r
     jMenuBar1.add(jMenu1);\r
     jMenuBar1.add(jMenu2);\r
@@ -159,6 +168,7 @@ public class GTreePanel
     jMenu2.add(distanceMenu);\r
     jMenu2.add(bootstrapMenu);\r
     jMenu2.add(placeholdersMenu);\r
+    jMenu2.add(fullid);\r
     saveAsMenu.add(saveAsNewick);\r
     saveAsMenu.add(epsTree);\r
     saveAsMenu.add(pngTree);\r
@@ -203,4 +213,9 @@ public class GTreePanel
   public void textbox_actionPerformed(ActionEvent e)\r
   {\r
   }\r
+\r
+  public void fullid_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
 }\r