import java.util.Vector;
import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import groovy.lang.Binding;
private boolean noAnnotation;
+ public static final String TERMINATOR_LINE = "Jalview argument parsing complete.";
+
public boolean getStartCalculations()
{
return !noCalculation;
|| "true".equals(System.getProperty("java.awt.headless")))
{
headless = true;
+ setSynchronous(true);
}
if (isJS)
System.exit(0);
}
-
// anything else!
final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS);
try
{
if (!isJS && Platform.isWin())
- {
+ {
UIManager.setLookAndFeel(
headless ? "javax.swing.plaf.metal.MetalLookAndFeel"
: UIManager.getSystemLookAndFeelClassName());
-// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
} catch (Exception ex)
{
SequenceOntologyFactory.setSequenceOntology(new SequenceOntology());
}
- if (!headless)
+ if (headless)
+ {
+ // If this is not tested, then
+
+ if (aparser.contains(ArgsParser.NOUSAGESTATS))
+ {
+ System.err.println("CMD [-nousagestats] executed successfully!");
+ }
+ if (aparser.contains(ArgsParser.NOQUESTIONNAIRE))
+ {
+ System.err.println("CMD [-noquestionnaire] executed successfully!");
+ }
+
+ }
+ else
{
desktop = Desktop.getInstance();
desktop.setInBatchMode(true); // indicate we are starting up
}
parseArguments(aparser, true);
+ System.err.println(TERMINATOR_LINE);
}
/**
groovyscript = null;
}
}
- checkOutputFile(aparser, af, format);
+ createOutputFiles(aparser, af, format);
while (aparser.getSize() > 0)
{
System.out.println("Unknown arg: " + aparser.nextValue());
return haveImport;
}
- private void checkOutputFile(ArgsParser aparser, AlignFrame af,
+ /**
+ * Writes an output file for each format (if any) specified in the
+ * command-line arguments. Supported formats are currently
+ * <ul>
+ * <li>png</li>
+ * <li>svg</li>
+ * <li>html</li>
+ * <li>biojsmsa</li>
+ * <li>imgMap</li>
+ * <li>eps</li>
+ * </ul>
+ * A format parameter should be followed by a parameter specifying the output
+ * file name. {@code imgMap} parameters should follow those for the
+ * corresponding alignment image output.
+ *
+ * @param aparser
+ * @param af
+ * @param format
+ */
+ private void createOutputFiles(ArgsParser aparser, AlignFrame af,
FileFormatI format)
{
String imageName = "unnamed.png";
while (aparser.getSize() > 1)
{
- // PNG filename
- // SVG filename
- // HTML filename
- // biojsmsa filename
String outputFormat = aparser.nextValue();
String file = aparser.nextValue();
- System.out.println("format " + outputFormat);
+ // System.out.println("format " + outputFormat);
if (outputFormat.equalsIgnoreCase("png"))
{
// + " " + status);
}
-}
+ /**
+ * flag to allow selected Runnable and Thread processes to run synchronously
+ *
+ * JAL-3563
+ *
+ */
+ private static boolean isSynchronous = false;
+
+ /**
+ * Set Jalview to run selected processes synchronously in test and headless
+ * environments.
+ *
+ * JAL-3563
+ *
+ * @param b
+ * @author Bob Hanson
+ */
+ public static void setSynchronous(boolean b)
+ {
+
+ isSynchronous = b;
+
+ }
+
+ /**
+ * Allows optional synchronous running of a Runnable that would otherwise use
+ * SwingUtilities.invokeLater.
+ *
+ * JAL-3563
+ *
+ * @param t
+ * @author Bob Hanson
+ */
+ public static boolean isSynchronous()
+ {
+ return isSynchronous;
+ }
+
+ /**
+ * Allows optional synchronous running of a Runnable that would otherwise use
+ * SwingUtilities.invokeLater.
+ *
+ * JAL-3563
+ *
+ * @param t
+ * @author Bob Hanson
+ */
+ public static void execRunnable(Runnable r)
+ {
+ if (isSynchronous())
+ {
+ r.run();
+ }
+ else
+ {
+ SwingUtilities.invokeLater(r);
+ }
+ }
+
+ /**
+ * Allows optional synchronous running of a thread that would otherwise be run
+ * using start().
+ *
+ * JAL-3563
+ *
+ * @param t
+ * @author Bob Hanson
+ */
+ public static void execThread(Thread t)
+ {
+ if (isSynchronous())
+ {
+ t.run();
+ }
+ else
+ {
+ t.start();
+ }
+ }
+}
\ No newline at end of file