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);
}
/**
System.out.println("No files to open!");
System.exit(1);
}
- boolean haveImport = checkStartVamas(aparser);
+ boolean haveImport = false;// checkStartVamas(aparser);
// Finally, deal with the remaining input data.
long progress = -1;
if (file == null && isJavaAppletTag)
System.out.println("CMD [nocalculation] executed successfully!");
}
- AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
+ AlignFrame af = new FileLoader(!headless).LoadFileWaitTillLoaded(file,
protocol, format);
if (af == null)
{
// TODO ?
}
AlignFrame af2 = new FileLoader(!headless)
- .loadFileWaitTillLoaded(file2, protocol, format);
+ .LoadFileWaitTillLoaded(file2, protocol, format);
if (af2 == null)
{
System.out.println("error");
}
startUpAlframe = new FileLoader(!headless)
- .loadFileWaitTillLoaded(file, protocol, format);
+ .LoadFileWaitTillLoaded(file, protocol, format);
// extract groovy arguments before anything else.
}
return null;
}
- private boolean checkStartVamas(ArgsParser aparser)
- {
- String vamsasImport = aparser.getValue(ArgsParser.VDOC);
- String vamsasSession = aparser.getValue(ArgsParser.VSESS);
- if (vamsasImport == null && vamsasSession == null)
- {
- return false;
- }
- if (desktop == null || headless)
- {
- System.out.println(
- "Headless vamsas sessions not yet supported. Sorry.");
- System.exit(1);
- }
- boolean haveImport = (vamsasImport != null);
- if (haveImport)
- {
- // if we have a file, start a new session and import it.
- boolean inSession = false;
- try
- {
- DataSourceType viprotocol = AppletFormatAdapter
- .checkProtocol(vamsasImport);
- if (viprotocol == DataSourceType.FILE)
- {
- inSession = desktop.vamsasImport(new File(vamsasImport));
- }
- else if (viprotocol == DataSourceType.URL)
- {
- inSession = desktop.vamsasImport(new URL(vamsasImport));
- }
-
- } catch (Exception e)
- {
- System.err.println("Exeption when importing " + vamsasImport
- + " as a vamsas document.");
- e.printStackTrace();
- }
- if (!inSession)
- {
- System.err.println("Failed to import " + vamsasImport
- + " as a vamsas document.");
- }
- else
- {
- System.out.println("Imported Successfully into new session "
- + desktop.getVamsasApplication().getCurrentSession());
- }
- }
- if (vamsasSession != null)
- {
- if (vamsasImport != null)
- {
- // close the newly imported session and import the Jalview specific
- // remnants into the new session later on.
- desktop.vamsasStop_actionPerformed(null);
- }
- // now join the new session
- try
- {
- if (desktop.joinVamsasSession(vamsasSession))
- {
- System.out.println(
- "Successfully joined vamsas session " + vamsasSession);
- }
- else
- {
- System.err.println("WARNING: Failed to join vamsas session "
- + vamsasSession);
- }
- } catch (Exception e)
- {
- System.err.println(
- "ERROR: Failed to join vamsas session " + vamsasSession);
- e.printStackTrace();
- }
- if (vamsasImport != null)
- {
- // the Jalview specific remnants can now be imported into the new
- // session at the user's leisure.
- Cache.log.info(
- "Skipping Push for import of data into existing vamsas session.");
- // TODO:
- // enable
- // this
- // when
- // debugged
- // desktop.getVamsasApplication().push_update();
- }
- }
- return haveImport;
- }
-
/**
* Writes an output file for each format (if any) specified in the
* command-line arguments. Supported formats are currently
}
/**
- * Get the SwingJS applet ID and combine that with the frameType
- *
- * @param frameType
- * "alignment", "desktop", etc., or null
- * @return
- */
- public static String getAppID(String frameType)
- {
- String id = Cache.getProperty("Info.j2sAppletID");
- if (id == null)
- {
- id = "jalview";
- }
- return id + (frameType == null ? "" : "-" + frameType);
- }
-
- /**
* Handle all JalviewLite applet parameters
*
* @param aparser
{
alf = getCurrentAlignFrame();
}
- return appLoader.getFeaturesFrom(alf, format);
+ return appLoader.getFeaturesFrom(alf, format, true, false);
}
@Override
// + " " + 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();
+ }
+ }
+
+ /**
+ * Get the SwingJS applet ID and combine that with the frameType
+ *
+ * @param frameType
+ * "alignment", "desktop", etc., or null
+ * @return
+ */
+ public static String getAppID(String frameType)
+ {
+ String id = Cache.getProperty("Info.j2sAppletID");
+ if (id == null)
+ {
+ id = "jalview";
+ }
+ return id + (frameType == null ? "" : "-" + frameType);
+ }
+}
\ No newline at end of file