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);
339 System.err.println("CMD [-noquestionnaire] executed successfully!");
342 if (!aparser.contains("nonews"))
344 desktop.checkForNews();
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 + "-nonews\tTurn off check for Jalview news.\n"
803 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
804 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
806 // "-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)"
807 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
808 + "-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"
809 + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
810 + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
811 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
813 // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
814 // + "-vses vamsas-session\tJoin session with given URN\n"
815 + "-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"
816 + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
819 private static void startUsageStats(final Desktop desktop)
822 * start a User Config prompt asking if we can log usage statistics.
824 PromptUserConfig prompter = new PromptUserConfig(
827 "Jalview Usage Statistics",
828 "Do you want to help make Jalview better by enabling "
829 + "the collection of usage statistics with Google Analytics ?"
830 + "\n\n(you can enable or disable usage tracking in the preferences)",
837 .debug("Initialising googletracker for usage stats.");
838 Cache.initGoogleTracker();
839 Cache.log.debug("Tracking enabled.");
846 Cache.log.debug("Not enabling Google Tracking.");
849 desktop.addDialogThread(prompter);
853 * Locate the given string as a file and pass it to the groovy interpreter.
855 * @param groovyscript
856 * the script to execute
857 * @param jalviewContext
858 * the Jalview Desktop object passed in to the groovy binding as the
861 private void executeGroovyScript(String groovyscript, AlignFrame af)
864 * for scripts contained in files
871 if (groovyscript.trim().equals("STDIN"))
873 // read from stdin into a tempfile and execute it
876 tfile = File.createTempFile("jalview", "groovy");
877 PrintWriter outfile = new PrintWriter(new OutputStreamWriter(
878 new FileOutputStream(tfile)));
879 BufferedReader br = new BufferedReader(new InputStreamReader(
882 while ((line = br.readLine()) != null)
884 outfile.write(line + "\n");
890 } catch (Exception ex)
892 System.err.println("Failed to read from STDIN into tempfile "
893 + ((tfile == null) ? "(tempfile wasn't created)" : tfile
895 ex.printStackTrace();
900 sfile = tfile.toURI().toURL();
901 } catch (Exception x)
904 .println("Unexpected Malformed URL Exception for temporary file created from STDIN: "
914 sfile = new URI(groovyscript).toURL();
915 } catch (Exception x)
917 tfile = new File(groovyscript);
920 System.err.println("File '" + groovyscript + "' does not exist.");
923 if (!tfile.canRead())
925 System.err.println("File '" + groovyscript + "' cannot be read.");
928 if (tfile.length() < 1)
930 System.err.println("File '" + groovyscript + "' is empty.");
935 sfile = tfile.getAbsoluteFile().toURI().toURL();
936 } catch (Exception ex)
938 System.err.println("Failed to create a file URL for "
939 + tfile.getAbsoluteFile());
946 Map<String, Object> vbinding = new HashMap<String, Object>();
947 vbinding.put("Jalview", this);
950 vbinding.put("currentAlFrame", af);
952 Binding gbinding = new Binding(vbinding);
953 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
954 gse.run(sfile.toString(), gbinding);
955 if ("STDIN".equals(groovyscript))
957 // delete temp file that we made -
958 // only if it was successfully executed
961 } catch (Exception e)
963 System.err.println("Exception Whilst trying to execute file " + sfile
964 + " as a groovy script.");
965 e.printStackTrace(System.err);
971 * Check commandline for any das server definitions or any fetchfrom switches
973 * @return vector of DAS source nicknames to retrieve from
975 private static Vector<String> checkDasArguments(ArgsParser aparser)
977 Vector<String> source = null;
979 String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE);
980 while ((data = aparser.getValue("dasserver", true)) != null)
982 String nickname = null;
984 int pos = data.indexOf('=');
985 // determine capabilities
988 nickname = data.substring(0, pos);
990 url = data.substring(pos + 1);
992 && (url.startsWith("http:") || url
993 .startsWith("sequence:http:")))
995 if (nickname == null)
999 if (locsources == null)
1007 locsources = locsources + nickname + "|" + url;
1009 .println("NOTE! dasserver parameter not yet really supported (got args of "
1010 + nickname + "|" + url);
1013 source = new Vector<String>();
1015 source.addElement(nickname);
1017 System.out.println("CMD [-dasserver " + data
1018 + "] executed successfully!");
1019 } // loop until no more server entries are found.
1020 if (locsources != null && locsources.indexOf('|') > -1)
1022 Cache.log.debug("Setting local source list in properties file to:\n"
1024 Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources);
1026 while ((data = aparser.getValue("fetchfrom", true)) != null)
1028 System.out.println("adding source '" + data + "'");
1031 source = new Vector<String>();
1033 source.addElement(data);
1039 * start a feature fetcher for every alignment frame
1043 private FeatureFetcher startFeatureFetching(
1044 final Vector<String> dasSources)
1046 FeatureFetcher ff = new FeatureFetcher();
1047 AlignFrame afs[] = Desktop.getAlignFrames();
1048 if (afs == null || afs.length == 0)
1052 for (int i = 0; i < afs.length; i++)
1054 ff.addFetcher(afs[i], dasSources);
1059 public static boolean isHeadlessMode()
1061 String isheadless = System.getProperty("java.awt.headless");
1062 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1069 public AlignFrame[] getAlignFrames()
1071 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1072 : Desktop.getAlignFrames();
1077 * Quit method delegates to Desktop.quit - unless running in headless mode
1078 * when it just ends the JVM
1082 if (desktop != null)
1092 public static AlignFrame getCurrentAlignFrame()
1094 return Jalview.currentAlignFrame;
1097 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1099 Jalview.currentAlignFrame = currentAlignFrame;