/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
* Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.structure.StructureSelectionManager;
+import jalview.util.ImageMaker;
import jalview.util.MessageManager;
import jalview.ws.params.ParamManager;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
-import javax.swing.event.HyperlinkEvent.EventType;
/**
* Jalview Desktop
instance = this;
doVamsasClientCheck();
doGroovyCheck();
-
+ doConfigureStructurePrefs();
setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
else
{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- setBounds((int) (screenSize.width - 900) / 2,
- (int) (screenSize.height - 650) / 2, 900, 650);
+ setBounds((screenSize.width - 900) / 2,
+ (screenSize.height - 650) / 2, 900, 650);
}
jconsole = new Console(this, showjconsole);
// add essential build information
- jconsole.setHeader("Jalview Desktop "
+ 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"
});
}
+ public void doConfigureStructurePrefs()
+ {
+ // configure services
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(this);
+ if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+ {
+ ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+ Preferences.ADD_TEMPFACT_ANN, true));
+ ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
+ ssm.setSecStructServices(jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW,
+ true));
+ }
+ else
+ {
+ ssm.setAddTempFacAnnot(false);
+ ssm.setProcessSecondaryStructure(false);
+ ssm.setSecStructServices(false);
+ }
+ }
+
public void checkForNews()
{
final Desktop me = this;
public void run()
{
long instance = System.currentTimeMillis();
- Desktop.instance.setProgressBar("Refreshing news", instance);
+ Desktop.instance.setProgressBar(MessageManager.getString("status.refreshing_news"), instance);
jvnews.refreshNews();
Desktop.instance.setProgressBar(null, instance);
jvnews.showNews();
* Adds and opens the given frame to the desktop
*
* @param frame
- * DOCUMENT ME!
+ * Frame to show
* @param title
- * DOCUMENT ME!
+ * Visible Title
* @param w
- * DOCUMENT ME!
+ * width
* @param h
- * DOCUMENT ME!
+ * height
*/
public static synchronized void addInternalFrame(
final JInternalFrame frame, String title, int w, int h)
{
- addInternalFrame(frame, title, w, h, true);
+ addInternalFrame(frame, title, true, w, h, true);
}
+
/**
- * DOCUMENT ME!
+ * Add an internal frame to the Jalview desktop
*
* @param frame
- * DOCUMENT ME!
+ * Frame to show
* @param title
- * DOCUMENT ME!
+ * Visible Title
+ * @param makeVisible
+ * When true, display frame immediately, otherwise, caller must call
+ * setVisible themselves.
* @param w
- * DOCUMENT ME!
+ * width
* @param h
- * DOCUMENT ME!
+ * height
+ */
+ public static synchronized void addInternalFrame(
+ final JInternalFrame frame, String title, boolean makeVisible,
+ int w, int h)
+ {
+ addInternalFrame(frame, title, makeVisible, w, h, true);
+ }
+
+ /**
+ * Add an internal frame to the Jalview desktop and make it visible
+ *
+ * @param frame
+ * Frame to show
+ * @param title
+ * Visible Title
+ * @param w
+ * width
+ * @param h
+ * height
* @param resizable
- * DOCUMENT ME!
+ * Allow resize
*/
public static synchronized void addInternalFrame(
final JInternalFrame frame, String title, int w, int h,
boolean resizable)
{
+ addInternalFrame(frame, title, true, w, h, resizable);
+ }
+
+ /**
+ * Add an internal frame to the Jalview desktop
+ *
+ * @param frame
+ * Frame to show
+ * @param title
+ * Visible Title
+ * @param makeVisible
+ * When true, display frame immediately, otherwise, caller must call
+ * setVisible themselves.
+ * @param w
+ * width
+ * @param h
+ * height
+ * @param resizable
+ * Allow resize
+ */
+ public static synchronized void addInternalFrame(
+ final JInternalFrame frame, String title, boolean makeVisible,
+ int w, int h, boolean resizable)
+ {
// TODO: allow callers to determine X and Y position of frame (eg. via
// bounds object).
openFrameCount++;
- frame.setVisible(true);
+ frame.setVisible(makeVisible);
frame.setClosable(true);
frame.setResizable(resizable);
frame.setMaximizable(resizable);
if (format.equals("URL NOT FOUND"))
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't locate " + url, "URL not found",
+ MessageManager.formatMessage("label.couldnt_locate", new String[]{url}), MessageManager.getString("label.url_not_found"),
JOptionPane.WARNING_MESSAGE);
return;
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
cap.setForInput(viewport);
- Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);
+ Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.cut_paste_alignmen_file"),
+ true, 600, 500);
}
/*
{
try
{
- ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();
- java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");
- javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);
-
- javax.help.HelpBroker hb = hs.createHelpBroker();
- hb.setCurrentID("home");
- hb.setDisplayed(true);
+ Help.showHelpWindow();
} catch (Exception ex)
{
}
{ "Jalview Project" }, "Jalview Project");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save State");
+ chooser.setDialogTitle(MessageManager.getString("label.save_state"));
int value = chooser.showSaveDialog(this);
public void run()
{
- setProgressBar("Saving jalview project " + choice.getName(),
+ setProgressBar(MessageManager.formatMessage("label.saving_jalview_project", new String[]{choice.getName()}),
choice.hashCode());
jalview.bin.Cache.setProperty("LAST_DIRECTORY",
choice.getParent());
ex);
JOptionPane.showMessageDialog(
me,
- "Error whilst saving current state to "
- + choice.getName(), "Couldn't save project",
+ MessageManager.formatMessage("label.error_whilst_saving_current_state_to", new String[]{ choice.getName()}),
+ MessageManager.getString("label.couldnt_save_project"),
JOptionPane.WARNING_MESSAGE);
}
setProgressBar(null, choice.hashCode());
{ "Jalview Project", "Jalview Project (old)" },
"Jalview Project");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Restore state");
+ chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
int value = chooser.showOpenDialog(this);
{
public void run()
{
- setProgressBar("loading jalview project " + choice,
+ setProgressBar(MessageManager.formatMessage("label.loading_jalview_project", new String[]{choice}),
choice.hashCode());
try
{
Cache.log.error("Problems whilst loading project from "
+ choice, ex);
JOptionPane.showMessageDialog(Desktop.desktop,
- "Error whilst loading project from " + choice,
- "Couldn't load project", JOptionPane.WARNING_MESSAGE);
+ MessageManager.formatMessage("label.error_whilst_loading_project_from", new String[]{choice}),
+ MessageManager.getString("label.couldnt_load_project"), JOptionPane.WARNING_MESSAGE);
}
setProgressBar(null, choice.hashCode());
}
{
if (fileLoadingCount == 0)
{
- fileLoadingPanels.add(addProgressPanel("Loading File: " + fileName
- + " "));
+ fileLoadingPanels.add(addProgressPanel(MessageManager.formatMessage("label.loading_file", new String[]{fileName})));
}
fileLoadingCount++;
}
jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Open a saved VAMSAS session");
+ chooser.setDialogTitle(MessageManager.getString("label.open_saved_vamsas_session"));
chooser.setToolTipText(MessageManager
.getString("label.select_vamsas_session_opened_as_new_vamsas_session"));
return false;
}
- setProgressBar("Importing VAMSAS session from " + file.getName(),
+ setProgressBar(MessageManager.formatMessage("status.importing_vamsas_session_from", new String[]{file.getName()}),
file.hashCode());
try
{
v_client = new jalview.gui.VamsasApplication(this, file, null);
} catch (Exception ex)
{
- setProgressBar("Importing VAMSAS session from " + file.getName(),
- file.hashCode());
+ setProgressBar(MessageManager.formatMessage("status.importing_vamsas_session_from", new String[]{file.getName()}),
+ file.hashCode());
jalview.bin.Cache.log.error(
"New vamsas session from existing session file failed:", ex);
return false;
}
setupVamsasConnectedGui();
v_client.initial_update(); // TODO: thread ?
- setProgressBar("Importing VAMSAS session from " + file.getName(),
+ setProgressBar(MessageManager.formatMessage("status.importing_vamsas_session_from", new String[]{file.getName()}),
file.hashCode());
return v_client.inSession();
}
{
if (v_client != null)
{
- throw new Error(
- "Trying to join a vamsas session when another is already connected.");
+ throw new Error(MessageManager.getString("error.try_join_vamsas_session_another"));
}
if (mysesid == null)
{
- throw new Error("Invalid vamsas session id.");
+ throw new Error(MessageManager.getString("error.invalid_vamsas_session_id"));
}
v_client = new VamsasApplication(this, mysesid);
setupVamsasConnectedGui();
{ "Vamsas Document" }, "Vamsas Document");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save Vamsas Document Archive");
+ chooser.setDialogTitle(MessageManager.getString("label.save_vamsas_document_archive"));
int value = chooser.showSaveDialog(this);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
- JPanel progpanel = addProgressPanel("Saving VAMSAS Document to "
- + choice.getName());
+ JPanel progpanel = addProgressPanel(MessageManager.formatMessage("label.saving_vamsas_doc", new String[]{choice.getName()}));
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
String warnmsg = null;
String warnttl = null;
}
if (b)
{
- vamUpdate = this.addProgressPanel("Updating vamsas session");
+ vamUpdate = this.addProgressPanel(MessageManager.getString("label.updating_vamsas_session"));
}
vamsasStart.setVisible(!b);
vamsasStop.setVisible(!b);
if (showMemoryUsage && g != null && df != null)
{
if (percentUsage < 20)
+ {
g.setColor(Color.red);
+ }
FontMetrics fm = g.getFontMetrics();
if (fm != null)
{
// use reflection to avoid creating compilation dependency.
if (!jalview.bin.Cache.groovyJarsPresent())
{
- throw new Error(
- "Implementation Error. Cannot create groovyShell without Groovy on the classpath!");
+ throw new Error(MessageManager.getString("error.implementation_error_cannot_create_groovyshell"));
}
try
{
.showInternalMessageDialog(
Desktop.desktop,
- "Couldn't create the groovy Shell. Check the error log for the details of what went wrong.",
- "Jalview Groovy Support Failed",
+ MessageManager.getString("label.couldnt_create_groovy_shell"),
+ MessageManager.getString("label.groovy_support_failed"),
JOptionPane.ERROR_MESSAGE);
}
}
{
if (progressBarHandlers == null || !progressBars.contains(new Long(id)))
{
- throw new Error(
- "call setProgressBar before registering the progress bar's handler.");
+ throw new Error(MessageManager.getString("error.call_setprogressbar_before_registering_handler"));
}
progressBarHandlers.put(new Long(id), handler);
- final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
+ final JPanel progressPanel = progressBars.get(new Long(id));
if (handler.canCancel())
{
JButton cancel = new JButton(
public void actionPerformed(ActionEvent e)
{
handler.cancelActivity(id);
- us.setProgressBar(
- "Cancelled "
- + ((JLabel) progressPanel.getComponent(0))
- .getText(), id);
+ us.setProgressBar(MessageManager.formatMessage("label.cancelled_params", new String[]{((JLabel) progressPanel.getComponent(0)).getText()}), id);
}
});
progressPanel.add(cancel, BorderLayout.EAST);
+ ermsg
+ "</td></tr></table>"
+ "<p>It may be that you have invalid JABA URLs<br/>in your web service preferences,"
- + " or mis-configured HTTP proxy settings.</p>"
+ + "<br>or as a command-line argument, or mis-configured HTTP proxy settings.</p>"
+ "<p>Check the <em>Connections</em> and <em>Web services</em> tab<br/>of the"
+ " Tools->Preferences dialog box to change them.</p></html>"),
"Web Service Configuration Problem",
{
if (progress != null)
{
- progress.setProgressBar("Opening " + url, this.hashCode());
+ progress.setProgressBar(MessageManager.formatMessage("status.opening_params", new String[]{url}), this.hashCode());
}
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
JOptionPane
.showInternalMessageDialog(
Desktop.desktop,
- "Unixers: Couldn't find default web browser."
- + "\nAdd the full path to your browser in Preferences.",
- "Web browser not found",
+ MessageManager.getString("label.web_browser_not_found_unix"),
+ MessageManager.getString("label.web_browser_not_found"),
JOptionPane.WARNING_MESSAGE);
ex.printStackTrace();
dialogPause = false;
block.release();
}
+ @Override
+ protected void snapShotWindow_actionPerformed(ActionEvent e)
+ {
+ 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");
+ try {
+ paintAll(im.getGraphics());
+ im.writeImage();
+ } catch (Exception q)
+ {
+ Cache.log.error("Couldn't write snapshot to "+of.getAbsolutePath(),q);
+ return;
+ }
+ Cache.log.info("Successfully written snapshot to file "+of.getAbsolutePath());
+ }
}