X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws2%2FJws2Discoverer.java;h=8e298178006e16b8baa47f800ab1dd76af783aed;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=dda8c4e5c7508c0244e7e0f58e4f039c04a795de;hpb=66eff479b11806bdcb0852c52344e9a520990921;p=jalview.git diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index dda8c4e..8e29817 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * + * 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. + * + * 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 . + */ package jalview.ws.jws2; import java.awt.Color; @@ -164,8 +181,10 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI + srv.toString()); Jws2Instance service = new Jws2Instance(jwsservers, srv.toString(), service2); - services.add(service); - service.getParamStore(); + services.add(service); + // retrieve the presets and parameter set and cache now + service.getParamStore().getPresets(); + service.hasParameters(); } public class Jws2Instance @@ -280,7 +299,24 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI public String getUri() { // this is only valid for Jaba 1.0 - this formula might have to change! - return hosturl+"/"+serviceType; + return hosturl+(hosturl.lastIndexOf("/")==(hosturl.length()-1) ? "/" : "") +serviceType; + } + private boolean hasParams=false,lookedForParams=false; + + public boolean hasParameters() + { + if (!lookedForParams) + { + lookedForParams=true; + try + { + hasParams = (getRunnerConfig().getArguments().size() > 0); + } catch (Exception e) + { + + } + } + return hasParams; } }; @@ -320,7 +356,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame) { // dynamically regenerate service list. - final JMenu jws2al = new JMenu("JABA Alignment"); + final JMenu jws2al = new JMenu("JABAWS Alignment"); jws2al.addMenuListener(new MenuListener() { // TODO: future: add menu listener to parent menu - so submenus are @@ -366,6 +402,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI MsaWSClient msacl = new MsaWSClient(); Vector hostLabels = new Vector(); jws2al.removeAll(); + String lasthost=null; for (final Jws2Instance service : services) { atpoint = jws2al; @@ -387,16 +424,22 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI atpoint.setToolTipText(service.getActionText()); } } - if (!byhost && !hostLabels.contains(host + service.getActionText())) + if (!byhost && !hostLabels.contains(host + service.serviceType+service.getActionText())) + //!hostLabels.contains(host + (bytype ? service.serviceType+service.getActionText() : ""))) { // add a marker indicating where this service is hosted // relies on services from the same host being listed in a contiguous // group JMenuItem hitm; atpoint.addSeparator(); - atpoint.add(hitm = new JMenuItem(host)); - hitm.setForeground(Color.blue); - hostLabels.addElement(host); + if (lasthost==null || !lasthost.equals(host)) + { + atpoint.add(hitm = new JMenuItem(host)); + hitm.setForeground(Color.blue); + lasthost = host; + } + hostLabels.addElement(host + service.serviceType+service.getActionText() ); + // hostLabels.addElement(host + (bytype ? service.serviceType+service.getActionText() : "")); } msacl.attachWSMenuEntry(atpoint, service, alignFrame); /*