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 java.awt.Color;
24 import java.io.BufferedReader;
26 import java.io.FileOutputStream;
27 import java.io.IOException;
28 import java.io.InputStreamReader;
29 import java.io.OutputStream;
30 import java.io.OutputStreamWriter;
31 import java.io.PrintStream;
32 import java.io.PrintWriter;
33 import java.net.MalformedURLException;
35 import java.net.URISyntaxException;
37 import java.security.AllPermission;
38 import java.security.CodeSource;
39 import java.security.PermissionCollection;
40 import java.security.Permissions;
41 import java.security.Policy;
42 import java.util.ArrayList;
43 import java.util.HashMap;
44 import java.util.List;
45 import java.util.Locale;
47 import java.util.Properties;
48 import java.util.Vector;
49 import java.util.logging.ConsoleHandler;
50 import java.util.logging.Level;
51 import java.util.logging.Logger;
52 import java.util.stream.Collectors;
54 import javax.swing.JDialog;
55 import javax.swing.JFrame;
56 import javax.swing.JInternalFrame;
57 import javax.swing.JOptionPane;
58 import javax.swing.SwingUtilities;
59 import javax.swing.UIManager;
60 import javax.swing.UIManager.LookAndFeelInfo;
61 import javax.swing.UnsupportedLookAndFeelException;
63 import com.formdev.flatlaf.FlatLightLaf;
64 import com.formdev.flatlaf.themes.FlatMacLightLaf;
65 import com.formdev.flatlaf.util.SystemInfo;
66 import com.threerings.getdown.util.LaunchUtil;
68 //import edu.stanford.ejalbert.launching.IBrowserLaunching;
69 import groovy.lang.Binding;
70 import groovy.util.GroovyScriptEngine;
71 import jalview.bin.argparser.Arg;
72 import jalview.bin.argparser.Arg.Opt;
73 import jalview.bin.argparser.Arg.Type;
74 import jalview.bin.argparser.ArgParser;
75 import jalview.bin.argparser.BootstrapArgs;
76 import jalview.ext.so.SequenceOntology;
77 import jalview.gui.AlignFrame;
78 import jalview.gui.Desktop;
79 import jalview.gui.PromptUserConfig;
80 import jalview.gui.QuitHandler;
81 import jalview.gui.QuitHandler.QResponse;
82 import jalview.gui.StructureViewerBase;
83 import jalview.io.AppletFormatAdapter;
84 import jalview.io.BioJsHTMLOutput;
85 import jalview.io.DataSourceType;
86 import jalview.io.FileFormat;
87 import jalview.io.FileFormatException;
88 import jalview.io.FileFormatI;
89 import jalview.io.FileFormats;
90 import jalview.io.FileLoader;
91 import jalview.io.HtmlSvgOutput;
92 import jalview.io.IdentifyFile;
93 import jalview.io.NewickFile;
94 import jalview.io.exceptions.ImageOutputException;
95 import jalview.io.gff.SequenceOntologyFactory;
96 import jalview.schemes.ColourSchemeI;
97 import jalview.schemes.ColourSchemeProperty;
98 import jalview.util.ChannelProperties;
99 import jalview.util.HttpUtils;
100 import jalview.util.LaunchUtils;
101 import jalview.util.MessageManager;
102 import jalview.util.Platform;
103 import jalview.ws.jws2.Jws2Discoverer;
106 * Main class for Jalview Application <br>
108 * start with: java -classpath "$PATH_TO_LIB$/*:$PATH_TO_CLASSES$" \
109 * jalview.bin.Jalview
111 * or on Windows: java -classpath "$PATH_TO_LIB$/*;$PATH_TO_CLASSES$" \
112 * jalview.bin.Jalview jalview.bin.Jalview
114 * (ensure -classpath arg is quoted to avoid shell expansion of '*' and do not
115 * embellish '*' to e.g. '*.jar')
118 * @version $Revision$
124 Platform.getURLCommandArguments();
125 Platform.addJ2SDirectDatabaseCall("https://www.jalview.org");
126 Platform.addJ2SDirectDatabaseCall("http://www.jalview.org");
127 Platform.addJ2SDirectDatabaseCall("http://www.compbio.dundee.ac.uk");
128 Platform.addJ2SDirectDatabaseCall("https://www.compbio.dundee.ac.uk");
132 * singleton instance of this class
134 private static Jalview instance;
136 private Desktop desktop;
138 protected Commands cmds;
140 public static AlignFrame currentAlignFrame;
142 public ArgParser argparser = null;
144 public BootstrapArgs bootstrapArgs = null;
146 private boolean QUIET = false;
148 public static boolean quiet()
150 return Jalview.getInstance() != null && Jalview.getInstance().QUIET;
155 if (!Platform.isJS())
162 // grab all the rights we can for the JVM
163 Policy.setPolicy(new Policy()
166 public PermissionCollection getPermissions(CodeSource codesource)
168 Permissions perms = new Permissions();
169 perms.add(new AllPermission());
174 public void refresh()
182 * keep track of feature fetching tasks.
190 * TODO: generalise to track all jalview events to orchestrate batch processing
194 private int queued = 0;
196 private int running = 0;
198 public FeatureFetcher()
203 public void addFetcher(final AlignFrame af,
204 final Vector<String> dasSources)
206 final long id = System.currentTimeMillis();
208 final FeatureFetcher us = this;
209 new Thread(new Runnable()
221 af.setProgressBar(MessageManager
222 .getString("status.das_features_being_retrived"), id);
223 af.featureSettings_actionPerformed(null);
224 af.setProgressBar(null, id);
233 public synchronized boolean allFinished()
235 return queued == 0 && running == 0;
240 public static Jalview getInstance()
246 * main class for Jalview application
249 * open <em>filename</em>
251 public static void main(String[] args)
253 // setLogging(); // BH - for event debugging in JavaScript
254 instance = new Jalview();
255 instance.doMain(args);
258 private static void logClass(String name)
260 // BH - for event debugging in JavaScript
261 ConsoleHandler consoleHandler = new ConsoleHandler();
262 consoleHandler.setLevel(Level.ALL);
263 Logger logger = Logger.getLogger(name);
264 logger.setLevel(Level.ALL);
265 logger.addHandler(consoleHandler);
268 @SuppressWarnings("unused")
269 private static void setLogging()
277 System.out.println("not in js");
280 // BH - for event debugging in JavaScript (Java mode only)
281 if (!Platform.isJS())
288 Logger.getLogger("").setLevel(Level.ALL);
289 logClass("java.awt.EventDispatchThread");
290 logClass("java.awt.EventQueue");
291 logClass("java.awt.Component");
292 logClass("java.awt.focus.Component");
293 logClass("java.awt.focus.DefaultKeyboardFocusManager");
301 void doMain(String[] args)
303 if (!Platform.isJS())
305 System.setSecurityManager(null);
308 if (args == null || args.length == 0 || (args.length == 1
309 && (args[0] == null || args[0].length() == 0)))
311 args = new String[] {};
314 // get args needed before proper ArgParser
315 bootstrapArgs = BootstrapArgs.getBootstrapArgs(args);
317 if (!Platform.isJS())
319 // are we being --quiet ?
320 if (bootstrapArgs.contains(Arg.QUIET))
323 OutputStream devNull = new OutputStream()
327 public void write(int b)
332 System.setOut(new PrintStream(devNull));
333 // redirecting stderr not working
334 if (bootstrapArgs.getList(Arg.QUIET).size() > 1)
336 System.setErr(new PrintStream(devNull));
340 if (bootstrapArgs.contains(Arg.HELP)
341 || bootstrapArgs.contains(Arg.VERSION))
347 // set individual session preferences
348 if (bootstrapArgs.contains(Arg.P))
350 for (String kev : bootstrapArgs.getValueList(Arg.P))
356 int equalsIndex = kev.indexOf(ArgParser.EQUALS);
357 if (equalsIndex > -1)
359 String key = kev.substring(0, equalsIndex);
360 String val = kev.substring(equalsIndex + 1);
361 Cache.setSessionProperty(key, val);
366 // Move any new getdown-launcher-new.jar into place over old
367 // getdown-launcher.jar
368 String appdirString = System.getProperty("getdownappdir");
369 if (appdirString != null && appdirString.length() > 0)
371 final File appdir = new File(appdirString);
378 LaunchUtil.upgradeGetdown(
379 new File(appdir, "getdown-launcher-old.jar"),
380 new File(appdir, "getdown-launcher.jar"),
381 new File(appdir, "getdown-launcher-new.jar"));
386 if (!quiet() || bootstrapArgs.contains(Arg.VERSION))
389 "Java version: " + System.getProperty("java.version"));
390 System.out.println("Java home: " + System.getProperty("java.home"));
391 System.out.println("Java arch: " + System.getProperty("os.arch") + " "
392 + System.getProperty("os.name") + " "
393 + System.getProperty("os.version"));
395 String val = System.getProperty("sys.install4jVersion");
398 System.out.println("Install4j version: " + val);
400 val = System.getProperty("installer_template_version");
403 System.out.println("Install4j template version: " + val);
405 val = System.getProperty("launcher_version");
408 System.out.println("Launcher version: " + val);
412 if (Platform.isLinux() && LaunchUtils.getJavaVersion() < 11)
414 System.setProperty("flatlaf.uiScale", "1");
417 // get bootstrap properties (mainly for the logger level)
418 Properties bootstrapProperties = Cache
419 .bootstrapProperties(bootstrapArgs.getValue(Arg.PROPS));
421 // report Jalview version
422 Cache.loadBuildProperties(
423 !quiet() || bootstrapArgs.contains(Arg.VERSION));
425 // stop now if only after --version
426 if (bootstrapArgs.contains(Arg.VERSION))
428 Jalview.exit(null, 0);
432 ArgsParser aparser = new ArgsParser(args);
435 boolean headless = false;
437 boolean headlessArg = false;
441 String logLevel = null;
442 if (bootstrapArgs.contains(Arg.TRACE))
446 else if (bootstrapArgs.contains(Arg.DEBUG))
450 if (logLevel == null && !(bootstrapProperties == null))
452 logLevel = bootstrapProperties.getProperty(Cache.JALVIEWLOGLEVEL);
454 Console.initLogger(logLevel);
455 } catch (NoClassDefFoundError error)
457 error.printStackTrace();
458 String message = "\nEssential logging libraries not found."
459 + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview";
460 Jalview.exit(message, 0);
463 // register SIGTERM listener
464 Runtime.getRuntime().addShutdownHook(new Thread()
468 Console.debug("Running shutdown hook");
469 QuitHandler.startForceQuit();
470 boolean closeExternal = Cache
471 .getDefault("DEFAULT_CLOSE_EXTERNAL_VIEWERS", false)
472 || Cache.getDefault("ALWAYS_CLOSE_EXTERNAL_VIEWERS", false);
473 StructureViewerBase.setQuitClose(closeExternal);
476 for (JInternalFrame frame : Desktop.desktop.getAllFrames())
478 if (frame instanceof StructureViewerBase)
480 ((StructureViewerBase) frame).closeViewer(closeExternal);
485 if (QuitHandler.gotQuitResponse() == QResponse.CANCEL_QUIT)
487 // Got to here by a SIGTERM signal.
488 // Note we will not actually cancel the quit from here -- it's too
489 // late -- but we can wait for saving files and close external viewers
491 // Close viewers/Leave viewers open
492 Console.debug("Checking for saving files");
493 QuitHandler.getQuitResponse(false);
497 Console.debug("Nothing more to do");
499 Console.debug("Exiting, bye!");
500 // shutdownHook cannot be cancelled, JVM will now halt
504 String usrPropsFile = bootstrapArgs.contains(Arg.PROPS)
505 ? bootstrapArgs.getValue(Arg.PROPS)
506 : aparser.getValue("props");
507 // if usrPropsFile == null, loadProperties will use the Channel
509 Cache.loadProperties(usrPropsFile);
510 if (usrPropsFile != null)
513 "CMD [-props " + usrPropsFile + "] executed successfully!");
514 testoutput(bootstrapArgs, Arg.PROPS,
515 "test/jalview/bin/testProps.jvprops", usrPropsFile);
518 // --argfile=... -- OVERRIDES ALL NON-BOOTSTRAP ARGS
519 if (bootstrapArgs.contains(Arg.ARGFILE))
521 argparser = ArgParser.parseArgFiles(
522 bootstrapArgs.getValueList(Arg.ARGFILE),
523 bootstrapArgs.getBoolean(Arg.INITSUBSTITUTIONS),
528 argparser = new ArgParser(args,
529 bootstrapArgs.getBoolean(Arg.INITSUBSTITUTIONS),
533 if (!Platform.isJS())
540 if (bootstrapArgs.contains(Arg.HELP))
542 List<Map.Entry<Type, String>> helpArgs = bootstrapArgs
544 System.out.println(Arg.usage(helpArgs.stream().map(e -> e.getKey())
545 .collect(Collectors.toList())));
546 Jalview.exit(null, 0);
548 if (aparser.contains("help") || aparser.contains("h"))
551 * Now using new usage statement.
554 System.out.println(Arg.usage());
555 Jalview.exit(null, 0);
559 headlessArg = bootstrapArgs.isHeadless();
562 System.setProperty("java.awt.headless", "true");
565 if (aparser.contains("nodisplay") || aparser.contains("nogui")
566 || aparser.contains("headless"))
568 System.setProperty("java.awt.headless", "true");
573 // allow https handshakes to download intermediate certs if necessary
574 System.setProperty("com.sun.security.enableAIAcaIssuers", "true");
576 String jabawsUrl = bootstrapArgs.getValue(Arg.JABAWS);
577 if (jabawsUrl == null)
578 jabawsUrl = aparser.getValue("jabaws");
579 if (jabawsUrl != null)
583 Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
585 "CMD [-jabaws " + jabawsUrl + "] executed successfully!");
586 testoutput(bootstrapArgs, Arg.JABAWS,
587 "http://www.compbio.dundee.ac.uk/jabaws", jabawsUrl);
588 } catch (MalformedURLException e)
591 "Invalid jabaws parameter: " + jabawsUrl + " ignored");
596 List<String> setprops = new ArrayList<>();
597 if (bootstrapArgs.contains(Arg.SETPROP))
599 setprops = bootstrapArgs.getValueList(Arg.SETPROP);
603 String sp = aparser.getValue("setprop");
607 sp = aparser.getValue("setprop");
610 for (String setprop : setprops)
612 int p = setprop.indexOf('=');
616 .println("Ignoring invalid setprop argument : " + setprop);
620 System.out.println("Executing setprop argument: " + setprop);
623 Cache.setProperty(setprop.substring(0, p),
624 setprop.substring(p + 1));
626 // DISABLED FOR SECURITY REASONS
627 // TODO: add a property to allow properties to be overriden by cli args
628 // Cache.setProperty(setprop.substring(0,p), setprop.substring(p+1));
631 if (System.getProperty("java.awt.headless") != null
632 && System.getProperty("java.awt.headless").equals("true"))
636 System.setProperty("http.agent",
637 "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
641 Console.initLogger();
644 NoClassDefFoundError error)
646 error.printStackTrace();
647 String message = "\nEssential logging libraries not found."
648 + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview";
649 Jalview.exit(message, 0);
653 if (!(headless || headlessArg))
657 * configure 'full' SO model if preferences say to, else use the default (full SO)
658 * - as JS currently doesn't have OBO parsing, it must use 'Lite' version
660 boolean soDefault = !Platform.isJS();
661 if (Cache.getDefault("USE_FULL_SO", soDefault))
663 SequenceOntologyFactory.setInstance(new SequenceOntology());
666 if (!(headless || headlessArg))
668 Desktop.nosplash = "false".equals(bootstrapArgs.getValue(Arg.SPLASH))
669 || aparser.contains("nosplash")
670 || Cache.getDefault("SPLASH", "true").equals("false");
671 desktop = new Desktop();
672 desktop.setInBatchMode(true); // indicate we are starting up
676 JalviewTaskbar.setTaskbar(this);
677 } catch (Exception e)
679 Console.info("Cannot set Taskbar");
680 Console.error(e.getMessage());
681 // e.printStackTrace();
682 } catch (Throwable t)
684 Console.info("Cannot set Taskbar");
685 Console.error(t.getMessage());
686 // t.printStackTrace();
689 // set Proxy settings before all the internet calls
690 Cache.setProxyPropertiesFromPreferences();
692 desktop.setVisible(true);
694 if (!Platform.isJS())
703 * Check to see that the JVM version being run is suitable for the Java
704 * version this Jalview was compiled for. Popup a warning if not.
706 if (!LaunchUtils.checkJavaVersion())
708 Console.warn("The Java version being used (Java "
709 + LaunchUtils.getJavaVersion()
710 + ") may lead to problems. This installation of Jalview should be used with Java "
711 + LaunchUtils.getJavaCompileVersion() + ".");
714 .getBooleanUserPreference("IGNORE_JVM_WARNING_POPUP"))
717 MessageManager.getString("label.continue") };
718 JOptionPane.showOptionDialog(null,
719 MessageManager.formatMessage(
720 "warning.wrong_jvm_version_message",
721 LaunchUtils.getJavaVersion(),
722 LaunchUtils.getJavaCompileVersion()),
724 .getString("warning.wrong_jvm_version_title"),
725 JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
726 null, options, options[0]);
730 boolean webservicediscovery = bootstrapArgs
731 .getBoolean(Arg.WEBSERVICEDISCOVERY);
732 if (aparser.contains("nowebservicediscovery"))
733 webservicediscovery = false;
734 if (webservicediscovery)
736 desktop.startServiceDiscovery();
740 testoutput(argparser, Arg.WEBSERVICEDISCOVERY);
743 boolean usagestats = !bootstrapArgs.getBoolean(Arg.NOUSAGESTATS);
744 if (aparser.contains("nousagestats"))
748 startUsageStats(desktop);
749 testoutput(argparser, Arg.NOUSAGESTATS);
753 System.out.println("CMD [-nousagestats] executed successfully!");
754 testoutput(argparser, Arg.NOUSAGESTATS);
757 boolean questionnaire = bootstrapArgs.getBoolean(Arg.QUESTIONNAIRE);
758 if (aparser.contains("noquestionnaire"))
759 questionnaire = false;
762 String url = aparser.getValue("questionnaire");
765 // Start the desktop questionnaire prompter with the specified
767 Console.debug("Starting questionnaire url at " + url);
768 desktop.checkForQuestionnaire(url);
769 System.out.println("CMD questionnaire[-" + url
770 + "] executed successfully!");
774 if (Cache.getProperty("NOQUESTIONNAIRES") == null)
776 // Start the desktop questionnaire prompter with the specified
779 // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
781 String defurl = "https://www.jalview.org/cgi-bin/questionnaire.pl";
783 "Starting questionnaire with default url: " + defurl);
784 desktop.checkForQuestionnaire(defurl);
791 .println("CMD [-noquestionnaire] executed successfully!");
792 testoutput(argparser, Arg.QUESTIONNAIRE);
795 if ((!aparser.contains("nonews")
796 && Cache.getProperty("NONEWS") == null
797 && !"false".equals(bootstrapArgs.getValue(Arg.NEWS)))
798 || "true".equals(bootstrapArgs.getValue(Arg.NEWS)))
800 desktop.checkForNews();
803 if (!aparser.contains("nohtmltemplates")
804 && Cache.getProperty("NOHTMLTEMPLATES") == null)
806 BioJsHTMLOutput.updateBioJS();
810 // Run Commands from cli
811 cmds = new Commands(argparser, headlessArg);
812 boolean commandsSuccess = cmds.argsWereParsed();
818 if (argparser.getBoolean(Arg.NOQUIT))
821 "Completed " + Arg.HEADLESS.getName() + " commands, but "
822 + Arg.NOQUIT + " is set so not quitting!");
826 // record usage stats if in headless mode
827 if (Cache.getDefault("USAGESTATS", false)
828 && !argparser.getBoolean(Arg.NOUSAGESTATS))
830 Cache.initAnalytics(headlessArg);
832 Jalview.exit("Successfully completed commands in headless mode",
836 Console.info("Successfully completed commands");
842 Jalview.exit("Error when running Commands in headless mode", 1);
844 Console.warn("Error when running commands");
847 // Check if JVM and compile version might cause problems and log if it
849 if (headless && !Platform.isJS() && !LaunchUtils.checkJavaVersion())
851 Console.warn("The Java version being used (Java "
852 + LaunchUtils.getJavaVersion()
853 + ") may lead to problems. This installation of Jalview should be used with Java "
854 + LaunchUtils.getJavaCompileVersion() + ".");
857 String file = null, data = null;
859 FileFormatI format = null;
861 DataSourceType protocol = null;
863 FileLoader fileLoader = new FileLoader(!headless);
865 String groovyscript = null; // script to execute after all loading is
866 // completed one way or another
867 // extract groovy argument and execute if necessary
868 groovyscript = aparser.getValue("groovy", true);
869 file = aparser.getValue("open", true);
871 if (file == null && desktop == null && !commandsSuccess)
873 Jalview.exit("No files to open!", 1);
877 // Finally, deal with the remaining input data.
882 desktop.setProgressBar(
884 .getString("status.processing_commandline_args"),
885 progress = System.currentTimeMillis());
887 System.out.println("CMD [-open " + file + "] executed successfully!");
889 if (!Platform.isJS())
891 * ignore in JavaScript -- can't just file existence - could load it?
896 if (!HttpUtils.startsWithHttpOrHttps(file))
898 if (!(new File(file)).exists())
903 "Can't find file '" + file + "' in headless mode", 1);
905 Console.warn("Can't find file'" + file + "'");
910 protocol = AppletFormatAdapter.checkProtocol(file);
914 format = new IdentifyFile().identify(file, protocol);
915 } catch (FileFormatException e1)
920 AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
924 System.out.println("error");
928 setCurrentAlignFrame(af);
929 data = aparser.getValue("colour", true);
932 data.replaceAll("%20", " ");
934 ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
935 af.getViewport(), af.getViewport().getAlignment(), data);
940 "CMD [-colour " + data + "] executed successfully!");
945 // Must maintain ability to use the groups flag
946 data = aparser.getValue("groups", true);
949 af.parseFeaturesFile(data,
950 AppletFormatAdapter.checkProtocol(data));
951 // System.out.println("Added " + data);
953 "CMD groups[-" + data + "] executed successfully!");
955 data = aparser.getValue("features", true);
958 af.parseFeaturesFile(data,
959 AppletFormatAdapter.checkProtocol(data));
960 // System.out.println("Added " + data);
962 "CMD [-features " + data + "] executed successfully!");
965 data = aparser.getValue("annotations", true);
968 af.loadJalviewDataFile(data, null, null, null);
969 // System.out.println("Added " + data);
971 "CMD [-annotations " + data + "] executed successfully!");
973 // set or clear the sortbytree flag.
974 if (aparser.contains("sortbytree"))
976 af.getViewport().setSortByTree(true);
977 if (af.getViewport().getSortByTree())
979 System.out.println("CMD [-sortbytree] executed successfully!");
982 if (aparser.contains("no-annotation"))
984 af.getViewport().setShowAnnotation(false);
985 if (!af.getViewport().isShowAnnotation())
987 System.out.println("CMD no-annotation executed successfully!");
990 if (aparser.contains("nosortbytree"))
992 af.getViewport().setSortByTree(false);
993 if (!af.getViewport().getSortByTree())
996 .println("CMD [-nosortbytree] executed successfully!");
999 data = aparser.getValue("tree", true);
1005 "CMD [-tree " + data + "] executed successfully!");
1006 NewickFile nf = new NewickFile(data,
1007 AppletFormatAdapter.checkProtocol(data));
1009 .setCurrentTree(af.showNewickTree(nf, data).getTree());
1010 } catch (IOException ex)
1012 System.err.println("Couldn't add tree " + data);
1013 ex.printStackTrace(System.err);
1017 if (groovyscript != null)
1019 // Execute the groovy script after we've done all the rendering stuff
1020 // and before any images or figures are generated.
1021 System.out.println("Executing script " + groovyscript);
1022 executeGroovyScript(groovyscript, af);
1023 System.out.println("CMD groovy[" + groovyscript
1024 + "] executed successfully!");
1025 groovyscript = null;
1027 String imageName = "unnamed.png";
1028 while (aparser.getSize() > 1)
1032 String outputFormat = aparser.nextValue();
1033 file = aparser.nextValue();
1035 if (outputFormat.equalsIgnoreCase("png"))
1037 System.out.println("Creating PNG image: " + file);
1038 af.createPNG(new File(file));
1039 imageName = (new File(file)).getName();
1042 else if (outputFormat.equalsIgnoreCase("svg"))
1044 System.out.println("Creating SVG image: " + file);
1045 File imageFile = new File(file);
1046 imageName = imageFile.getName();
1047 af.createSVG(imageFile);
1050 else if (outputFormat.equalsIgnoreCase("html"))
1052 File imageFile = new File(file);
1053 imageName = imageFile.getName();
1054 HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
1056 System.out.println("Creating HTML image: " + file);
1057 htmlSVG.exportHTML(file);
1060 else if (outputFormat.equalsIgnoreCase("biojsmsa"))
1064 System.err.println("The output html file must not be null");
1069 BioJsHTMLOutput.refreshVersionInfo(
1070 BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
1071 } catch (URISyntaxException e)
1073 e.printStackTrace();
1075 BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
1077 "Creating BioJS MSA Viwer HTML file: " + file);
1078 bjs.exportHTML(file);
1081 else if (outputFormat.equalsIgnoreCase("imgMap"))
1083 System.out.println("Creating image map: " + file);
1084 af.createImageMap(new File(file), imageName);
1087 else if (outputFormat.equalsIgnoreCase("eps"))
1089 File outputFile = new File(file);
1091 "Creating EPS file: " + outputFile.getAbsolutePath());
1092 af.createEPS(outputFile);
1096 FileFormatI outFormat = null;
1099 outFormat = FileFormats.getInstance().forName(outputFormat);
1100 } catch (Exception formatP)
1102 System.out.println("Couldn't parse " + outFormat
1103 + " as a valid Jalview format string.");
1105 if (outFormat != null)
1107 if (!outFormat.isWritable())
1110 "This version of Jalview does not support alignment export as "
1115 af.saveAlignment(file, outFormat);
1116 if (af.isSaveAlignmentSuccessful())
1118 System.out.println("Written alignment in "
1119 + outFormat.getName() + " format to " + file);
1123 System.out.println("Error writing file " + file + " in "
1124 + outFormat.getName() + " format!!");
1128 } catch (ImageOutputException ioexc)
1131 "Unexpected error whilst exporting image to " + file);
1132 ioexc.printStackTrace();
1137 while (aparser.getSize() > 0)
1139 System.out.println("Unknown arg: " + aparser.nextValue());
1144 AlignFrame startUpAlframe = null;
1145 // We'll only open the default file if the desktop is visible.
1147 // ////////////////////
1149 if (!Platform.isJS() && !headless && file == null
1150 && Cache.getDefault("SHOW_STARTUP_FILE", true)
1151 && !cmds.commandArgsProvided()
1152 && !bootstrapArgs.getBoolean(Arg.NOSTARTUPFILE))
1153 // don't open the startup file if command line args have been processed
1154 // (&& !Commands.commandArgsProvided())
1161 file = Cache.getDefault("STARTUP_FILE",
1162 Cache.getDefault("www.jalview.org", "https://www.jalview.org")
1163 + "/examples/exampleFile_2_7.jvp");
1164 if (file.equals("http://www.jalview.org/examples/exampleFile_2_3.jar")
1166 "http://www.jalview.org/examples/exampleFile_2_7.jar"))
1168 file.replace("http:", "https:");
1169 // hardwire upgrade of the startup file
1170 file.replace("_2_3", "_2_7");
1171 file.replace("2_7.jar", "2_7.jvp");
1172 // and remove the stale setting
1173 Cache.removeProperty("STARTUP_FILE");
1176 protocol = AppletFormatAdapter.checkProtocol(file);
1178 if (file.endsWith(".jar"))
1180 format = FileFormat.Jalview;
1186 format = new IdentifyFile().identify(file, protocol);
1187 } catch (FileFormatException e)
1193 startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
1195 // don't ask to save when quitting if only the startup file has been
1197 Console.debug("Resetting up-to-date flag for startup file");
1198 startUpAlframe.getViewport().setSavedUpToDate(true);
1199 // extract groovy arguments before anything else.
1202 // Once all other stuff is done, execute any groovy scripts (in order)
1203 if (groovyscript != null)
1205 if (Cache.groovyJarsPresent())
1207 System.out.println("Executing script " + groovyscript);
1208 executeGroovyScript(groovyscript, startUpAlframe);
1213 "Sorry. Groovy Support is not available, so ignoring the provided groovy script "
1217 // and finally, turn off batch mode indicator - if the desktop still exists
1218 if (desktop != null)
1222 desktop.setProgressBar(null, progress);
1224 desktop.setInBatchMode(false);
1228 private static void setLookAndFeel()
1230 if (!Platform.isJS())
1237 // property laf = "crossplatform", "system", "gtk", "metal", "nimbus",
1239 // If not set (or chosen laf fails), use the normal SystemLaF and if on
1241 // try Quaqua/Vaqua.
1242 String lafProp = System.getProperty("laf");
1243 String lafSetting = Cache.getDefault("PREFERRED_LAF", null);
1244 String laf = "none";
1245 if (lafProp != null)
1249 else if (lafSetting != null)
1253 boolean lafSet = false;
1256 case "crossplatform":
1257 lafSet = setCrossPlatformLookAndFeel();
1260 Console.error("Could not set requested laf=" + laf);
1264 lafSet = setSystemLookAndFeel();
1267 Console.error("Could not set requested laf=" + laf);
1271 lafSet = setGtkLookAndFeel();
1274 Console.error("Could not set requested laf=" + laf);
1278 lafSet = setMetalLookAndFeel();
1281 Console.error("Could not set requested laf=" + laf);
1285 lafSet = setNimbusLookAndFeel();
1288 Console.error("Could not set requested laf=" + laf);
1292 lafSet = setFlatLookAndFeel();
1295 Console.error("Could not set requested laf=" + laf);
1299 lafSet = setMacLookAndFeel();
1302 Console.error("Could not set requested laf=" + laf);
1308 Console.error("Requested laf=" + laf + " not implemented");
1312 // Flatlaf default for everyone!
1313 lafSet = setFlatLookAndFeel();
1316 setSystemLookAndFeel();
1318 if (Platform.isLinux())
1320 setLinuxLookAndFeel();
1322 if (Platform.isMac())
1324 setMacLookAndFeel();
1330 private static boolean setCrossPlatformLookAndFeel()
1332 boolean set = false;
1335 UIManager.setLookAndFeel(
1336 UIManager.getCrossPlatformLookAndFeelClassName());
1338 } catch (Exception ex)
1340 Console.error("Unexpected Look and Feel Exception");
1341 Console.error(ex.getMessage());
1342 Console.debug(Cache.getStackTraceString(ex));
1347 private static boolean setSystemLookAndFeel()
1349 boolean set = false;
1352 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
1354 } catch (Exception ex)
1356 Console.error("Unexpected Look and Feel Exception");
1357 Console.error(ex.getMessage());
1358 Console.debug(Cache.getStackTraceString(ex));
1363 private static boolean setSpecificLookAndFeel(String name,
1364 String className, boolean nameStartsWith)
1366 boolean set = false;
1369 for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
1371 if (info.getName() != null && nameStartsWith
1372 ? info.getName().toLowerCase(Locale.ROOT)
1373 .startsWith(name.toLowerCase(Locale.ROOT))
1374 : info.getName().toLowerCase(Locale.ROOT)
1375 .equals(name.toLowerCase(Locale.ROOT)))
1377 className = info.getClassName();
1381 UIManager.setLookAndFeel(className);
1383 } catch (Exception ex)
1385 Console.error("Unexpected Look and Feel Exception");
1386 Console.error(ex.getMessage());
1387 Console.debug(Cache.getStackTraceString(ex));
1392 private static boolean setGtkLookAndFeel()
1394 return setSpecificLookAndFeel("gtk",
1395 "com.sun.java.swing.plaf.gtk.GTKLookAndFeel", true);
1398 private static boolean setMetalLookAndFeel()
1400 return setSpecificLookAndFeel("metal",
1401 "javax.swing.plaf.metal.MetalLookAndFeel", false);
1404 private static boolean setNimbusLookAndFeel()
1406 return setSpecificLookAndFeel("nimbus",
1407 "javax.swing.plaf.nimbus.NimbusLookAndFeel", false);
1410 private static boolean setFlatLookAndFeel()
1412 boolean set = false;
1413 if (SystemInfo.isMacOS)
1417 UIManager.setLookAndFeel(
1418 "com.formdev.flatlaf.themes.FlatMacLightLaf");
1420 Console.debug("Using FlatMacLightLaf");
1421 } catch (ClassNotFoundException | InstantiationException
1422 | IllegalAccessException | UnsupportedLookAndFeelException e)
1424 Console.debug("Exception loading FlatLightLaf", e);
1426 System.setProperty("apple.laf.useScreenMenuBar", "true");
1427 System.setProperty("apple.awt.application.name",
1428 ChannelProperties.getProperty("app_name"));
1429 System.setProperty("apple.awt.application.appearance", "system");
1430 if (SystemInfo.isMacFullWindowContentSupported
1431 && Desktop.desktop != null)
1433 Console.debug("Setting transparent title bar");
1434 Desktop.desktop.getRootPane()
1435 .putClientProperty("apple.awt.fullWindowContent", true);
1436 Desktop.desktop.getRootPane()
1437 .putClientProperty("apple.awt.transparentTitleBar", true);
1438 Desktop.desktop.getRootPane()
1439 .putClientProperty("apple.awt.fullscreenable", true);
1441 SwingUtilities.invokeLater(() -> {
1442 FlatMacLightLaf.setup();
1444 Console.debug("Using FlatMacLightLaf");
1451 UIManager.setLookAndFeel("com.formdev.flatlaf.FlatLightLaf");
1453 Console.debug("Using FlatLightLaf");
1454 } catch (ClassNotFoundException | InstantiationException
1455 | IllegalAccessException | UnsupportedLookAndFeelException e)
1457 Console.debug("Exception loading FlatLightLaf", e);
1459 // Windows specific properties here
1460 SwingUtilities.invokeLater(() -> {
1461 FlatLightLaf.setup();
1463 Console.debug("Using FlatLightLaf");
1466 else if (SystemInfo.isLinux)
1470 UIManager.setLookAndFeel("com.formdev.flatlaf.FlatLightLaf");
1472 Console.debug("Using FlatLightLaf");
1473 } catch (ClassNotFoundException | InstantiationException
1474 | IllegalAccessException | UnsupportedLookAndFeelException e)
1476 Console.debug("Exception loading FlatLightLaf", e);
1478 // enable custom window decorations
1479 JFrame.setDefaultLookAndFeelDecorated(true);
1480 JDialog.setDefaultLookAndFeelDecorated(true);
1481 SwingUtilities.invokeLater(() -> {
1482 FlatLightLaf.setup();
1484 Console.debug("Using FlatLightLaf");
1492 UIManager.setLookAndFeel("com.formdev.flatlaf.FlatLightLaf");
1494 Console.debug("Using FlatLightLaf");
1495 } catch (ClassNotFoundException | InstantiationException
1496 | IllegalAccessException | UnsupportedLookAndFeelException e)
1498 Console.debug("Exception loading FlatLightLaf", e);
1504 UIManager.put("TabbedPane.tabType", "card");
1505 UIManager.put("TabbedPane.showTabSeparators", true);
1506 UIManager.put("TabbedPane.showContentSeparator", true);
1507 UIManager.put("TabbedPane.tabSeparatorsFullHeight", true);
1508 UIManager.put("TabbedPane.tabsOverlapBorder", true);
1509 UIManager.put("TabbedPane.hasFullBorder", true);
1510 UIManager.put("TabbedPane.tabLayoutPolicy", "scroll");
1511 UIManager.put("TabbedPane.scrollButtonsPolicy", "asNeeded");
1512 UIManager.put("TabbedPane.smoothScrolling", true);
1513 UIManager.put("TabbedPane.tabWidthMode", "compact");
1514 UIManager.put("TabbedPane.selectedBackground", Color.white);
1515 UIManager.put("TabbedPane.background", new Color(236, 236, 236));
1516 UIManager.put("TabbedPane.hoverColor", Color.lightGray);
1519 Desktop.setLiveDragMode(Cache.getDefault("FLAT_LIVE_DRAG_MODE", true));
1523 private static boolean setMacLookAndFeel()
1525 boolean set = false;
1526 System.setProperty("com.apple.mrj.application.apple.menu.about.name",
1527 ChannelProperties.getProperty("app_name"));
1528 System.setProperty("apple.laf.useScreenMenuBar", "true");
1530 * broken native LAFs on (ARM?) macbooks
1531 set = setQuaquaLookAndFeel();
1532 if ((!set) || !UIManager.getLookAndFeel().getClass().toString()
1533 .toLowerCase(Locale.ROOT).contains("quaqua"))
1535 set = setVaquaLookAndFeel();
1538 set = setFlatLookAndFeel();
1542 private static boolean setLinuxLookAndFeel()
1544 boolean set = false;
1545 set = setFlatLookAndFeel();
1547 set = setMetalLookAndFeel();
1548 // avoid GtkLookAndFeel -- not good results especially on HiDPI
1550 set = setNimbusLookAndFeel();
1555 private static void showUsage()
1558 "Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
1559 + "-nodisplay\tRun Jalview without User Interface.\n"
1560 + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
1561 + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
1562 + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
1563 + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
1564 + "-features FILE\tUse the given file to mark features on the alignment.\n"
1565 + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
1566 + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
1567 + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
1568 + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
1569 + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
1570 + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
1571 + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
1572 + "-json FILE\tCreate alignment file FILE in JSON format.\n"
1573 + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
1574 + "-png FILE\tCreate PNG image FILE from alignment.\n"
1575 + "-svg FILE\tCreate SVG image FILE from alignment.\n"
1576 + "-html FILE\tCreate HTML file from alignment.\n"
1577 + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n"
1578 + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
1579 + "-eps FILE\tCreate EPS file FILE from alignment.\n"
1580 + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
1581 + "-noquestionnaire\tTurn off questionnaire check.\n"
1582 + "-nonews\tTurn off check for Jalview news.\n"
1583 + "-nousagestats\tTurn off google analytics tracking for this session.\n"
1584 + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
1586 // "-setprop PROPERTY=VALUE\tSet the given Jalview property,
1587 // after all other properties files have been read\n\t
1588 // (quote the 'PROPERTY=VALUE' pair to ensure spaces are
1589 // passed in correctly)"
1590 + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
1591 + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
1592 + "-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"
1593 + "-jvmmempc=PERCENT\tOnly available with standalone executable jar or jalview.bin.Launcher. Limit maximum heap size (memory) to PERCENT% of total physical memory detected. This defaults to 90 if total physical memory can be detected. See https://www.jalview.org/help/html/memory.html for more details.\n"
1594 + "-jvmmemmax=MAXMEMORY\tOnly available with standalone executable jar or jalview.bin.Launcher. Limit maximum heap size (memory) to MAXMEMORY. MAXMEMORY can be specified in bytes, kilobytes(k), megabytes(m), gigabytes(g) or if you're lucky enough, terabytes(t). This defaults to 32g if total physical memory can be detected, or to 8g if total physical memory cannot be detected. See https://www.jalview.org/help/html/memory.html for more details.\n"
1595 + "\n~Read documentation in Application or visit https://www.jalview.org for description of Features and Annotations file~\n\n");
1599 private static void startUsageStats(final Desktop desktop)
1602 * start a User Config prompt asking if we can log usage statistics.
1604 PromptUserConfig prompter = new PromptUserConfig(Desktop.desktop,
1606 MessageManager.getString("prompt.google_analytics_title"),
1607 MessageManager.getString("prompt.google_analytics"),
1614 "Initialising googletracker for usage stats.");
1615 Cache.initGoogleTracker();
1616 Console.debug("Tracking enabled.");
1623 Console.debug("Not enabling Google Tracking.");
1626 desktop.addDialogThread(prompter);
1630 * Locate the given string as a file and pass it to the groovy interpreter.
1632 * @param groovyscript
1633 * the script to execute
1634 * @param jalviewContext
1635 * the Jalview Desktop object passed in to the groovy binding as the
1638 protected void executeGroovyScript(String groovyscript, AlignFrame af)
1641 * for scripts contained in files
1648 if (groovyscript.trim().equals("STDIN"))
1650 // read from stdin into a tempfile and execute it
1653 tfile = File.createTempFile("jalview", "groovy");
1654 PrintWriter outfile = new PrintWriter(
1655 new OutputStreamWriter(new FileOutputStream(tfile)));
1656 BufferedReader br = new BufferedReader(
1657 new InputStreamReader(System.in));
1659 while ((line = br.readLine()) != null)
1661 outfile.write(line + "\n");
1667 } catch (Exception ex)
1669 System.err.println("Failed to read from STDIN into tempfile "
1670 + ((tfile == null) ? "(tempfile wasn't created)"
1671 : tfile.toString()));
1672 ex.printStackTrace();
1677 sfile = tfile.toURI().toURL();
1678 } catch (Exception x)
1681 "Unexpected Malformed URL Exception for temporary file created from STDIN: "
1683 x.printStackTrace();
1691 sfile = new URI(groovyscript).toURL();
1692 } catch (Exception x)
1694 tfile = new File(groovyscript);
1695 if (!tfile.exists())
1697 System.err.println("File '" + groovyscript + "' does not exist.");
1700 if (!tfile.canRead())
1702 System.err.println("File '" + groovyscript + "' cannot be read.");
1705 if (tfile.length() < 1)
1707 System.err.println("File '" + groovyscript + "' is empty.");
1712 sfile = tfile.getAbsoluteFile().toURI().toURL();
1713 } catch (Exception ex)
1715 System.err.println("Failed to create a file URL for "
1716 + tfile.getAbsoluteFile());
1723 Map<String, java.lang.Object> vbinding = new HashMap<>();
1724 vbinding.put("Jalview", this);
1727 vbinding.put("currentAlFrame", af);
1729 Binding gbinding = new Binding(vbinding);
1730 GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
1731 gse.run(sfile.toString(), gbinding);
1732 if ("STDIN".equals(groovyscript))
1734 // delete temp file that we made -
1735 // only if it was successfully executed
1738 } catch (Exception e)
1740 System.err.println("Exception Whilst trying to execute file " + sfile
1741 + " as a groovy script.");
1742 e.printStackTrace(System.err);
1747 public static boolean isHeadlessMode()
1749 String isheadless = System.getProperty("java.awt.headless");
1750 if (isheadless != null && isheadless.equalsIgnoreCase("true"))
1757 public AlignFrame[] getAlignFrames()
1759 return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
1760 : Desktop.getAlignFrames();
1765 * jalview.bin.Jalview.quit() will just run the non-GUI shutdownHook and exit
1769 // System.exit will run the shutdownHook first
1770 Jalview.exit("Quitting now. Bye!", 0);
1773 public static AlignFrame getCurrentAlignFrame()
1775 return Jalview.currentAlignFrame;
1778 public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
1780 Jalview.currentAlignFrame = currentAlignFrame;
1783 protected Commands getCommands()
1788 public static void exit(String message, int exitcode)
1790 if (Console.log == null)
1792 // Don't start the logger just to exit!
1793 if (message != null)
1797 System.out.println(message);
1801 System.err.println(message);
1807 Console.debug("Using Jalview.exit");
1808 if (message != null)
1812 Console.info(message);
1816 Console.error(message);
1822 System.exit(exitcode);
1826 /******************************
1828 * TEST OUTPUT METHODS
1830 ******************************/
1832 * method for reporting string values parsed/processed during tests
1835 protected static void testoutput(ArgParser ap, Arg a, String s1,
1838 BootstrapArgs bsa = ap.getBootstrapArgs();
1839 if (!bsa.getBoolean(Arg.TESTOUTPUT))
1841 if (!((s1 == null && s2 == null) || (s1 != null && s1.equals(s2))))
1843 Console.debug("testoutput with unmatching values '" + s1 + "' and '"
1844 + s2 + "' for arg " + a.argString());
1847 boolean isset = a.hasOption(Opt.BOOTSTRAP) ? bsa.contains(a)
1851 Console.warn("Arg '" + a.getName() + "' not set at all");
1854 testoutput(true, a, s1, s2);
1858 * method for reporting string values parsed/processed during tests
1861 protected static void testoutput(BootstrapArgs bsa, Arg a, String s1,
1864 if (!bsa.getBoolean(Arg.TESTOUTPUT))
1866 if (!((s1 == null && s2 == null) || (s1 != null && s1.equals(s2))))
1868 Console.debug("testoutput with unmatching values '" + s1 + "' and '"
1869 + s2 + "' for arg " + a.argString());
1872 if (!a.hasOption(Opt.BOOTSTRAP))
1874 Console.error("Non-bootstrap Arg '" + a.getName()
1875 + "' given to testoutput(BootstrapArgs bsa, Arg a, String s1, String s2) with only BootstrapArgs");
1877 if (!bsa.contains(a))
1879 Console.warn("Arg '" + a.getName() + "' not set at all");
1882 testoutput(true, a, s1, s2);
1886 * report value set for string values parsed/processed during tests
1888 private static void testoutput(boolean yes, Arg a, String s1, String s2)
1890 if (yes && ((s1 == null && s2 == null)
1891 || (s1 != null && s1.equals(s2))))
1893 System.out.println("[TESTOUTPUT] arg " + a.argString() + "='" + s1
1899 * testoutput for boolean and unary values
1901 protected static void testoutput(ArgParser ap, Arg a)
1905 BootstrapArgs bsa = ap.getBootstrapArgs();
1908 if (!bsa.getBoolean(Arg.TESTOUTPUT))
1910 boolean val = a.hasOption(Opt.BOOTSTRAP) ? bsa.getBoolean(a)
1912 boolean isset = a.hasOption(Opt.BOOTSTRAP) ? bsa.contains(a)
1916 Console.warn("Arg '" + a.getName() + "' not set at all");
1922 protected static void testoutput(BootstrapArgs bsa, Arg a)
1924 if (!bsa.getBoolean(Arg.TESTOUTPUT))
1926 if (!a.hasOption(Opt.BOOTSTRAP))
1928 Console.warn("Non-bootstrap Arg '" + a.getName()
1929 + "' given to testoutput(BootstrapArgs bsa, Arg a) with only BootstrapArgs");
1932 if (!bsa.contains(a))
1934 Console.warn("Arg '" + a.getName() + "' not set at all");
1937 testoutput(bsa.getBoolean(a), a);
1940 private static void testoutput(boolean yes, Arg a)
1942 String message = null;
1943 if (a.hasOption(Opt.BOOLEAN))
1945 message = (yes ? a.argString() : a.negateArgString()) + " was set";
1947 else if (a.hasOption(Opt.UNARY))
1949 message = a.argString() + (yes ? " was set" : " was not set");
1951 System.out.println("[TESTOUTPUT] arg " + message);