From: Jim Procter Date: Sat, 5 Oct 2013 13:01:00 +0000 (+0100) Subject: JAL-1379 graceful degradation to legacy service when JABAWS Jpred service not available X-Git-Tag: Jalview_2_9~200^2~19^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2cd5bc5cbec6a9abeb130ca118436abde8712c87;p=jalview.git JAL-1379 graceful degradation to legacy service when JABAWS Jpred service not available --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index ceb08ee..829b9ab 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -77,6 +77,7 @@ import jalview.schemes.UserColourScheme; import jalview.schemes.ZappoColourScheme; import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; +import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.seqfetcher.DbSourceProxy; import java.awt.BorderLayout; @@ -4158,6 +4159,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { + final List legacyItems=new ArrayList(); try { System.err.println("Building ws menu again " @@ -4189,28 +4191,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // TODO: refactor to allow list of AbstractName/Handler bindings to // be // stored or retrieved from elsewhere - Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS"); + // No MSAWS used any more: + // Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS"); Vector secstrpr = (Vector) Discoverer.services .get("SecStrPred"); - Vector seqsrch = null; // (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) - if (msaws != null) - { - // Add any Multiple Sequence Alignment Services - for (int i = 0, j = msaws.size(); i < j; i++) - { - final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws - .get(i); - jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer - .getServiceClient(sh); - impl.attachWSMenuEntry(msawsmenu, me); - - } - } if (secstrpr != null) { // Add any secondary structure prediction services @@ -4220,35 +4204,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .get(i); jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer .getServiceClient(sh); + int p=secstrmenu.getItemCount(); impl.attachWSMenuEntry(secstrmenu, me); - } - } - if (seqsrch != null) - { - // Add any sequence search services - for (int i = 0, j = seqsrch.size(); i < j; i++) - { - final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) seqsrch - .elementAt(i); - jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer - .getServiceClient(sh); - impl.attachWSMenuEntry(seqsrchmenu, me); + int q=secstrmenu.getItemCount(); + for (int litm=p;litm submens=new ArrayList(); - // submens.add(msawsmenu); - // submens.add(secstrmenu); - // submens.add(dismenu); - // submens.add(analymenu); - // No search services yet // wsmenu.add(seqsrchmenu); @@ -4273,6 +4245,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, webService.add(me.webServiceNoServices); } // TODO: move into separate menu builder class. + boolean new_sspred=false; if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer(); @@ -4281,6 +4254,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (jws2servs.hasServices()) { jws2servs.attachWSMenuEntry(webService, me); + for (Jws2Instance sv:jws2servs.getServices()) { + if (sv.description.toLowerCase().contains("jpred")) + { + for (JMenuItem jmi:legacyItems) + { + jmi.setVisible(false); + } + } + } + } if (jws2servs.isRunning()) { @@ -4291,7 +4274,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } } - build_urlServiceMenu(me.webService); build_fetchdbmenu(webService); for (JMenu item : wsmenu)