added centre annotation labels menu entry (and commented out SeqSearch web service...
[jalview.git] / src / jalview / gui / AlignFrame.java
index 6e7b15d..f536382 100755 (executable)
@@ -68,6 +68,8 @@ public class AlignFrame
    */
   String fileName = null;
 
+  
+
 
   /**
    * Creates a new AlignFrame object.
@@ -531,6 +533,7 @@ public class AlignFrame
     conservationMenuItem.setSelected(av.getConservationSelected());
     seqLimits.setSelected(av.getShowJVSuffix());
     idRightAlign.setSelected(av.rightAlignIds);
+    centreColumnLabelsMenuItem.setState(av.centreColumnLabels);
     renderGapsMenuItem.setSelected(av.renderGaps);
     wrapMenuItem.setSelected(av.wrapAlignment);
     scaleAbove.setVisible(av.wrapAlignment);
@@ -2187,6 +2190,12 @@ public class AlignFrame
     alignPanel.paintAlignment(true);
   }
 
+  public void centreColumnLabels_actionPerformed(ActionEvent e)
+  {
+    viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState();
+    alignPanel.paintAlignment(true);
+  }
+
 
 
   /**
@@ -3454,6 +3463,7 @@ public class AlignFrame
       // TODO: refactor to allow list of AbstractName/Handler bindings to be stored or retrieved from elsewhere
       Vector msaws = (Vector) Discoverer.services.get("MsaWS");
       Vector secstrpr = (Vector) Discoverer.services.get("SecStrPred");
+      Vector seqsrch = (Vector) Discoverer.services.get("SeqSearch");
       // TODO: move GUI generation code onto service implementation - so a client instance attaches itself to the GUI with method call like jalview.ws.MsaWSClient.bind(servicehandle, Desktop.instance, alignframe)
       Vector wsmenu = new Vector();
       final AlignFrame af = this;
@@ -3538,6 +3548,80 @@ public class AlignFrame
           secstrmenu.add(method);
         }
         wsmenu.add(secstrmenu);
+/*      }
+      if (seqsrch!=null)
+      {
+        // Add any secondary structure prediction services
+        final JMenu seqsrchmenu = new JMenu("Sequence Database Search");
+        Hashtable dbsrchs = new Hashtable();
+        JMenu defmenu;
+        dbsrchs.put("<default>", defmenu = new JMenu("Default Database"));
+        for (int i = 0, j = seqsrch.size(); i < j; i++)
+        {
+          final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle)
+              seqsrch.elementAt(i);
+          
+          String dbs[] = null;
+          try {
+            dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases();
+          } catch (Exception e)
+          {
+            jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e);
+            continue;
+          }
+          JMenuItem method;
+          // do default entry
+          defmenu.add(method = new JMenuItem(sh.getName()));
+          method.addActionListener(new ActionListener()
+          {
+            public void actionPerformed(ActionEvent e)
+            {
+              // use same input gatherer as for secondary structure prediction
+              // we could actually parameterise the gatherer method here...
+              AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
+              new jalview.ws.SeqSearchWSClient(sh, title, msa, null, 
+                      viewport.getAlignment().getDataset(),
+                      af);
+              }
+            }
+          );
+          // add entry for each database the service supports
+          for (int db=0; dbs!=null && db<dbs.length; db++)
+          {
+            JMenu dbmenu = (JMenu) dbsrchs.get(dbs[db]);
+            if (dbmenu==null)
+            {
+              dbsrchs.put(dbs[db], dbmenu = new JMenu(dbs[db]));
+            }
+            // add the client handler code for this service
+            dbmenu.add(method = new JMenuItem(sh.getName()));
+            final String searchdb = dbs[db];
+            method.addActionListener(new ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
+                new jalview.ws.SeqSearchWSClient(sh, title, msa, searchdb, 
+                          viewport.getAlignment().getDataset(),
+                          af);
+              }
+            });
+          }
+        }
+        // add the databases onto the seqsearch menu
+        Enumeration e = dbsrchs.elements();
+        while (e.hasMoreElements())
+        {
+          Object el = e.nextElement();
+          if (el instanceof JMenu)
+          {
+            seqsrchmenu.add((JMenu) el);
+          } else {
+            seqsrchmenu.add((JMenuItem) el);
+          }
+        }
+        // finally, add the whole shebang onto the webservices menu
+        wsmenu.add(seqsrchmenu); */
       }
       resetWebServiceMenu();
       for (int i = 0, j = wsmenu.size(); i < j; i++)