ArgsParser aparser = new ArgsParser(args);
boolean headless = false;
- if (aparser.contains("help") || aparser.contains("h"))
- {
- showUsage();
- System.exit(0);
- }
- if (aparser.contains("nodisplay") || aparser.contains("nogui")
- || aparser.contains("headless"))
- {
- System.setProperty("java.awt.headless", "true");
- headless = true;
- }
String usrPropsFile = aparser.getValue("props");
Cache.loadProperties(usrPropsFile); // must do this before
if (usrPropsFile != null)
"CMD [-props " + usrPropsFile + "] executed successfully!");
}
- // anything else!
-
- final String jabawsUrl = aparser.getValue("jabaws");
- if (jabawsUrl != null)
+ /**
+ * BH 2018 ignoring this section for JS
+ *
+ * @j2sNative
+ */
{
- try
+ if (aparser.contains("help") || aparser.contains("h"))
{
- Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
- System.out.println(
- "CMD [-jabaws " + jabawsUrl + "] executed successfully!");
- } catch (MalformedURLException e)
+ showUsage();
+ System.exit(0);
+ }
+ if (aparser.contains("nodisplay") || aparser.contains("nogui")
+ || aparser.contains("headless"))
{
- System.err.println(
- "Invalid jabaws parameter: " + jabawsUrl + " ignored");
+ System.setProperty("java.awt.headless", "true");
+ headless = true;
+ }
+ // anything else!
+
+ final String jabawsUrl = aparser.getValue("jabaws");
+ if (jabawsUrl != null)
+ {
+ try
+ {
+ Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
+ System.out.println(
+ "CMD [-jabaws " + jabawsUrl + "] executed successfully!");
+ } catch (MalformedURLException e)
+ {
+ System.err.println(
+ "Invalid jabaws parameter: " + jabawsUrl + " ignored");
+ }
}
- }
+ }
String defs = aparser.getValue("setprop");
while (defs != null)
{
desktop = new Desktop();
desktop.setInBatchMode(true); // indicate we are starting up
desktop.setVisible(true);
- desktop.startServiceDiscovery();
- if (!aparser.contains("nousagestats"))
- {
- startUsageStats(desktop);
- }
- else
- {
- System.err.println("CMD [-nousagestats] executed successfully!");
- }
- if (!aparser.contains("noquestionnaire"))
+ /**
+ * BH 2018 JS bypass this section
+ *
+ * @j2sNative
+ *
+ */
{
- String url = aparser.getValue("questionnaire");
- if (url != null)
+ desktop.startServiceDiscovery();
+ if (!aparser.contains("nousagestats"))
{
- // Start the desktop questionnaire prompter with the specified
- // questionnaire
- Cache.log.debug("Starting questionnaire url at " + url);
- desktop.checkForQuestionnaire(url);
- System.out.println(
- "CMD questionnaire[-" + url + "] executed successfully!");
+ startUsageStats(desktop);
}
else
{
- if (Cache.getProperty("NOQUESTIONNAIRES") == null)
+ System.err.println("CMD [-nousagestats] executed successfully!");
+ }
+
+ if (!aparser.contains("noquestionnaire"))
+ {
+ String url = aparser.getValue("questionnaire");
+ if (url != null)
{
// Start the desktop questionnaire prompter with the specified
// questionnaire
- // String defurl =
- // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
- // //
- String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
- Cache.log.debug(
- "Starting questionnaire with default url: " + defurl);
- desktop.checkForQuestionnaire(defurl);
+ Cache.log.debug("Starting questionnaire url at " + url);
+ desktop.checkForQuestionnaire(url);
+ System.out.println("CMD questionnaire[-" + url
+ + "] executed successfully!");
+ }
+ else
+ {
+ if (Cache.getProperty("NOQUESTIONNAIRES") == null)
+ {
+ // Start the desktop questionnaire prompter with the specified
+ // questionnaire
+ // String defurl =
+ // "http://anaplog.compbio.dundee.ac.uk/cgi-bin/questionnaire.pl";
+ // //
+ String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl";
+ Cache.log.debug(
+ "Starting questionnaire with default url: " + defurl);
+ desktop.checkForQuestionnaire(defurl);
+ }
}
}
- }
- else
- {
- System.err.println("CMD [-noquestionnaire] executed successfully!");
- }
+ else
+ {
+ System.err
+ .println("CMD [-noquestionnaire] executed successfully!");
+ }
- if (!aparser.contains("nonews"))
- {
- desktop.checkForNews();
- }
+ if (!aparser.contains("nonews"))
+ {
+ desktop.checkForNews();
+ }
- BioJsHTMLOutput.updateBioJS();
+ BioJsHTMLOutput.updateBioJS();
+ }
}
String file = null, data = null;
}
System.out.println("CMD [-open " + file + "] executed successfully!");
- if (!file.startsWith("http://"))
+ if (!isJS && !file.startsWith("http://"))
{
if (!(new File(file)).exists())
{
}
}
- protocol = AppletFormatAdapter.checkProtocol(file);
+ protocol = AppletFormatAdapter.checkProtocol(file);
try
{
// And the user
// ////////////////////
- if (!headless && file == null && vamsasImport == null
+ if (/** @j2sNative false && */ // BH 2018
+ !headless && file == null && vamsasImport == null
&& jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
{
file = jalview.bin.Cache.getDefault("STARTUP_FILE",
--- /dev/null
+package jalview.bin;
+
+/**
+ * Entry point for JalviewJS development.
+ *
+ *
+ *
+ * @author RM
+ *
+ */
+public class JalviewJS2
+{
+
+ static {
+ /**
+ * @j2sNative
+ *
+ * thisApplet.__Info.args =
+ * ["open","http://www.jalview.org/builds/release/examples/uniref50.fa","features",
+ * "http://www.jalview.org/builds/release/examples/exampleFeatures.txt"];
+ */
+
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ String[] defaultArgs = new String[] { "noquestionnaire" };
+ String[] anew = new String[args.length + defaultArgs.length];
+ for (int i = 0; i < args.length; i++)
+ {
+ anew[i] = args[i];
+ }
+ for (int i = 0; i < defaultArgs.length; i++)
+ {
+ anew[i + args.length] = defaultArgs[i];
+ }
+ Jalview.main(args);
+ }
+
+
+}
if (Desktop.desktop != null)
{
this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
+ /**
+ * BH 2018 ignore service listeners
+ *
+ * @j2sNative
+ *
+ */
+ {
addServiceListeners();
+ }
setGUINucleotide();
}
setBounds((screenSize.width - 900) / 2, (screenSize.height - 650) / 2,
900, 650);
}
- jconsole = new Console(this, showjconsole);
- // add essential build information
- jconsole.setHeader(
- "Jalview Version: " + jalview.bin.Cache.getProperty("VERSION")
- + "\n" + "Jalview Installation: "
- + jalview.bin.Cache.getDefault("INSTALLATION",
- "unknown")
- + "\n" + "Build Date: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
- + "\n" + "Java version: "
- + System.getProperty("java.version") + "\n"
- + System.getProperty("os.arch") + " "
- + System.getProperty("os.name") + " "
- + System.getProperty("os.version"));
+ /**
+ * BH 2018
+ *
+ * @j2sNative
+ */
+ {
- showConsole(showjconsole);
+ jconsole = new Console(this, showjconsole);
+ // add essential build information
+ jconsole.setHeader("Jalview Version: "
+ + jalview.bin.Cache.getProperty("VERSION") + "\n"
+ + "Jalview Installation: "
+ + jalview.bin.Cache.getDefault("INSTALLATION", "unknown")
+ + "\n" + "Build Date: "
+ + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n"
+ + "Java version: " + System.getProperty("java.version") + "\n"
+ + System.getProperty("os.arch") + " "
+ + System.getProperty("os.name") + " "
+ + System.getProperty("os.version"));
- showNews.setVisible(false);
+ showConsole(showjconsole);
- experimentalFeatures.setSelected(showExperimental());
+ showNews.setVisible(false);
- getIdentifiersOrgData();
+ experimentalFeatures.setSelected(showExperimental());
- checkURLLinks();
+ getIdentifiersOrgData();
- this.addWindowListener(new WindowAdapter()
- {
- @Override
- public void windowClosing(WindowEvent evt)
- {
- quit();
- }
- });
-
- MouseAdapter ma;
- this.addMouseListener(ma = new MouseAdapter()
- {
- @Override
- public void mousePressed(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Mac
- {
- showPasteMenu(evt.getX(), evt.getY());
- }
- }
-
- @Override
- public void mouseReleased(MouseEvent evt)
- {
- if (evt.isPopupTrigger()) // Windows
- {
- showPasteMenu(evt.getX(), evt.getY());
- }
- }
- });
- desktop.addMouseListener(ma);
+ checkURLLinks();
this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));
// Spawn a thread that shows the splashscreen
+
SwingUtilities.invokeLater(new Runnable()
{
@Override
}
});
+
+ } // end BH 2018 ignore
+
+ this.addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowClosing(WindowEvent evt)
+ {
+ quit();
+ }
+ });
+
+ MouseAdapter ma;
+ this.addMouseListener(ma = new MouseAdapter()
+ {
+ @Override
+ public void mousePressed(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Mac
+ {
+ showPasteMenu(evt.getX(), evt.getY());
+ }
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Windows
+ {
+ showPasteMenu(evt.getX(), evt.getY());
+ }
+ }
+ });
+ desktop.addMouseListener(ma);
+
}
/**
public void checkForNews()
{
+
+ /**
+ * BH 2018
+ *
+ * @j2sNative
+ */
+ {
final Desktop me = this;
// Thread off the news reader, in case there are connection problems.
addDialogThread(new Runnable()
{
- @Override
- public void run()
- {
- Cache.log.debug("Starting news thread.");
+ @Override
+ public void run()
+ {
+ Cache.log.debug("Starting news thread.");
- jvnews = new BlogReader(me);
- showNews.setVisible(true);
- Cache.log.debug("Completed news thread.");
- }
+ jvnews = new BlogReader(me);
+ showNews.setVisible(true);
+ Cache.log.debug("Completed news thread.");
+ }
});
+ }
}
public void getIdentifiersOrgData()
void showNews(boolean visible)
{
+ /**
+ * BH 2018
+ *
+ * @j2sNative
+ *
+ */
{
Cache.log.debug((visible ? "Showing" : "Hiding") + " news.");
showNews.setSelected(visible);
private void doVamsasClientCheck()
{
- if (jalview.bin.Cache.vamsasJarsPresent())
+ if (/** @j2sNative false && */ // BH 2018
+ jalview.bin.Cache.vamsasJarsPresent())
{
setupVamsasDisconnectedGui();
VamsasMenu.setVisible(true);
*/
void showConsole(boolean selected)
{
- showConsole.setSelected(selected);
// TODO: decide if we should update properties file
- Cache.setProperty("SHOW_JAVA_CONSOLE",
- Boolean.valueOf(selected).toString());
- jconsole.setVisible(selected);
+ if (jconsole != null) // BH 2018
+ {
+ showConsole.setSelected(selected);
+ Cache.setProperty("SHOW_JAVA_CONSOLE",
+ Boolean.valueOf(selected).toString());
+ jconsole.setVisible(selected);
+ }
}
void reorderAssociatedWindows(boolean minimize, boolean close)
@Override
public void run()
{
- if (Cache.getDefault("CHECKURLLINKS", true))
+ if (/** @j2sNative false && */ // BH 2018
+ Cache.getDefault("CHECKURLLINKS", true))
{
// check what the actual links are - if it's just the default don't
// bother with the warning
{
protocol = DataSourceType.URL;
}
+ else if (jalview.bin.Jalview.isJS)
+ {
+ protocol = DataSourceType.RELATIVE_URL;
+ }
else if (new File(data).exists())
{
protocol = DataSourceType.FILE;
public enum DataSourceType
{
- FILE, URL, PASTE, CLASSLOADER, LOCALURL;
+ FILE, URL, PASTE, CLASSLOADER, RELATIVE_URL;
}
}
}
}
- else if (sourceType == DataSourceType.LOCALURL)
+ else if (sourceType == DataSourceType.RELATIVE_URL)
{
String data = null;
/**