2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
20 import java.awt.FlowLayout;
21 import java.awt.Frame;
22 import java.awt.event.ActionEvent;
23 import java.awt.event.ActionListener;
24 import java.io.BufferedReader;
26 import java.io.FileOutputStream;
27 import java.io.IOException;
28 import java.io.OutputStreamWriter;
29 import java.io.PrintWriter;
30 import java.lang.reflect.Constructor;
31 import java.net.MalformedURLException;
34 import java.net.URLDecoder;
35 import java.security.AllPermission;
36 import java.security.CodeSource;
37 import java.security.PermissionCollection;
38 import java.security.Permissions;
39 import java.security.Policy;
45 import jalview.util.Platform;
48 * Main class for Jalview Application <br>
50 * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview
59 // grab all the rights we can the JVM
60 Policy.setPolicy(new Policy()
62 public PermissionCollection getPermissions(CodeSource codesource)
64 Permissions perms = new Permissions();
65 perms.add(new AllPermission());
74 protected static boolean proteine;
77 * main class for Jalview application
80 * open <em>filename</em>
82 public static void main(String[] args)
84 System.out.println("Java version: "
85 + System.getProperty("java.version"));
86 System.out.println(System.getProperty("os.arch") + " "
87 + System.getProperty("os.name") + " "
88 + System.getProperty("os.version"));
89 if (new Platform().isAMac())
91 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
93 System.setProperty("apple.laf.useScreenMenuBar", "true");
96 ArgsParser aparser = new ArgsParser(args);
97 boolean headless = false;
99 if (aparser.contains("help") || aparser.contains("h"))
102 .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
103 + "-nodisplay\tRun Jalview without User Interface.\n"
104 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
105 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
106 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
107 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
108 + "-features FILE\tUse the given file to mark features on the alignment.\n"
109 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
110 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
111 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
112 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
113 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
114 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
115 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
116 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
117 + "-png FILE\tCreate PNG image FILE from alignment.\n"
118 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
119 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
120 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
121 + "-noquestionnaire\tTurn off questionnaire check.\n"
122 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
123 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
125 // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
126 + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
127 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
128 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
129 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
131 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
132 // + "-vses vamsas-session\tJoin session with given URN\n"
133 + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
134 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
137 Cache.loadProperties(aparser.getValue("props")); // must do this before
139 String defs = aparser.getValue("setprop");
142 int p = defs.indexOf('=');
145 System.err.println("Ignoring invalid setprop argument : " + defs);
149 System.out.println("Executing setprop argument: " + defs);
150 // DISABLED FOR SECURITY REASONS
151 // TODO: add a property to allow properties to be overriden by cli args
152 // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
154 defs = aparser.getValue("setprop");
156 if (aparser.contains("nodisplay"))
158 System.setProperty("java.awt.headless", "true");
160 if (System.getProperty("java.awt.headless") != null
161 && System.getProperty("java.awt.headless").equals("true"))
169 } catch (java.lang.NoClassDefFoundError error)
171 error.printStackTrace();
173 .println("\nEssential logging libraries not found."
174 + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
178 Desktop desktop = null;
182 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
183 } catch (Exception ex)
189 desktop = new Desktop();
190 desktop.setInBatchMode(true); // indicate we are starting up
191 desktop.setVisible(true);
192 desktop.startServiceDiscovery();
193 if (!aparser.contains("nousagestats"))
195 startUsageStats(desktop);
197 if (!aparser.contains("noquestionnaire"))
199 String url = aparser.getValue("questionnaire");
202 // Start the desktop questionnaire prompter with the specified
204 Cache.log.debug("Starting questionnaire url at " + url);
205 desktop.checkForQuestionnaire(url);
209 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
211 // Start the desktop questionnaire prompter with the specified
214 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
216 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
217 Cache.log.debug("Starting questionnaire with default url: "
219 desktop.checkForQuestionnaire(defurl);
226 String file = null, protocol = null, format = null, data = null;
227 jalview.io.FileLoader fileLoader = new jalview.io.FileLoader();
228 Vector getFeatures = null; // vector of das source nicknames to fetch
231 String groovyscript = null; // script to execute after all loading is
232 // completed one way or another
233 // extract groovy argument and execute if necessary
234 groovyscript = aparser.getValue("groovy", true);
235 file = aparser.getValue("open", true);
237 if (file == null && desktop == null)
239 System.out.println("No files to open!");
242 String vamsasImport = aparser.getValue("vdoc"), vamsasSession = aparser
244 if (vamsasImport != null || vamsasSession != null)
246 if (desktop == null || headless)
249 .println("Headless vamsas sessions not yet supported. Sorry.");
252 // if we have a file, start a new session and import it.
253 boolean inSession = false;
254 if (vamsasImport != null)
258 String viprotocol = jalview.io.AppletFormatAdapter
259 .checkProtocol(vamsasImport);
260 if (viprotocol == jalview.io.FormatAdapter.FILE)
262 inSession = desktop.vamsasImport(new File(vamsasImport));
264 else if (viprotocol == jalview.io.FormatAdapter.URL)
266 inSession = desktop.vamsasImport(new URL(vamsasImport));
269 } catch (Exception e)
271 System.err.println("Exeption when importing " + vamsasImport
272 + " as a vamsas document.");
277 System.err.println("Failed to import " + vamsasImport
278 + " as a vamsas document.");
282 System.out.println("Imported Successfully into new session "
283 + desktop.getVamsasApplication().getCurrentSession());
286 if (vamsasSession != null)
288 if (vamsasImport != null)
290 // close the newly imported session and import the Jalview specific
291 // remnants into the new session later on.
292 desktop.vamsasStop_actionPerformed(null);
294 // now join the new session
297 if (desktop.joinVamsasSession(vamsasSession))
299 System.out.println("Successfully joined vamsas session "
304 System.err.println("WARNING: Failed to join vamsas session "
307 } catch (Exception e)
309 System.err.println("ERROR: Failed to join vamsas session "
313 if (vamsasImport != null)
315 // the Jalview specific remnants can now be imported into the new
316 // session at the user's leisure.
318 .info("Skipping Push for import of data into existing vamsas session."); // TODO:
323 // desktop.getVamsasApplication().push_update();
328 // Finally, deal with the remaining input data.
333 desktop.setProgressBar("Processing commandline arguments...",
334 progress = System.currentTimeMillis());
336 System.out.println("Opening file: " + file);
338 if (!file.startsWith("http://"))
340 if (!(new java.io.File(file)).exists())
342 System.out.println("Can't find " + file);
350 protocol = jalview.io.AppletFormatAdapter.checkProtocol(file);
352 format = new jalview.io.IdentifyFile().Identify(file, protocol);
354 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
358 System.out.println("error");
363 data = aparser.getValue("colour", true);
366 data.replaceAll("%20", " ");
368 jalview.schemes.ColourSchemeI cs = jalview.schemes.ColourSchemeProperty
369 .getColour(af.getViewport().getAlignment(), data);
373 jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(
375 ucs.parseAppletParameter(data);
379 System.out.println("colour is " + data);
383 // Must maintain ability to use the groups flag
384 data = aparser.getValue("groups", true);
387 af.parseFeaturesFile(data,
388 jalview.io.AppletFormatAdapter.checkProtocol(data));
389 System.out.println("Added " + data);
391 data = aparser.getValue("features", true);
394 af.parseFeaturesFile(data,
395 jalview.io.AppletFormatAdapter.checkProtocol(data));
396 System.out.println("Added " + data);
399 data = aparser.getValue("annotations", true);
402 af.loadJalviewDataFile(data, null, null, null);
403 System.out.println("Added " + data);
405 // set or clear the sortbytree flag.
406 if (aparser.contains("sortbytree"))
408 af.getViewport().setSortByTree(true);
410 if (aparser.contains("nosortbytree"))
412 af.getViewport().setSortByTree(false);
414 data = aparser.getValue("tree", true);
417 jalview.io.NewickFile fin = null;
420 fin = new jalview.io.NewickFile(data,
421 jalview.io.AppletFormatAdapter.checkProtocol(data));
424 af.getViewport().setCurrentTree(
425 af.ShowNewickTree(fin, data).getTree());
426 System.out.println("Added tree " + data);
428 } catch (IOException ex)
430 System.err.println("Couldn't add tree " + data);
431 ex.printStackTrace(System.err);
434 // TODO - load PDB structure(s) to alignment JAL-629
435 // (associate with identical sequence in alignment, or a specified
438 getFeatures = checkDasArguments(aparser);
439 if (af != null && getFeatures != null)
441 FeatureFetcher ff = startFeatureFetching(getFeatures);
443 while (!ff.allFinished() || af.operationInProgress())
445 // wait around until fetching is finished.
449 } catch (Exception e)
454 getFeatures = null; // have retrieved features - forget them now.
456 if (groovyscript != null)
458 // Execute the groovy script after we've done all the rendering stuff
459 // and before any images or figures are generated.
460 if (jalview.bin.Cache.groovyJarsPresent())
462 System.out.println("Executing script " + groovyscript);
463 executeGroovyScript(groovyscript, new Object[]
469 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
474 String imageName = "unnamed.png";
475 while (aparser.getSize() > 1)
477 format = aparser.nextValue();
478 file = aparser.nextValue();
480 if (format.equalsIgnoreCase("png"))
482 af.createPNG(new java.io.File(file));
483 imageName = (new java.io.File(file)).getName();
484 System.out.println("Creating PNG image: " + file);
487 else if (format.equalsIgnoreCase("imgMap"))
489 af.createImageMap(new java.io.File(file), imageName);
490 System.out.println("Creating image map: " + file);
493 else if (format.equalsIgnoreCase("eps"))
495 System.out.println("Creating EPS file: " + file);
496 af.createEPS(new java.io.File(file));
500 if (af.saveAlignment(file, format))
502 System.out.println("Written alignment in " + format
503 + " format to " + file);
507 System.out.println("Error writing file " + file + " in "
508 + format + " format!!");
513 while (aparser.getSize() > 0)
515 System.out.println("Unknown arg: " + aparser.nextValue());
519 AlignFrame startUpAlframe = null;
520 // We'll only open the default file if the desktop is visible.
522 // ////////////////////
524 JFrame Typechooser =new JFrame("choose molecule type");
525 FlowLayout fl = new FlowLayout();
526 Typechooser.setLayout(fl);
527 Typechooser.setSize(400,400);
528 Typechooser.setDefaultCloseOperation(Typechooser.DISPOSE_ON_CLOSE);
529 JLabel label = new JLabel("What would you open ? ");
530 JButton rnabutton = new JButton("RNA molecule");
531 JButton pbutton = new JButton("Proteine molecule");
533 pbutton.addActionListener(new pbuttonlistener());
534 rnabutton.addActionListener(new rnabuttonlistener());
535 Typechooser.getContentPane().add(label);
536 Typechooser.getContentPane().add(rnabutton);
537 Typechooser.getContentPane().add(pbutton);
538 Typechooser.setVisible(true);
543 if (!headless && file == null && vamsasImport == null
544 && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true) && proteine == true)
546 file = jalview.bin.Cache.getDefault(
548 jalview.bin.Cache.getDefault("www.jalview.org",
549 "http://www.jalview.org")
550 + "/examples/exampleFile_2_7.jar");
551 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
553 // hardwire upgrade of the startup file
554 file.replace("_2_3.jar", "_2_7.jar");
555 // and remove the stale setting
556 jalview.bin.Cache.removeProperty("STARTUP_FILE");
561 if (file.indexOf("http:") > -1)
566 if (file.endsWith(".jar"))
572 format = new jalview.io.IdentifyFile().Identify(file, protocol);
575 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
577 getFeatures = checkDasArguments(aparser);
578 // extract groovy arguments before anything else.
580 // If the user has specified features to be retrieved,
581 // or a groovy script to be executed, do them if they
582 // haven't been done already
583 // fetch features for the default alignment
584 if (getFeatures != null)
586 if (startUpAlframe != null)
588 startFeatureFetching(getFeatures);
591 // Once all other stuff is done, execute any groovy scripts (in order)
592 if (groovyscript != null)
594 if (jalview.bin.Cache.groovyJarsPresent())
596 System.out.println("Executing script " + groovyscript);
597 executeGroovyScript(groovyscript, new Object[]
598 { desktop, startUpAlframe });
603 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
607 // and finally, turn off batch mode indicator - if the desktop still exists
612 desktop.setProgressBar(null, progress);
614 desktop.setInBatchMode(false);
619 private static void startUsageStats(final Desktop desktop)
622 * start a User Config prompt asking if we can log usage statistics.
624 jalview.gui.PromptUserConfig prompter = new jalview.gui.PromptUserConfig(
627 "Jalview Usage Statistics",
628 "Do you want to help make Jalview better by enabling "
629 + "the collection of usage statistics with Google Analytics ?"
630 + "\n\n(you can enable or disable usage tracking in the preferences)",
636 .info("Initialising googletracker for usage stats.");
637 Cache.initGoogleTracker();
638 Cache.log.debug("Tracking enabled.");
644 Cache.log.info("Not enabling Google Tracking.");
647 SwingUtilities.invokeLater(prompter);
651 * Locate the given string as a file and pass it to the groovy interpreter.
653 * @param groovyscript
654 * the script to execute
655 * @param jalviewContext
656 * the Jalview Desktop object passed in to the groovy binding as the
659 private static void executeGroovyScript(String groovyscript,
660 Object[] jalviewContext)
662 if (jalviewContext == null)
665 .println("Sorry. Groovy support is currently only available when running with the Jalview GUI enabled.");
668 * for scripts contained in files
675 if (groovyscript.trim().equals("STDIN"))
677 // read from stdin into a tempfile and execute it
680 tfile = File.createTempFile("jalview", "groovy");
681 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
682 new FileOutputStream(tfile)));
683 BufferedReader br = new BufferedReader(
684 new java.io.InputStreamReader(System.in));
686 while ((line = br.readLine()) != null)
688 outfile.write(line + "\n");
694 } catch (Exception ex)
696 System.err.println("Failed to read from STDIN into tempfile "
697 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
699 ex.printStackTrace();
704 sfile = tfile.toURI().toURL();
705 } catch (Exception x)
708 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
718 sfile = new URI(groovyscript).toURL();
719 } catch (Exception x)
721 tfile = new File(groovyscript);
724 System.err.println("File '" + groovyscript + "' does not exist.");
727 if (!tfile.canRead())
729 System.err.println("File '" + groovyscript + "' cannot be read.");
732 if (tfile.length() < 1)
734 System.err.println("File '" + groovyscript + "' is empty.");
739 sfile = tfile.getAbsoluteFile().toURI().toURL();
740 } catch (Exception ex)
742 System.err.println("Failed to create a file URL for "
743 + tfile.getAbsoluteFile());
748 boolean success = false;
752 * The following code performs the GroovyScriptEngine invocation using
753 * reflection, and is equivalent to this fragment from the embedding
754 * groovy documentation on the groovy site: <code> import
755 * groovy.lang.Binding; import groovy.util.GroovyScriptEngine;
757 * String[] roots = new String[] { "/my/groovy/script/path" };
758 * GroovyScriptEngine gse = new GroovyScriptEngine(roots); Binding binding
759 * = new Binding(); binding.setVariable("input", "world");
760 * gse.run("hello.groovy", binding); </code>
764 int blen = ((jalviewContext[0] == null) ? 0 : 1)
765 + ((jalviewContext[1] == null) ? 0 : 1);
766 String cnames[] = new String[]
767 { "Jalview", "currentAlFrame" };
768 bspec = new Class[blen * 2];
769 binding = new Object[blen * 2];
771 ClassLoader cl = null;
772 Map vbinding = new Hashtable();
773 for (int jc = 0; jc < jalviewContext.length; jc++)
775 if (jalviewContext[jc] != null)
779 cl = jalviewContext[jc].getClass().getClassLoader();
781 bspec[blen * 2] = String.class;
782 bspec[blen * 2 + 1] = Object.class;
783 binding[blen * 2] = cnames[jc];
784 binding[blen * 2 + 1] = jalviewContext[jc];
785 vbinding.put(cnames[jc], jalviewContext[jc]);
789 Class gbindingc = cl.loadClass("groovy.lang.Binding");
794 gbcons = gbindingc.getConstructor(Map.class);
795 gbinding = gbcons.newInstance(vbinding);
796 } catch (NoSuchMethodException x)
798 // old style binding config - using series of string/object values to
800 gbcons = gbindingc.getConstructor(null);
801 gbinding = gbcons.newInstance(null);
802 java.lang.reflect.Method setvar = gbindingc.getMethod(
803 "setVariable", bspec);
804 setvar.invoke(gbinding, binding);
807 Class gsec = cl.loadClass("groovy.util.GroovyScriptEngine");
808 Constructor gseccons = gsec.getConstructor(new Class[]
809 { URL[].class }); // String[].class });
810 Object gse = gseccons.newInstance(new Object[]
812 { sfile } }); // .toString() } });
813 java.lang.reflect.Method run = gsec.getMethod("run", new Class[]
814 { String.class, gbindingc });
815 run.invoke(gse, new Object[]
816 { sfile.toString(), gbinding });
818 } catch (Exception e)
820 System.err.println("Exception Whilst trying to execute file " + sfile
821 + " as a groovy script.");
822 e.printStackTrace(System.err);
825 if (success && groovyscript.equals("STDIN"))
827 // delete temp file that we made - but only if it was successfully
834 * Check commandline for any das server definitions or any fetchfrom switches
836 * @return vector of DAS source nicknames to retrieve from
838 private static Vector checkDasArguments(ArgsParser aparser)
840 Vector source = null;
842 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
843 while ((data = aparser.getValue("dasserver", true)) != null)
845 String nickname = null;
847 boolean seq = false, feat = true;
848 int pos = data.indexOf('=');
849 // determine capabilities
852 nickname = data.substring(0, pos);
854 url = data.substring(pos + 1);
856 && (url.startsWith("http:") || url
857 .startsWith("sequence:http:")))
859 if (nickname == null)
863 if (locsources == null)
871 locsources = locsources + nickname + "|" + url;
873 .println("NOTE! dasserver parameter not yet really supported (got args of "
874 + nickname + "|" + url);
877 source = new Vector();
879 source.addElement(nickname);
881 } // loop until no more server entries are found.
882 if (locsources != null && locsources.indexOf('|') > -1)
884 Cache.log.debug("Setting local source list in properties file to:\n"
886 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
888 while ((data = aparser.getValue("fetchfrom", true)) != null)
890 System.out.println("adding source '" + data + "'");
893 source = new Vector();
895 source.addElement(data);
901 * start a feature fetcher for every alignment frame
905 private static FeatureFetcher startFeatureFetching(final Vector dasSources)
907 FeatureFetcher ff = new FeatureFetcher();
908 AlignFrame afs[] = Desktop.getAlignframes();
909 if (afs == null || afs.length == 0)
913 for (int i = 0; i < afs.length; i++)
915 ff.addFetcher(afs[i], dasSources);
922 * Notes: this argParser does not distinguish between parameter switches,
923 * parameter values and argument text. If an argument happens to be identical to
924 * a parameter, it will be taken as such (even though it didn't have a '-'
927 * @author Andrew Waterhouse and JBP documented.
931 class rnabuttonlistener implements ActionListener{
932 public void actionPerformed(ActionEvent arg0) {
933 System.out.println("Good idea ! ");
938 class pbuttonlistener implements ActionListener{
939 public void actionPerformed(ActionEvent arg0) {
949 public ArgsParser(String[] args)
951 vargs = new Vector();
952 for (int i = 0; i < args.length; i++)
954 String arg = args[i].trim();
955 if (arg.charAt(0) == '-')
957 arg = arg.substring(1);
959 vargs.addElement(arg);
964 * check for and remove first occurence of arg+parameter in arglist.
967 * @return return the argument following the given arg if arg was in list.
969 public String getValue(String arg)
971 return getValue(arg, false);
974 public String getValue(String arg, boolean utf8decode)
976 int index = vargs.indexOf(arg);
977 String dc = null, ret = null;
980 ret = vargs.elementAt(index + 1).toString();
981 vargs.removeElementAt(index);
982 vargs.removeElementAt(index);
983 if (utf8decode && ret != null)
987 dc = URLDecoder.decode(ret, "UTF-8");
989 } catch (Exception e)
991 // TODO: log failure to decode
999 * check for and remove first occurence of arg in arglist.
1002 * @return true if arg was present in argslist.
1004 public boolean contains(String arg)
1006 if (vargs.contains(arg))
1008 vargs.removeElement(arg);
1017 public String nextValue()
1019 return vargs.remove(0).toString();
1022 public int getSize()
1024 return vargs.size();
1030 * keep track of feature fetching tasks.
1035 class FeatureFetcher
1038 * TODO: generalise to track all jalview events to orchestrate batch
1039 * processing events.
1042 private int queued = 0;
1044 private int running = 0;
1046 public FeatureFetcher()
1051 public void addFetcher(final AlignFrame af, final Vector dasSources)
1053 final long id = System.currentTimeMillis();
1055 final FeatureFetcher us = this;
1056 new Thread(new Runnable()
1067 af.setProgressBar("DAS features being retrieved...", id);
1068 af.featureSettings_actionPerformed(null);
1069 af.featureSettings.fetchDasFeatures(dasSources, true);
1070 af.setProgressBar(null, id);
1079 public synchronized boolean allFinished()
1081 return queued == 0 && running == 0;