From: Jim Procter Date: Mon, 23 Jul 2018 10:27:29 +0000 (+0100) Subject: JAL-3070 refactored JABAWS specific jalview.gui.WsJobParameters main method - this... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=18b1b42e14075d9381f2fdc77be0ad591d24584e;p=jalview.git JAL-3070 refactored JABAWS specific jalview.gui.WsJobParameters main method - this looks to be a duplicate of Jws2ParamView which is already marked as an interactive test so needs review --- diff --git a/src/jalview/ws/jws2/JabaWsParamTest.java b/src/jalview/ws/jws2/JabaWsParamTest.java new file mode 100644 index 0000000..8c57529 --- /dev/null +++ b/src/jalview/ws/jws2/JabaWsParamTest.java @@ -0,0 +1,262 @@ +package jalview.ws.jws2; + +import jalview.gui.WsJobParameters; +import jalview.util.MessageManager; +import jalview.ws.jws2.jabaws2.Jws2Instance; + +import java.awt.BorderLayout; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.swing.JFrame; +import javax.swing.JPanel; + +import compbio.metadata.Option; +import compbio.metadata.Parameter; +import compbio.metadata.Preset; +import compbio.metadata.PresetManager; + +public class JabaWsParamTest +{ + + /** + * testing method - grab a service and parameter set and show the window + * + * @param args + */ + public static void main(String[] args) + { + jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer + .getDiscoverer(); + int p = 0; + if (args.length > 0) + { + Vector services = new Vector<>(); + services.addElement(args[p++]); + Jws2Discoverer.getDiscoverer().setServiceUrls(services); + } + try + { + disc.run(); + } catch (Exception e) + { + System.err.println("Aborting. Problem discovering services."); + e.printStackTrace(); + return; + } + Jws2Instance lastserv = null; + for (Jws2Instance service : disc.getServices()) + { + lastserv = service; + if (p >= args.length || service.getName().equalsIgnoreCase(args[p])) + { + if (lastserv != null) + { + List prl = null; + Preset pr = null; + if (++p < args.length) + { + PresetManager prman = lastserv.getPresets(); + if (prman != null) + { + pr = prman.getPresetByName(args[p]); + if (pr == null) + { + // just grab the last preset. + prl = prman.getPresets(); + } + } + } + else + { + PresetManager prman = lastserv.getPresets(); + if (prman != null) + { + prl = prman.getPresets(); + } + } + Iterator en = (prl == null) ? null : prl.iterator(); + while (en != null && en.hasNext()) + { + if (en != null) + { + if (!en.hasNext()) + { + en = prl.iterator(); + } + pr = en.next(); + } + { + System.out.println("Testing opts dupes for " + + lastserv.getUri() + " : " + lastserv.getActionText() + + ":" + pr.getName()); + List