2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import groovy.lang.Binding;
24 import groovy.util.GroovyScriptEngine;
26 import jalview.gui.AlignFrame;
27 import jalview.gui.Desktop;
28 import jalview.gui.PromptUserConfig;
29 import jalview.io.AppletFormatAdapter;
30 import jalview.io.BioJsHTMLOutput;
31 import jalview.io.DataSourceType;
32 import jalview.io.FileFormat;
33 import jalview.io.FileFormatException;
34 import jalview.io.FileFormatI;
35 import jalview.io.FileLoader;
36 import jalview.io.HtmlSvgOutput;
37 import jalview.io.IdentifyFile;
38 import jalview.io.NewickFile;
39 import jalview.schemes.ColourSchemeI;
40 import jalview.schemes.ColourSchemeProperty;
41 import jalview.schemes.UserColourScheme;
42 import jalview.util.MessageManager;
43 import jalview.util.Platform;
44 import jalview.ws.jws2.Jws2Discoverer;
46 import java.io.BufferedReader;
48 import java.io.FileOutputStream;
49 import java.io.IOException;
50 import java.io.InputStreamReader;
51 import java.io.OutputStreamWriter;
52 import java.io.PrintWriter;
53 import java.net.MalformedURLException;
56 import java.security.AllPermission;
57 import java.security.CodeSource;
58 import java.security.PermissionCollection;
59 import java.security.Permissions;
60 import java.security.Policy;
61 import java.util.HashMap;
63 import java.util.Vector;
65 import javax.swing.UIManager;
68 * Main class for Jalview Application <br>
70 * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview
78 * singleton instance of this class
80 private static Jalview instance;
82 private Desktop desktop;
84 public static AlignFrame currentAlignFrame;
88 // grab all the rights we can the JVM
89 Policy.setPolicy(new Policy()
92 public PermissionCollection getPermissions(CodeSource codesource)
94 Permissions perms = new Permissions();
95 perms.add(new AllPermission());
100 public void refresh()
107 * keep track of feature fetching tasks.
115 * TODO: generalise to track all jalview events to orchestrate batch
119 private int queued = 0;
121 private int running = 0;
123 public FeatureFetcher()
128 public void addFetcher(final AlignFrame af,
129 final Vector<String> dasSources)
131 final long id = System.currentTimeMillis();
133 final FeatureFetcher us = this;
134 new Thread(new Runnable()
146 af.setProgressBar(MessageManager
147 .getString("status.das_features_being_retrived"), id);
148 af.featureSettings_actionPerformed(null);
149 af.featureSettings.fetchDasFeatures(dasSources, true);
150 af.setProgressBar(null, id);
159 public synchronized boolean allFinished()
161 return queued == 0 && running == 0;
166 public static Jalview getInstance()
172 * main class for Jalview application
175 * open <em>filename</em>
177 public static void main(String[] args)
179 instance = new Jalview();
180 instance.doMain(args);
186 void doMain(String[] args)
188 System.setSecurityManager(null);
189 System.out.println("Java version: "
190 + System.getProperty("java.version"));
191 System.out.println(System.getProperty("os.arch") + " "
192 + System.getProperty("os.name") + " "
193 + System.getProperty("os.version"));
195 ArgsParser aparser = new ArgsParser(args);
196 boolean headless = false;
198 if (aparser.contains("help") || aparser.contains("h"))
203 if (aparser.contains("nodisplay") || aparser.contains("nogui")
204 || aparser.contains("headless"))
206 System.setProperty("java.awt.headless", "true");
209 String usrPropsFile = aparser.getValue("props");
210 Cache.loadProperties(usrPropsFile); // must do this before
211 if (usrPropsFile != null)
213 System.out.println("CMD [-props " + usrPropsFile
214 + "] executed successfully!");
219 final String jabawsUrl = aparser.getValue("jabaws");
220 if (jabawsUrl != null)
224 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
225 System.out.println("CMD [-jabaws " + jabawsUrl
226 + "] executed successfully!");
227 } catch (MalformedURLException e)
229 System.err.println("Invalid jabaws parameter: " + jabawsUrl
234 String defs = aparser.getValue("setprop");
237 int p = defs.indexOf('=');
240 System.err.println("Ignoring invalid setprop argument : " + defs);
244 System.out.println("Executing setprop argument: " + defs);
245 // DISABLED FOR SECURITY REASONS
246 // TODO: add a property to allow properties to be overriden by cli args
247 // Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
249 defs = aparser.getValue("setprop");
251 if (System.getProperty("java.awt.headless") != null
252 && System.getProperty("java.awt.headless").equals("true"))
256 System.setProperty("http.agent",
257 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
261 } catch (NoClassDefFoundError error)
263 error.printStackTrace();
265 .println("\nEssential logging libraries not found."
266 + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview");
274 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
275 } catch (Exception ex)
278 if (Platform.isAMac())
280 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
282 System.setProperty("apple.laf.useScreenMenuBar", "true");
285 UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager
287 } catch (Throwable e)
289 System.err.println("Failed to set QuaQua look and feel: "
296 desktop = new Desktop();
297 desktop.setInBatchMode(true); // indicate we are starting up
298 desktop.setVisible(true);
299 desktop.startServiceDiscovery();
300 if (!aparser.contains("nousagestats"))
302 startUsageStats(desktop);
306 System.err.println("CMD [-nousagestats] executed successfully!");
309 if (!aparser.contains("noquestionnaire"))
311 String url = aparser.getValue("questionnaire");
314 // Start the desktop questionnaire prompter with the specified
316 Cache.log.debug("Starting questionnaire url at " + url);
317 desktop.checkForQuestionnaire(url);
318 System.out.println("CMD questionnaire[-" + url
319 + "] executed successfully!");
323 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
325 // Start the desktop questionnaire prompter with the specified
328 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
330 String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
331 Cache.log.debug("Starting questionnaire with default url: "
333 desktop.checkForQuestionnaire(defurl);
340 System.err.println("CMD [-noquestionnaire] executed successfully!");
342 desktop.checkForNews();
345 if (!isHeadlessMode())
347 BioJsHTMLOutput.updateBioJS();
350 String file = null, data = null;
351 FileFormatI format = null;
352 DataSourceType protocol = null;
353 FileLoader fileLoader = new FileLoader(!headless);
354 Vector<String> getFeatures = null; // vector of das source nicknames to
358 String groovyscript = null; // script to execute after all loading is
359 // completed one way or another
360 // extract groovy argument and execute if necessary
361 groovyscript = aparser.getValue("groovy", true);
362 file = aparser.getValue("open", true);
364 if (file == null && desktop == null)
366 System.out.println("No files to open!");
369 String vamsasImport = aparser.getValue("vdoc");
370 String vamsasSession = aparser.getValue("vsess");
371 if (vamsasImport != null || vamsasSession != null)
373 if (desktop == null || headless)
376 .println("Headless vamsas sessions not yet supported. Sorry.");
379 // if we have a file, start a new session and import it.
380 boolean inSession = false;
381 if (vamsasImport != null)
385 DataSourceType viprotocol = AppletFormatAdapter
386 .checkProtocol(vamsasImport);
387 if (viprotocol == DataSourceType.FILE)
389 inSession = desktop.vamsasImport(new File(vamsasImport));
391 else if (viprotocol == DataSourceType.URL)
393 inSession = desktop.vamsasImport(new URL(vamsasImport));
396 } catch (Exception e)
398 System.err.println("Exeption when importing " + vamsasImport
399 + " as a vamsas document.");
404 System.err.println("Failed to import " + vamsasImport
405 + " as a vamsas document.");
409 System.out.println("Imported Successfully into new session "
410 + desktop.getVamsasApplication().getCurrentSession());
413 if (vamsasSession != null)
415 if (vamsasImport != null)
417 // close the newly imported session and import the Jalview specific
418 // remnants into the new session later on.
419 desktop.vamsasStop_actionPerformed(null);
421 // now join the new session
424 if (desktop.joinVamsasSession(vamsasSession))
426 System.out.println("Successfully joined vamsas session "
431 System.err.println("WARNING: Failed to join vamsas session "
434 } catch (Exception e)
436 System.err.println("ERROR: Failed to join vamsas session "
440 if (vamsasImport != null)
442 // the Jalview specific remnants can now be imported into the new
443 // session at the user's leisure.
445 .info("Skipping Push for import of data into existing vamsas session."); // TODO:
450 // desktop.getVamsasApplication().push_update();
455 // Finally, deal with the remaining input data.
460 desktop.setProgressBar(MessageManager
461 .getString("status.processing_commandline_args"),
462 progress = System.currentTimeMillis());
464 System.out.println("CMD [-open " + file + "] executed successfully!");
466 if (!file.startsWith("http://"))
468 if (!(new File(file)).exists())
470 System.out.println("Can't find " + file);
478 protocol = AppletFormatAdapter.checkProtocol(file);
482 format = new IdentifyFile().identify(file, protocol);
483 } catch (FileFormatException e1)
488 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
492 System.out.println("error");
496 setCurrentAlignFrame(af);
497 data = aparser.getValue("colour", true);
500 data.replaceAll("%20", " ");
502 ColourSchemeI cs = ColourSchemeProperty.getColour(af
503 .getViewport().getAlignment(), data);
507 UserColourScheme ucs = new UserColourScheme("white");
508 ucs.parseAppletParameter(data);
513 System.out.println("CMD [-color " + data
514 + "] executed successfully!");
519 // Must maintain ability to use the groups flag
520 data = aparser.getValue("groups", true);
523 af.parseFeaturesFile(data,
524 AppletFormatAdapter.checkProtocol(data));
525 // System.out.println("Added " + data);
526 System.out.println("CMD groups[-" + data
527 + "] executed successfully!");
529 data = aparser.getValue("features", true);
532 af.parseFeaturesFile(data,
533 AppletFormatAdapter.checkProtocol(data));
534 // System.out.println("Added " + data);
535 System.out.println("CMD [-features " + data
536 + "] executed successfully!");
539 data = aparser.getValue("annotations", true);
542 af.loadJalviewDataFile(data, null, null, null);
543 // System.out.println("Added " + data);
544 System.out.println("CMD [-annotations " + data
545 + "] executed successfully!");
547 // set or clear the sortbytree flag.
548 if (aparser.contains("sortbytree"))
550 af.getViewport().setSortByTree(true);
551 if (af.getViewport().getSortByTree())
553 System.out.println("CMD [-sortbytree] executed successfully!");
556 if (aparser.contains("no-annotation"))
558 af.getViewport().setShowAnnotation(false);
559 if (!af.getViewport().isShowAnnotation())
561 System.out.println("CMD no-annotation executed successfully!");
564 if (aparser.contains("nosortbytree"))
566 af.getViewport().setSortByTree(false);
567 if (!af.getViewport().getSortByTree())
570 .println("CMD [-nosortbytree] executed successfully!");
573 data = aparser.getValue("tree", true);
576 jalview.io.NewickFile fin = null;
579 System.out.println("CMD [-tree " + data
580 + "] executed successfully!");
581 fin = new NewickFile(data,
582 AppletFormatAdapter.checkProtocol(data));
585 af.getViewport().setCurrentTree(
586 af.ShowNewickTree(fin, data).getTree());
588 } catch (IOException ex)
590 System.err.println("Couldn't add tree " + data);
591 ex.printStackTrace(System.err);
594 // TODO - load PDB structure(s) to alignment JAL-629
595 // (associate with identical sequence in alignment, or a specified
598 getFeatures = checkDasArguments(aparser);
599 if (af != null && getFeatures != null)
601 FeatureFetcher ff = startFeatureFetching(getFeatures);
604 while (!ff.allFinished() || af.operationInProgress())
606 // wait around until fetching is finished.
610 } catch (Exception e)
616 getFeatures = null; // have retrieved features - forget them now.
618 if (groovyscript != null)
620 // Execute the groovy script after we've done all the rendering stuff
621 // and before any images or figures are generated.
622 System.out.println("Executing script " + groovyscript);
623 executeGroovyScript(groovyscript, af);
624 System.out.println("CMD groovy[" + groovyscript
625 + "] executed successfully!");
628 String imageName = "unnamed.png";
629 while (aparser.getSize() > 1)
631 String outputFormat = aparser.nextValue();
632 file = aparser.nextValue();
634 if (outputFormat.equalsIgnoreCase("png"))
636 af.createPNG(new File(file));
637 imageName = (new File(file)).getName();
638 System.out.println("Creating PNG image: " + file);
641 else if (outputFormat.equalsIgnoreCase("svg"))
643 File imageFile = new File(file);
644 imageName = imageFile.getName();
645 af.createSVG(imageFile);
646 System.out.println("Creating SVG image: " + file);
649 else if (outputFormat.equalsIgnoreCase("html"))
651 File imageFile = new File(file);
652 imageName = imageFile.getName();
653 new HtmlSvgOutput(new File(file), af.alignPanel);
654 System.out.println("Creating HTML image: " + file);
657 else if (outputFormat.equalsIgnoreCase("imgMap"))
659 af.createImageMap(new File(file), imageName);
660 System.out.println("Creating image map: " + file);
663 else if (outputFormat.equalsIgnoreCase("eps"))
665 File outputFile = new File(file);
666 System.out.println("Creating EPS file: "
667 + outputFile.getAbsolutePath());
668 af.createEPS(outputFile);
672 if (af.saveAlignment(file, format))
674 System.out.println("Written alignment in " + format
675 + " format to " + file);
679 System.out.println("Error writing file " + file + " in "
680 + format + " format!!");
685 while (aparser.getSize() > 0)
687 System.out.println("Unknown arg: " + aparser.nextValue());
691 AlignFrame startUpAlframe = null;
692 // We'll only open the default file if the desktop is visible.
694 // ////////////////////
696 if (!headless && file == null && vamsasImport == null
697 && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
699 file = jalview.bin.Cache.getDefault(
701 jalview.bin.Cache.getDefault("www.jalview.org",
702 "http://www.jalview.org")
703 + "/examples/exampleFile_2_7.jar");
704 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar"))
706 // hardwire upgrade of the startup file
707 file.replace("_2_3.jar", "_2_7.jar");
708 // and remove the stale setting
709 jalview.bin.Cache.removeProperty("STARTUP_FILE");
712 protocol = DataSourceType.FILE;
714 if (file.indexOf("http:") > -1)
716 protocol = DataSourceType.URL;
719 if (file.endsWith(".jar"))
721 format = FileFormat.Jalview;
727 format = new IdentifyFile().identify(file, protocol);
728 } catch (FileFormatException e)
734 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
736 getFeatures = checkDasArguments(aparser);
737 // extract groovy arguments before anything else.
739 // If the user has specified features to be retrieved,
740 // or a groovy script to be executed, do them if they
741 // haven't been done already
742 // fetch features for the default alignment
743 if (getFeatures != null)
745 if (startUpAlframe != null)
747 startFeatureFetching(getFeatures);
750 // Once all other stuff is done, execute any groovy scripts (in order)
751 if (groovyscript != null)
753 if (Cache.groovyJarsPresent())
755 System.out.println("Executing script " + groovyscript);
756 executeGroovyScript(groovyscript, startUpAlframe);
761 .println("Sorry. Groovy Support is not available, so ignoring the provided groovy script "
765 // and finally, turn off batch mode indicator - if the desktop still exists
770 desktop.setProgressBar(null, progress);
772 desktop.setInBatchMode(false);
776 private static void showUsage()
779 .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
780 + "-nodisplay\tRun Jalview without User Interface.\n"
781 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
782 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
783 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
784 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
785 + "-features FILE\tUse the given file to mark features on the alignment.\n"
786 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
787 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
788 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
789 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
790 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
791 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
792 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
793 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
794 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
795 + "-png FILE\tCreate PNG image FILE from alignment.\n"
796 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
797 + "-html FILE\tCreate HTML file from alignment.\n"
798 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
799 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
800 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
801 + "-noquestionnaire\tTurn off questionnaire check.\n"
802 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
803 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
805 // "-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)"
806 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
807 + "-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"
808 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
809 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
810 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
812 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
813 // + "-vses vamsas-session\tJoin session with given URN\n"
814 + "-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"
815 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
818 private static void startUsageStats(final Desktop desktop)
821 * start a User Config prompt asking if we can log usage statistics.
823 PromptUserConfig prompter = new PromptUserConfig(
826 "Jalview Usage Statistics",
827 "Do you want to help make Jalview better by enabling "
828 + "the collection of usage statistics with Google Analytics ?"
829 + "\n\n(you can enable or disable usage tracking in the preferences)",
836 .debug("Initialising googletracker for usage stats.");
837 Cache.initGoogleTracker();
838 Cache.log.debug("Tracking enabled.");
845 Cache.log.debug("Not enabling Google Tracking.");
848 desktop.addDialogThread(prompter);
852 * Locate the given string as a file and pass it to the groovy interpreter.
854 * @param groovyscript
855 * the script to execute
856 * @param jalviewContext
857 * the Jalview Desktop object passed in to the groovy binding as the
860 private void executeGroovyScript(String groovyscript, AlignFrame af)
863 * for scripts contained in files
870 if (groovyscript.trim().equals("STDIN"))
872 // read from stdin into a tempfile and execute it
875 tfile = File.createTempFile("jalview", "groovy");
876 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
877 new FileOutputStream(tfile)));
878 BufferedReader br = new BufferedReader(new InputStreamReader(
881 while ((line = br.readLine()) != null)
883 outfile.write(line + "\n");
889 } catch (Exception ex)
891 System.err.println("Failed to read from STDIN into tempfile "
892 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
894 ex.printStackTrace();
899 sfile = tfile.toURI().toURL();
900 } catch (Exception x)
903 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
913 sfile = new URI(groovyscript).toURL();
914 } catch (Exception x)
916 tfile = new File(groovyscript);
919 System.err.println("File '" + groovyscript + "' does not exist.");
922 if (!tfile.canRead())
924 System.err.println("File '" + groovyscript + "' cannot be read.");
927 if (tfile.length() < 1)
929 System.err.println("File '" + groovyscript + "' is empty.");
934 sfile = tfile.getAbsoluteFile().toURI().toURL();
935 } catch (Exception ex)
937 System.err.println("Failed to create a file URL for "
938 + tfile.getAbsoluteFile());
945 Map<String, Object> vbinding = new HashMap<String, Object>();
946 vbinding.put("Jalview", this);
949 vbinding.put("currentAlFrame", af);
951 Binding gbinding = new Binding(vbinding);
952 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
953 gse.run(sfile.toString(), gbinding);
954 if ("STDIN".equals(groovyscript))
956 // delete temp file that we made -
957 // only if it was successfully executed
960 } catch (Exception e)
962 System.err.println("Exception Whilst trying to execute file " + sfile
963 + " as a groovy script.");
964 e.printStackTrace(System.err);
970 * Check commandline for any das server definitions or any fetchfrom switches
972 * @return vector of DAS source nicknames to retrieve from
974 private static Vector<String> checkDasArguments(ArgsParser aparser)
976 Vector<String> source = null;
978 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
979 while ((data = aparser.getValue("dasserver", true)) != null)
981 String nickname = null;
983 int pos = data.indexOf('=');
984 // determine capabilities
987 nickname = data.substring(0, pos);
989 url = data.substring(pos + 1);
991 && (url.startsWith("http:") || url
992 .startsWith("sequence:http:")))
994 if (nickname == null)
998 if (locsources == null)
1006 locsources = locsources + nickname + "|" + url;
1008 .println("NOTE! dasserver parameter not yet really supported (got args of "
1009 + nickname + "|" + url);
1012 source = new Vector<String>();
1014 source.addElement(nickname);
1016 System.out.println("CMD [-dasserver " + data
1017 + "] executed successfully!");
1018 } // loop until no more server entries are found.
1019 if (locsources != null && locsources.indexOf('|') > -1)
1021 Cache.log.debug("Setting local source list in properties file to:\n"
1023 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
1025 while ((data = aparser.getValue("fetchfrom", true)) != null)
1027 System.out.println("adding source '" + data + "'");
1030 source = new Vector<String>();
1032 source.addElement(data);
1038 * start a feature fetcher for every alignment frame
1042 private FeatureFetcher startFeatureFetching(
1043 final Vector<String> dasSources)
1045 FeatureFetcher ff = new FeatureFetcher();
1046 AlignFrame afs[] = Desktop.getAlignFrames();
1047 if (afs == null || afs.length == 0)
1051 for (int i = 0; i < afs.length; i++)
1053 ff.addFetcher(afs[i], dasSources);
1058 public static boolean isHeadlessMode()
1060 String isheadless = System.getProperty("java.awt.headless");
1061 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1068 public AlignFrame[] getAlignFrames()
1070 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1071 : Desktop.getAlignFrames();
1076 * Quit method delegates to Desktop.quit - unless running in headless mode
1077 * when it just ends the JVM
1081 if (desktop != null)
1091 public static AlignFrame getCurrentAlignFrame()
1093 return Jalview.currentAlignFrame;
1096 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1098 Jalview.currentAlignFrame = currentAlignFrame;