*/
package jalview.bin;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.AllPermission;
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.swing.LookAndFeel;
+import javax.swing.UIManager;
+
+import com.threerings.getdown.util.LaunchUtil;
+
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
import jalview.api.AlignCalcWorkerI;
import jalview.api.AlignViewportI;
import jalview.api.JalviewApp;
import jalview.datamodel.SequenceI;
import jalview.ext.so.SequenceOntology;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.CalculationChooser;
import jalview.gui.Desktop;
+import jalview.gui.Preferences;
import jalview.gui.PromptUserConfig;
import jalview.gui.StructureViewer;
import jalview.io.AppletFormatAdapter;
import jalview.io.FileFormat;
import jalview.io.FileFormatException;
import jalview.io.FileFormatI;
+import jalview.io.FileFormats;
import jalview.io.FileLoader;
import jalview.io.HtmlSvgOutput;
import jalview.io.IdentifyFile;
import jalview.ws.jws2.Jws2Discoverer;
import netscape.javascript.JSObject;
-import java.applet.AppletContext;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.AllPermission;
-import java.security.CodeSource;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Policy;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Vector;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.swing.LookAndFeel;
-import javax.swing.UIManager;
-
-import com.threerings.getdown.util.LaunchUtil;
-
-import groovy.lang.Binding;
-import groovy.util.GroovyScriptEngine;
-
/**
* Main class for Jalview Application <br>
* <br>
Platform.getURLCommandArguments();
}
+ private boolean headless;
+
// singleton instance of this class
private static Jalview instance;
return !noAnnotation;
}
-
static
{
if (!Platform.isJS())
*/
{
// grab all the rights we can for the JVM
- Policy.setPolicy(new Policy()
- {
- @Override
- public PermissionCollection getPermissions(CodeSource codesource)
- {
- Permissions perms = new Permissions();
- perms.add(new AllPermission());
- return (perms);
- }
-
- @Override
- public void refresh()
- {
- }
- });
+ Policy.setPolicy(new Policy()
+ {
+ @Override
+ public PermissionCollection getPermissions(CodeSource codesource)
+ {
+ Permissions perms = new Permissions();
+ perms.add(new AllPermission());
+ return (perms);
+ }
+
+ @Override
+ public void refresh()
+ {
+ }
+ });
}
}
{
return instance;
}
+
+
+ private final static boolean doPlatformLogging = false;
/**
* main class for Jalview application
*
* @param args
- * open <em>filename</em>
+ * open <em>filename</em>
*/
public static void main(String[] args)
{
- if (false)
+ if (doPlatformLogging)
{
Platform.startJavaLogging();
}
instance = new Jalview();
instance.doMain(args);
-}
+ }
/**
* @param args
void doMain(String[] args)
{
- if (!Platform.isJS())
+ boolean isJS = Platform.isJS();
+ if (isJS)
+ {
+ Platform.setAppClass(this);
+ }
+ else
{
System.setSecurityManager(null);
}
System.out
- .println("Java version: "
- + System.getProperty("java.version"));
+ .println("Java version: " + System.getProperty("java.version"));
System.out.println("Java Home: " + System.getProperty("java.home"));
System.out.println(System.getProperty("os.arch") + " "
+ System.getProperty("os.name") + " "
+ System.getProperty("os.version"));
String val = System.getProperty("sys.install4jVersion");
- if (val != null) {
- System.out.println("Install4j version: " + val);
+ if (val != null)
+ {
+ System.out.println("Install4j version: " + val);
}
val = System.getProperty("installer_template_version");
- if (val != null) {
+ if (val != null)
+ {
System.out.println("Install4j template version: " + val);
}
val = System.getProperty("launcher_version");
- if (val != null) {
+ if (val != null)
+ {
System.out.println("Launcher version: " + val);
}
Cache.loadBuildProperties(true);
ArgsParser aparser = new ArgsParser(args);
- boolean headless = false;
+ headless = false;
String usrPropsFile = aparser.getValue("props");
+
Cache.loadProperties(usrPropsFile); // must do this before
- if (usrPropsFile != null)
+
+ if (isJS)
{
+ isJavaAppletTag = aparser.isApplet();
+ if (isJavaAppletTag)
+ {
+ Preferences.setAppletDefaults();
+ Cache.loadProperties(usrPropsFile); // again, because we
+ // might be changing defaults here?
+ }
System.out.println(
- "CMD [-props " + usrPropsFile + "] executed successfully!");
+ "<Applet> found: " + aparser.getValue("Info.j2sAppletID"));
+ appletResourcePath = aparser.getValue("Info.resourcePath");
}
-
- if (!Platform.isJS())
+ else
/**
* Java only
*
* @j2sIgnore
*/
{
+
+ if (usrPropsFile != null)
+ {
+ System.out.println(
+ "CMD [-props " + usrPropsFile + "] executed successfully!");
+ }
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;
}
+ // <<?
+
// anything else!
- final String jabawsUrl = aparser.getValue("jabaws");
+ final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS);
if (jabawsUrl != null)
{
try
}
}
- String defs = aparser.getValue("setprop");
+ String defs = aparser.getValue(ArgsParser.SETPROP);
while (defs != null)
{
int p = defs.indexOf('=');
else
{
System.out.println("Executing setprop argument: " + defs);
- if (Platform.isJS())
+ if (isJS)
{
- Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
+ Cache.setProperty(defs.substring(0, p), defs.substring(p + 1));
}
}
defs = aparser.getValue("setprop");
desktop = null;
- try
- {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception ex)
- {
- System.err.println("Unexpected Look and Feel Exception");
- ex.printStackTrace();
- }
- if (Platform.isAMacAndNotJS())
+ if (!isJS)
+ /** @j2sIgnore */
{
-
- LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager
- .getLookAndFeel();
- System.setProperty("com.apple.mrj.application.apple.menu.about.name",
- "Jalview");
- System.setProperty("apple.laf.useScreenMenuBar", "true");
- if (lookAndFeel != null)
+ try
{
- try
- {
- UIManager.setLookAndFeel(lookAndFeel);
- } catch (Throwable e)
- {
- System.err.println(
- "Failed to set QuaQua look and feel: " + e.toString());
- }
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception ex)
+ {
+ System.err.println("Unexpected Look and Feel Exception");
+ ex.printStackTrace();
}
- if (lookAndFeel == null
- || !(lookAndFeel.getClass().isAssignableFrom(
- UIManager.getLookAndFeel().getClass()))
- || !UIManager.getLookAndFeel().getClass().toString()
- .toLowerCase().contains("quaqua"))
+ if (Platform.isMac())
{
- try
+
+ LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager
+ .getLookAndFeel();
+ System.setProperty(
+ "com.apple.mrj.application.apple.menu.about.name",
+ "Jalview");
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ if (lookAndFeel != null)
{
- System.err.println(
- "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976");
- UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
- } catch (Throwable e)
+ try
+ {
+ UIManager.setLookAndFeel(lookAndFeel);
+ } catch (Throwable e)
+ {
+ System.err.println(
+ "Failed to set QuaQua look and feel: " + e.toString());
+ }
+ }
+ if (lookAndFeel == null
+ || !(lookAndFeel.getClass().isAssignableFrom(
+ UIManager.getLookAndFeel().getClass()))
+ || !UIManager.getLookAndFeel().getClass().toString()
+ .toLowerCase().contains("quaqua"))
{
- System.err.println(
- "Failed to reset look and feel: " + e.toString());
+ try
+ {
+ System.err.println(
+ "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976");
+ UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
+ } catch (Throwable e)
+ {
+ System.err.println(
+ "Failed to reset look and feel: " + e.toString());
+ }
}
}
}
-
/*
* configure 'full' SO model if preferences say to, else use the default (full SO)
* - as JS currently doesn't have OBO parsing, it must use 'Lite' version
}
}
- // Move any new getdown-launcher-new.jar into place over old
- // getdown-launcher.jar
- String appdirString = System.getProperty("getdownappdir");
- if (appdirString != null && appdirString.length() > 0)
+ parseArguments(aparser, true);
+ }
+
+ /**
+ * Allow an outside entity to initiate the second half of argument parsing
+ * (only).
+ *
+ * @param args
+ * @return null is good
+ */
+ @Override
+ public Object parseArguments(String[] args)
+ {
+
+ try
{
- final File appdir = new File(appdirString);
- new Thread()
- {
- @Override
- public void run()
- {
- LaunchUtil.upgradeGetdown(
- new File(appdir, "getdown-launcher-old.jar"),
- new File(appdir, "getdown-launcher.jar"),
- new File(appdir, "getdown-launcher-new.jar"));
- }
- }.start();
+ parseArguments(new ArgsParser(args), false);
+ return null;
+ } catch (Throwable t)
+ {
+ return t;
}
+ }
- String file = null, data = null;
- FileFormatI format = null;
- DataSourceType protocol = null;
- FileLoader fileLoader = new FileLoader(!headless);
+ /**
+ *
+ * @param aparser
+ * @param isStartup
+ */
+ private void parseArguments(ArgsParser aparser, boolean isStartup)
+ {
String groovyscript = null; // script to execute after all loading is
- // completed one way or another
- // extract groovy argument and execute if necessary
- groovyscript = aparser.getValue("groovy", true);
- file = aparser.getValue("open", true);
+ boolean isJS = Platform.isJS();
+ if (!isJS)
+ /** @j2sIgnore */
+ {
+ // Move any new getdown-launcher-new.jar into place over old
+ // getdown-launcher.jar
+ String appdirString = System.getProperty("getdownappdir");
+ if (appdirString != null && appdirString.length() > 0)
+ {
+ final File appdir = new File(appdirString);
+ new Thread()
+ {
+ @Override
+ public void run()
+ {
+ LaunchUtil.upgradeGetdown(
+ new File(appdir, "getdown-launcher-old.jar"),
+ new File(appdir, "getdown-launcher.jar"),
+ new File(appdir, "getdown-launcher-new.jar"));
+ }
+ }.start();
+ }
+
+ // completed one way or another
+ // extract groovy argument and execute if necessary
+ groovyscript = aparser.getValue("groovy", true);
+
+ }
+
+ String file = aparser.getValue("open", true);
if (file == null && desktop == null)
{
System.out.println("No files to open!");
System.exit(1);
}
+
long progress = -1;
+ DataSourceType protocol = null;
+ FileLoader fileLoader = new FileLoader(!headless);
+ FileFormatI format = null;
// Finally, deal with the remaining input data.
if (file != null)
{
System.out.println("CMD [-open " + file + "] executed successfully!");
if (!Platform.isJS())
- /**
- * ignore in JavaScript -- can't just file existence - could load it?
- *
- * @j2sIgnore
- */
+ /**
+ * ignore in JavaScript -- can't just file existence - could load it?
+ *
+ * @j2sIgnore
+ */
{
if (!file.startsWith("http://") && !file.startsWith("https://"))
// BH 2019 added https check for Java
}
}
}
-
- protocol = AppletFormatAdapter.checkProtocol(file);
-
+ String fileFormat = (isJavaAppletTag
+ ? aparser.getAppletValue("format", null)
+ : null);
+ protocol = AppletFormatAdapter.checkProtocol(file);
try
{
+ format = (isJavaAppletTag && fileFormat != null
+ ? FileFormats.getInstance().forName(fileFormat)
+ : null);
+ if (format == null)
+ {
+ format = new IdentifyFile().identify(file, protocol);
+ }
format = new IdentifyFile().identify(file, protocol);
} catch (FileFormatException e1)
{
// TODO ?
}
- AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
- format);
+ if (aparser.contains(ArgsParser.NOMENUBAR))
+ {
+ noMenuBar = true;
+ System.out.println("CMD [nomenu] executed successfully!");
+ }
+
+ if (aparser.contains(ArgsParser.NOSTATUS))
+ {
+ noStatus = true;
+ System.out.println("CMD [nostatus] executed successfully!");
+ }
+
+ if (aparser.contains(ArgsParser.NOANNOTATION)
+ || aparser.contains(ArgsParser.NOANNOTATION2))
+ {
+ noAnnotation = true;
+ System.out.println("CMD no-annotation executed successfully!");
+ }
+ if (aparser.contains(ArgsParser.NOCALCULATION))
+ {
+ noCalculation = true;
+ System.out.println("CMD [nocalculation] executed successfully!");
+ }
+
+ AlignFrame af = new FileLoader(!headless).LoadFileWaitTillLoaded(file,
+ protocol, format);
if (af == null)
{
System.out.println("error");
}
else
{
+
+ // JalviewLite interface for JavaScript allows second file open
+ String file2 = aparser.getValue(ArgsParser.OPEN2, true);
+ if (file2 != null)
+ {
+ protocol = AppletFormatAdapter.checkProtocol(file2);
+ try
+ {
+ format = new IdentifyFile().identify(file2, protocol);
+ } catch (FileFormatException e1)
+ {
+ // TODO ?
+ }
+ AlignFrame af2 = new FileLoader(!headless)
+ .LoadFileWaitTillLoaded(file2, protocol, format);
+ if (af2 == null)
+ {
+ System.out.println("error");
+ }
+ else
+ {
+ AlignViewport.openLinkedAlignmentAs(af,
+ af.getViewport().getAlignment(),
+ af2.getViewport().getAlignment(), "",
+ AlignViewport.SPLIT_FRAME);
+ System.out.println(
+ "CMD [-open2 " + file2 + "] executed successfully!");
+ }
+ }
setCurrentAlignFrame(af);
- data = aparser.getValue("colour", true);
+
+ String data = aparser.getValue(ArgsParser.COLOUR, true);
if (data != null)
{
data.replaceAll("%20", " ");
}
// Must maintain ability to use the groups flag
- data = aparser.getValue("groups", true);
+ data = aparser.getValue(ArgsParser.GROUPS, true);
if (data != null)
{
af.parseFeaturesFile(data,
System.out.println(
"CMD groups[-" + data + "] executed successfully!");
}
- data = aparser.getValue("features", true);
+ data = aparser.getValue(ArgsParser.FEATURES, true);
if (data != null)
{
af.parseFeaturesFile(data,
System.out.println(
"CMD [-features " + data + "] executed successfully!");
}
-
- data = aparser.getValue("annotations", true);
+ data = aparser.getValue(ArgsParser.ANNOTATIONS, true);
if (data != null)
{
af.loadJalviewDataFile(data, null, null, null);
System.out.println(
"CMD [-annotations " + data + "] executed successfully!");
}
+
+ // JavaScript feature
+
+ if (aparser.contains(ArgsParser.SHOWOVERVIEW))
+ {
+ af.overviewMenuItem_actionPerformed(null);
+ System.out.println("CMD [showoverview] executed successfully!");
+ }
+
// set or clear the sortbytree flag.
- if (aparser.contains("sortbytree"))
+ if (aparser.contains(ArgsParser.SORTBYTREE))
{
af.getViewport().setSortByTree(true);
if (af.getViewport().getSortByTree())
System.out.println("CMD [-sortbytree] executed successfully!");
}
}
- if (aparser.contains("no-annotation"))
+
+ boolean doUpdateAnnotation = false;
+ /**
+ * we do this earlier in JalviewJS because of a complication with
+ * SHOWOVERVIEW
+ *
+ * For now, just fixing this in JalviewJS.
+ *
+ *
+ * @j2sIgnore
+ *
+ */
{
- af.getViewport().setShowAnnotation(false);
- if (!af.getViewport().isShowAnnotation())
+ if (aparser.contains(ArgsParser.NOANNOTATION)
+ || aparser.contains(ArgsParser.NOANNOTATION2))
{
- System.out.println("CMD no-annotation executed successfully!");
+ af.getViewport().setShowAnnotation(false);
+ if (!af.getViewport().isShowAnnotation())
+ {
+ doUpdateAnnotation = true;
+ System.out
+ .println("CMD no-annotation executed successfully!");
+ }
}
}
- if (aparser.contains("nosortbytree"))
+
+
+ if (aparser.contains(ArgsParser.NOSORTBYTREE))
{
af.getViewport().setSortByTree(false);
if (!af.getViewport().getSortByTree())
{
+ doUpdateAnnotation = true;
System.out
.println("CMD [-nosortbytree] executed successfully!");
}
}
- data = aparser.getValue("tree", true);
+ if (doUpdateAnnotation)
+ { // BH 2019.07.24
+ af.setMenusForViewport();
+ af.alignPanel.updateLayout();
+ }
+
+ data = aparser.getValue(ArgsParser.TREE, true);
if (data != null)
{
try
// TODO - load PDB structure(s) to alignment JAL-629
// (associate with identical sequence in alignment, or a specified
// sequence)
- if (groovyscript != null)
+ if (isJavaAppletTag)
{
- // Execute the groovy script after we've done all the rendering stuff
- // and before any images or figures are generated.
- System.out.println("Executing script " + groovyscript);
- executeGroovyScript(groovyscript, af);
- System.out.println("CMD groovy[" + groovyscript
- + "] executed successfully!");
- groovyscript = null;
+ loadAppletParams(aparser, af);
}
- String imageName = "unnamed.png";
- while (aparser.getSize() > 1)
+ else if (!isJS)
+ /**
+ * Java only
+ *
+ * @j2sIgnore
+ */
{
- String outputFormat = aparser.nextValue();
- file = aparser.nextValue();
-
- if (outputFormat.equalsIgnoreCase("png"))
- {
- af.createPNG(new File(file));
- imageName = (new File(file)).getName();
- System.out.println("Creating PNG image: " + file);
- continue;
- }
- else if (outputFormat.equalsIgnoreCase("svg"))
- {
- File imageFile = new File(file);
- imageName = imageFile.getName();
- af.createSVG(imageFile);
- System.out.println("Creating SVG image: " + file);
- continue;
- }
- else if (outputFormat.equalsIgnoreCase("html"))
- {
- File imageFile = new File(file);
- imageName = imageFile.getName();
- HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
- htmlSVG.exportHTML(file);
-
- System.out.println("Creating HTML image: " + file);
- continue;
- }
- else if (outputFormat.equalsIgnoreCase("biojsmsa"))
- {
- if (file == null)
- {
- System.err.println("The output html file must not be null");
- return;
- }
- try
- {
- BioJsHTMLOutput.refreshVersionInfo(
- BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
- } catch (URISyntaxException e)
- {
- e.printStackTrace();
- }
- BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
- bjs.exportHTML(file);
- System.out
- .println("Creating BioJS MSA Viwer HTML file: " + file);
- continue;
- }
- else if (outputFormat.equalsIgnoreCase("imgMap"))
- {
- af.createImageMap(new File(file), imageName);
- System.out.println("Creating image map: " + file);
- continue;
- }
- else if (outputFormat.equalsIgnoreCase("eps"))
- {
- File outputFile = new File(file);
- System.out.println(
- "Creating EPS file: " + outputFile.getAbsolutePath());
- af.createEPS(outputFile);
- continue;
- }
-
- af.saveAlignment(file, format);
- if (af.isSaveAlignmentSuccessful())
- {
- System.out.println("Written alignment in " + format
- + " format to " + file);
- }
- else
+ if (groovyscript != null)
{
- System.out.println("Error writing file " + file + " in "
- + format + " format!!");
+ // Execute the groovy script after we've done all the rendering
+ // stuff
+ // and before any images or figures are generated.
+ System.out.println("Executing script " + groovyscript);
+ executeGroovyScript(groovyscript, af);
+ System.out.println("CMD groovy[" + groovyscript
+ + "] executed successfully!");
+ groovyscript = null;
}
-
}
-
+ createOutputFiles(aparser, af, format);
while (aparser.getSize() > 0)
{
System.out.println("Unknown arg: " + aparser.nextValue());
}
}
}
+
+
AlignFrame startUpAlframe = null;
// We'll only open the default file if the desktop is visible.
// And the user
// ////////////////////
- if (!Platform.isJS() && !headless && file == null
+ if (!isJS && !headless && file == null
&& Cache.getDefault("SHOW_STARTUP_FILE", true))
/**
* Java only
*/
{
file = Cache.getDefault("STARTUP_FILE",
- Cache.getDefault("www.jalview.org",
- "http://www.jalview.org")
+ Cache.getDefault("www.jalview.org", "http://www.jalview.org")
+ "/examples/exampleFile_2_7.jar");
if (file.equals(
"http://www.jalview.org/examples/exampleFile_2_3.jar"))
startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
format);
- // extract groovy arguments before anything else.
- }
+ }
+
+ // extract groovy arguments before anything else.
// Once all other stuff is done, execute any groovy scripts (in order)
if (groovyscript != null)
{
+ groovyscript);
}
}
+
// and finally, turn off batch mode indicator - if the desktop still exists
if (desktop != null)
{
}
}
+ /**
+ * 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)
+ {
+ String outputFormat = aparser.nextValue();
+ String file = aparser.nextValue();
+
+ if (outputFormat.equalsIgnoreCase("png"))
+ {
+ af.createPNG(new File(file));
+ imageName = (new File(file)).getName();
+ System.out.println("Creating PNG image: " + file);
+ continue;
+ }
+ else if (outputFormat.equalsIgnoreCase("svg"))
+ {
+ File imageFile = new File(file);
+ imageName = imageFile.getName();
+ af.createSVG(imageFile);
+ System.out.println("Creating SVG image: " + file);
+ continue;
+ }
+ else if (outputFormat.equalsIgnoreCase("html"))
+ {
+ File imageFile = new File(file);
+ imageName = imageFile.getName();
+ HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
+ htmlSVG.exportHTML(file);
+ System.out.println("Creating HTML image: " + file);
+ continue;
+ }
+ else if (outputFormat.equalsIgnoreCase("biojsmsa"))
+ {
+ if (file == null)
+ {
+ System.err.println("The output html file must not be null");
+ return;
+ }
+ try
+ {
+ BioJsHTMLOutput.refreshVersionInfo(
+ BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
+ } catch (URISyntaxException e)
+ {
+ e.printStackTrace();
+ }
+ BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
+ bjs.exportHTML(file);
+ System.out.println("Creating BioJS MSA Viwer HTML file: " + file);
+ continue;
+ }
+ else if (outputFormat.equalsIgnoreCase("imgMap"))
+ {
+ af.createImageMap(new File(file), imageName);
+ System.out.println("Creating image map: " + file);
+ continue;
+ }
+ else if (outputFormat.equalsIgnoreCase("eps"))
+ {
+ File outputFile = new File(file);
+ System.out.println(
+ "Creating EPS file: " + outputFile.getAbsolutePath());
+ af.createEPS(outputFile);
+ continue;
+ }
+
+ af.saveAlignment(file, format);
+ if (af.isSaveAlignmentSuccessful())
+ {
+ System.out.println(
+ "Written alignment in " + format + " format to " + file);
+ }
+ else
+ {
+ System.out.println("Error writing file " + file + " in " + format
+ + " format!!");
+ }
+
+ }
+
+ }
+
private static void showUsage()
{
System.out.println(
* Locate the given string as a file and pass it to the groovy interpreter.
*
* @param groovyscript
- * the script to execute
+ * the script to execute
* @param jalviewContext
- * the Jalview Desktop object passed in to the groovy
- * binding as the 'Jalview' object.
+ * the Jalview Desktop object passed in to the groovy binding as the
+ * 'Jalview' object.
*/
private void executeGroovyScript(String groovyscript, AlignFrame af)
{
}
/**
- * Quit method delegates to Desktop.quit - unless running in headless mode when
- * it just ends the JVM
+ * Quit method delegates to Desktop.quit - unless running in headless mode
+ * when it just ends the JVM
*/
public void quit()
{
{
Jalview.currentAlignFrame = currentAlignFrame;
}
-
+
/**
* Get the SwingJS applet ID and combine that with the frameType
*
: jsExecQueue);
}
- @Override
- public AppletContext getAppletContext()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
+// AppletContext deprecated
+//
+// @Override
+// public AppletContext getAppletContext()
+// {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
@Override
public boolean isJsfallbackEnabled()
{
public void highlight(String sequenceId, String position,
String alignedPosition)
{
- highlightIn(null, sequenceId, position,
- alignedPosition);
+ highlightIn(null, sequenceId, position, alignedPosition);
}
@Override
public String getSelectedSequencesAsAlignment(String format,
String suffix)
{
- return getSelectedSequencesAsAlignmentFrom(null,
- format, suffix);
+ return getSelectedSequencesAsAlignmentFrom(null, format, suffix);
}
@Override
return appLoader.getAnnotationFrom(alf);
}
-// @Override
-// public AlignFrame newView()
-// {
-// return newViewFrom(null, null);
-// }
-//
-// @Override
-// public AlignFrame newView(String name)
-// {
-// return newViewFrom(null, name);
-// }
-//
-// @Override
-// public AlignFrame newViewFrom(AlignFrame alf)
-// {
-// return newViewFrom(alf, null);
-// }
-//
-// @Override
-// public AlignFrame newViewFrom(AlignFrame alf, String name)
-// {
-// if (alf == null)
-// {
-// alf = getCurrentAlignFrame();
-// }
-// return appLoader.newViewFrom(alf, name);
-// }
+ // @Override
+ // public AlignFrame newView()
+ // {
+ // return newViewFrom(null, null);
+ // }
+ //
+ // @Override
+ // public AlignFrame newView(String name)
+ // {
+ // return newViewFrom(null, name);
+ // }
+ //
+ // @Override
+ // public AlignFrame newViewFrom(AlignFrame alf)
+ // {
+ // return newViewFrom(alf, null);
+ // }
+ //
+ // @Override
+ // public AlignFrame newViewFrom(AlignFrame alf, String name)
+ // {
+ // if (alf == null)
+ // {
+ // alf = getCurrentAlignFrame();
+ // }
+ // return appLoader.newViewFrom(alf, name);
+ // }
@Override
public AlignFrame loadAlignment(String text, String title)
public String getSelectedSequencesAsAlignment(String format,
boolean suffix)
{
- return getSelectedSequencesAsAlignmentFrom(null,
- format, suffix);
+ return getSelectedSequencesAsAlignmentFrom(null, format, suffix);
}
@Override
// + " " + status);
}
- @Override
- public Object parseArguments(String[] args)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
-
-
-
}