import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.bin.Jalview;
+import jalview.gui.ImageExporter.ImageWriterI;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
import jalview.io.FileFormatException;
import jalview.jbgui.GStructureViewer;
import jalview.structure.StructureSelectionManager;
import jalview.urls.IdOrgSettings;
-import jalview.util.ImageMaker;
+import jalview.util.BrowserLauncher;
+import jalview.util.ImageMaker.TYPE;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.UrlConstants;
* are spawned off as threads rather than waited for during this constructor.
*/
instance = this;
- doVamsasClientCheck();
+ if (!Jalview.isJS())
+ {
+ doVamsasClientCheck();
+ }
doConfigureStructurePrefs();
setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
int yPos = Math.max(5, (screenSize.height - 650) / 2);
setBounds(xPos, yPos, 900, 650);
}
- /**
- * BH 2018
- *
- * @j2sNative
- */
- {
-
+
+ boolean doFullLoad = /** @j2sNative ! */true;
+
+ if (doFullLoad) {
+
jconsole = new Console(this, showjconsole);
// add essential build information
jconsole.setHeader("Jalview Version: "
});
- } // end BH 2018 ignore
+ }
this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));
public void checkForNews()
{
-
- /**
- * BH 2018
- *
- * @j2sNative
- */
+ final Desktop me = this;
+ // Thread off the news reader, in case there are connection problems.
+ addDialogThread(new Runnable()
{
- final Desktop me = this;
- // Thread off the news reader, in case there are connection problems.
- addDialogThread(new Runnable()
+ @Override
+ public void run()
{
- @Override
- public void run()
- {
- Cache.log.debug("Starting news thread.");
-
- jvnews = new BlogReader(me);
- showNews.setVisible(true);
- Cache.log.debug("Completed news thread.");
- }
- });
- }
+ Cache.log.debug("Starting 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);
+ if (visible && !jvnews.isVisible())
{
- Cache.log.debug((visible ? "Showing" : "Hiding") + " news.");
- showNews.setSelected(visible);
- if (visible && !jvnews.isVisible())
+ new Thread(new Runnable()
{
- new Thread(new Runnable()
+ @Override
+ public void run()
{
- @Override
- public void run()
- {
- long now = System.currentTimeMillis();
- Desktop.instance.setProgressBar(
- MessageManager.getString("status.refreshing_news"),
- now);
- jvnews.refreshNews();
- Desktop.instance.setProgressBar(null, now);
- jvnews.showNews();
- }
- }).start();
- }
+ long now = System.currentTimeMillis();
+ Desktop.instance.setProgressBar(
+ MessageManager.getString("status.refreshing_news"), now);
+ jvnews.refreshNews();
+ Desktop.instance.setProgressBar(null, now);
+ jvnews.showNews();
+ }
+ }).start();
}
}
private void doVamsasClientCheck()
{
- if (/** @j2sNative false && */ // BH 2018
- jalview.bin.Cache.vamsasJarsPresent())
+ if (Cache.vamsasJarsPresent())
{
setupVamsasDisconnectedGui();
VamsasMenu.setVisible(true);
frame.setIcon(false);
} catch (java.beans.PropertyVetoException ex)
{
-
+ // System.err.println(ex.toString());
}
}
});
}
/**
- * 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" },
@Override
public void run()
{
- if (/** @j2sNative false && */ // BH 2018
- Cache.getDefault("CHECKURLLINKS", true))
+ if (Cache.getDefault("CHECKURLLINKS", true))
{
// check what the actual links are - if it's just the default don't
// bother with the warning
@Override
public void propertyChange(PropertyChangeEvent event)
{
+ // TODO this is obsolete with JAL-3048 - delete?
Object val = event.getNewValue();
String name = event.getPropertyName();
System.out.println(name);
return;
}
break;
- case "javax.swing.ColorChooserDialog":
- switch (name)
- {
- case "SelectedColor":
- onDialogReturn(val);
- return;
- }
- break;
case "javax.swing.JFileChooser":
switch (name)
{
dialogData[0] = value;
((Runnable) dialogData[1]).run();
break;
- case "label.select_feature_colour":
- ((FeatureRenderer) dialogData[1]).processColorDialog((Color) value);
- break;
+ default:
}
}
block.release();
}
+ /**
+ * Outputs an image of the desktop to file in EPS format, after prompting the
+ * user for choice of Text or Lineart character rendering (unless a preference
+ * has been set). The file name is generated as
+ *
+ * <pre>
+ * Jalview_snapshot_nnnnn.eps where nnnnn is the current timestamp in milliseconds
+ * </pre>
+ */
@Override
protected void snapShotWindow_actionPerformed(ActionEvent e)
{
+ // currently the menu option to do this is not shown
invalidate();
- File of;
- ImageMaker im = new jalview.util.ImageMaker(
- this, ImageMaker.TYPE.EPS, "View of Desktop", getWidth(),
- getHeight(), of = new File("Jalview_snapshot"
- + System.currentTimeMillis() + ".eps"),
- "View of desktop", null, 0, false);
- try
- {
- paintAll(im.getGraphics());
- im.writeImage();
- } catch (Exception q)
+
+ int width = getWidth();
+ int height = getHeight();
+ File of = new File(
+ "Jalview_snapshot_" + System.currentTimeMillis() + ".eps");
+ ImageWriterI writer = new ImageWriterI()
{
- Cache.log.error("Couldn't write snapshot to " + of.getAbsolutePath(),
- q);
- return;
- }
- Cache.log.info("Successfully written snapshot to file "
- + of.getAbsolutePath());
+ @Override
+ public void exportImage(Graphics g) throws Exception
+ {
+ paintAll(g);
+ Cache.log.info("Successfully written snapshot to file "
+ + of.getAbsolutePath());
+ }
+ };
+ String title = "View of desktop";
+ ImageExporter exporter = new ImageExporter(writer, null, TYPE.EPS,
+ title);
+ exporter.doExport(of, this, width, height, title);
}
/**