public static AlignFrame currentAlignFrame;
- public static boolean isJS = /** @j2sNative true || */ // BH 2018
- false;
+ /**
+ * Answers true if Jalview is running as Javascript, else false. The value is
+ * set at compile time.
+ *
+ * @return
+ */
+ public static boolean isJS()
+ {
+ return /** @j2sNative true || */
+ false;
+ }
static
{
-
- if (!isJS)
+ if (!isJS())
{ // BH 2018
// grab all the rights we can the JVM
Policy.setPolicy(new Policy()
void doMain(String[] args)
{
- if (!isJS)
+ if (!isJS())
{
System.setSecurityManager(null);
}
}
System.out.println("CMD [-open " + file + "] executed successfully!");
- if (!isJS && !file.startsWith("http://"))
+ if (!isJS() && !file.startsWith("http://"))
{
if (!(new File(file)).exists())
{
import jalview.jbgui.GStructureViewer;
import jalview.structure.StructureSelectionManager;
import jalview.urls.IdOrgSettings;
+import jalview.util.BrowserLauncher;
import jalview.util.ImageMaker.TYPE;
import jalview.util.MessageManager;
import jalview.util.Platform;
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * Action on requesting Help documentation
*/
@Override
- public void documentationMenuItem_actionPerformed(ActionEvent e)
+ public void documentationMenuItem_actionPerformed()
{
try
{
- Help.showHelpWindow();
+ if (Jalview.isJS())
+ {
+ BrowserLauncher.openURL("http://www.jalview.org/help.html");
+ }
+ else
+ {
+ Help.showHelpWindow();
+ }
} catch (Exception ex)
{
+ System.err.println("Error opening help: " + ex.getMessage());
}
}
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * Prompts the user to choose a file and then saves the Jalview state as a
+ * Jalview project file
*/
@Override
- public void saveState_actionPerformed(ActionEvent e)
+ public void saveState_actionPerformed()
{
- // TODO: JAL-3048 not needed for Jalview-JS
-
JalviewFileChooser chooser = new JalviewFileChooser("jvp",
"Jalview Project");
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * Prompts the user to choose a file and loads in as a Jalview project file
*/
@Override
- public void loadState_actionPerformed(ActionEvent e)
+ public void loadState_actionPerformed()
{
- // TODO: JAL-3048 not needed for Jalview-JS
-
JalviewFileChooser chooser = new JalviewFileChooser(
Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "jvp", "jar" },
{
protocol = DataSourceType.URL;
}
- else if (jalview.bin.Jalview.isJS)
+ else if (jalview.bin.Jalview.isJS())
{
protocol = DataSourceType.RELATIVE_URL;
}
import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.api.SplitContainerI;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
import jalview.io.FileFormats;
alignFrameMenuBar.add(formatMenu);
alignFrameMenuBar.add(colourMenu);
alignFrameMenuBar.add(calculateMenu);
- alignFrameMenuBar.add(webService);
+ if (!Jalview.isJS())
+ {
+ alignFrameMenuBar.add(webService);
+ }
fileMenu.add(fetchSequence);
fileMenu.add(addSequenceMenu);
fileMenu.add(exportAnnotations);
fileMenu.add(loadTreeMenuItem);
fileMenu.add(associatedData);
- /*
- * No VCF import in Jalview-JS
- * @j2sNative
- */
+ if (!Jalview.isJS())
{
fileMenu.add(loadVcf);
}
hideMenu.add(hideAllSelection);
hideMenu.add(hideAllButSelection);
viewMenu.add(newView);
- viewMenu.add(expandViews);
- viewMenu.add(gatherViews);
+ if (!Jalview.isJS())
+ {
+ viewMenu.add(expandViews);
+ viewMenu.add(gatherViews);
+ }
viewMenu.addSeparator();
viewMenu.add(showMenu);
viewMenu.add(hideMenu);
calculateMenu.addSeparator();
calculateMenu.add(expandAlignment);
calculateMenu.add(extractScores);
- calculateMenu.addSeparator();
- calculateMenu.add(runGroovy);
+ if (!Jalview.isJS())
+ {
+ calculateMenu.addSeparator();
+ calculateMenu.add(runGroovy);
+ }
webServiceNoServices = new JMenuItem(
MessageManager.getString("label.no_services"));
webService.add(webServiceNoServices);
- exportImageMenu.add(htmlMenuItem);
+ if (!Jalview.isJS())
+ {
+ exportImageMenu.add(htmlMenuItem);
+ }
exportImageMenu.add(epsFile);
exportImageMenu.add(createPNG);
exportImageMenu.add(createBioJS);
- exportImageMenu.add(createSVG);
+ if (!Jalview.isJS())
+ {
+ exportImageMenu.add(createSVG);
+ }
addSequenceMenu.add(addFromFile);
addSequenceMenu.add(addFromText);
addSequenceMenu.add(addFromURL);
package jalview.jbgui;
import jalview.api.AlignmentViewPanel;
+import jalview.bin.Jalview;
import jalview.io.FileFormatException;
import jalview.util.MessageManager;
import jalview.util.Platform;
@Override
public void actionPerformed(ActionEvent e)
{
- documentationMenuItem_actionPerformed(e);
+ documentationMenuItem_actionPerformed();
}
});
this.getContentPane().setLayout(flowLayout1);
@Override
public void actionPerformed(ActionEvent e)
{
- saveState_actionPerformed(e);
+ saveState_actionPerformed();
}
});
loadState.setText(MessageManager.getString("action.load_project"));
@Override
public void actionPerformed(ActionEvent e)
{
- loadState_actionPerformed(e);
+ loadState_actionPerformed();
}
});
inputMenu.setText(MessageManager.getString("label.input_alignment"));
desktopMenubar.add(windowMenu);
FileMenu.add(inputMenu);
FileMenu.add(inputSequence);
- FileMenu.addSeparator();
- FileMenu.add(saveState);
- FileMenu.add(loadState);
+ if (!Jalview.isJS())
+ {
+ FileMenu.addSeparator();
+ FileMenu.add(saveState);
+ FileMenu.add(loadState);
+ }
FileMenu.addSeparator();
FileMenu.add(quit);
HelpMenu.add(aboutMenuItem);
VamsasMenu.add(vamsasSave);
VamsasMenu.add(vamsasStop);
toolsMenu.add(preferences);
- toolsMenu.add(showMemusage);
- toolsMenu.add(showConsole);
+ if (!Jalview.isJS())
+ {
+ toolsMenu.add(showMemusage);
+ toolsMenu.add(showConsole);
+ }
toolsMenu.add(showNews);
- toolsMenu.add(garbageCollect);
- toolsMenu.add(groovyShell);
+ if (!Jalview.isJS())
+ {
+ toolsMenu.add(garbageCollect);
+ toolsMenu.add(groovyShell);
+ }
toolsMenu.add(experimentalFeatures);
// toolsMenu.add(snapShotWindow);
inputMenu.add(inputLocalFileMenuItem);
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void documentationMenuItem_actionPerformed(ActionEvent e)
+ protected void documentationMenuItem_actionPerformed()
{
}
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void saveState_actionPerformed(ActionEvent e)
- {
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void loadState_actionPerformed(ActionEvent e)
+ public void saveState_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void loadJalviewAlign_actionPerformed(ActionEvent e)
+ public void loadState_actionPerformed()
{
}
*/
package jalview.jbgui;
+import jalview.bin.Jalview;
import jalview.gui.JvSwingUtils;
import jalview.util.MessageManager;
okCancelPanel.add(applyButton);
okCancelPanel.add(okButton);
okCancelPanel.add(cancelButton);
- lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
+ if (!Jalview.isJS())
+ {
+ lowerPanel.add(saveLoadPanel, java.awt.BorderLayout.NORTH);
+ }
lowerPanel.add(okCancelPanel, java.awt.BorderLayout.SOUTH);
namePanel.add(schemeName, java.awt.BorderLayout.CENTER);