/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
*
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.util.ImageMaker;
import jalview.util.MessageManager;
import jalview.ws.params.ParamManager;
void showPasteMenu(int x, int y)
{
JPopupMenu popup = new JPopupMenu();
- JMenuItem item = new JMenuItem("Paste To New Window");
+ JMenuItem item = new JMenuItem(
+ MessageManager.getString("label.paste_new_window"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
// ///////////////////////////////////////////////
- if (instance == null || (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true")))
+ if (instance == null
+ || (System.getProperty("java.awt.headless") != null && System
+ .getProperty("java.awt.headless").equals("true")))
{
return;
}
*/
public void drop(DropTargetDropEvent evt)
{
+ boolean success = true;
Transferable t = evt.getTransferable();
java.util.List files = null;
java.util.List protocols = null;
}
} catch (Exception e)
{
+ success = false;
}
if (files != null)
}
} catch (Exception ex)
{
+ success = false;
}
}
+ evt.dropComplete(success); // need this to ensure input focus is properly
+ // transfered to any new windows created
}
/**
jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Open local file");
- chooser.setToolTipText("Open");
+ chooser.setDialogTitle(MessageManager
+ .getString("label.open_local_file"));
+ chooser.setToolTipText(MessageManager.getString("action.open"));
int value = chooser.showOpenDialog(this);
.getSelectedFile().getParent());
String format = null;
- if (chooser.getSelectedFormat()!=null && chooser.getSelectedFormat().equals("Jalview"))
+ if (chooser.getSelectedFormat() != null
+ && chooser.getSelectedFormat().equals("Jalview"))
{
format = "Jalview";
}
{
// This construct allows us to have a wider textfield
// for viewing
- JLabel label = new JLabel(MessageManager.getString("label.input_file_url"));
+ JLabel label = new JLabel(
+ MessageManager.getString("label.input_file_url"));
final JComboBox history = new JComboBox();
JPanel panel = new JPanel(new GridLayout(2, 1));
}
int reply = JOptionPane.showInternalConfirmDialog(desktop, panel,
- MessageManager.getString("label.input_alignment_from_url"), JOptionPane.OK_CANCEL_OPTION);
+ MessageManager.getString("label.input_alignment_from_url"),
+ JOptionPane.OK_CANCEL_OPTION);
if (reply != JOptionPane.OK_OPTION)
{
{
message.append("<h1><strong>Version: "
+ jalview.bin.Cache.getProperty("VERSION")
- + "</strong></h1><br>");
+ + "</strong></h1>");
message.append("<strong>Last Updated: <em>"
+ jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
+ "</em></strong>");
message.append("<br>Authors: "
+ jalview.bin.Cache
.getDefault(
- "AUTHORNAMES",
- "Jim Procter, Andrew Waterhouse, Jan Engelhardt, Lauren Lui, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton")
- + "<br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
- + "<br>For help, see the FAQ at <a href=\"http://www.jalview.org\">www.jalview.org</a> and/or join the jalview-discuss@jalview.org mailing list"
- + "<br>If you use Jalview, please cite:"
+ "AUTHORFNAMES",
+ "The Jalview Authors (See AUTHORS file for current list)")
+ + "<br><br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
+ + "<br><br>For help, see the FAQ at <a href=\"http://www.jalview.org/faq\">www.jalview.org/faq</a> and/or join the jalview-discuss@jalview.org mailing list"
+ + "<br><br>If you use Jalview, please cite:"
+ "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ "<br>Bioinformatics doi: 10.1093/bioinformatics/btp033"
{
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "jar" }, new String[]
+ { "jvp" }, new String[]
{ "Jalview Project" }, "Jalview Project");
chooser.setFileView(new JalviewFileView());
{
JalviewFileChooser chooser = new JalviewFileChooser(
jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "jar" }, new String[]
- { "Jalview Project" }, "Jalview Project");
+ { "jvp", "jar" }, new String[]
+ { "Jalview Project", "Jalview Project (old)" },
+ "Jalview Project");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Restore state");
{
if (progressPanel != null)
{
- synchronized(progressPanel) {
- progressPanel.remove(progbar);
- GridLayout gl = (GridLayout) progressPanel.getLayout();
- gl.setRows(gl.getRows() - 1);
- if (--totalProgressCount < 1)
+ synchronized (progressPanel)
{
- this.getContentPane().remove(progressPanel);
- progressPanel = null;
- }
+ progressPanel.remove(progbar);
+ GridLayout gl = (GridLayout) progressPanel.getLayout();
+ gl.setRows(gl.getRows() - 1);
+ if (--totalProgressCount < 1)
+ {
+ this.getContentPane().remove(progressPanel);
+ progressPanel = null;
+ }
}
}
validate();
fileLoadingCount--;
if (fileLoadingCount < 1)
{
- while (fileLoadingPanels.size()>0)
+ while (fileLoadingPanels.size() > 0)
{
removeProgressPanel(fileLoadingPanels.remove(0));
}
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Open a saved VAMSAS session");
- chooser.setToolTipText("select a vamsas session to be opened as a new vamsas session.");
+ chooser.setToolTipText(MessageManager
+ .getString("label.select_vamsas_session_opened_as_new_vamsas_session"));
int value = chooser.showOpenDialog(this);
String fle = chooser.getSelectedFile().toString();
if (!vamsasImport(chooser.getSelectedFile()))
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.formatMessage("label.couldnt_import_as_vamsas_session", new String[]{fle}),
- MessageManager.getString("label.vamsas_document_import_failed"),
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.couldnt_import_as_vamsas_session",
+ new String[]
+ { fle }),
+ MessageManager
+ .getString("label.vamsas_document_import_failed"),
+ JOptionPane.ERROR_MESSAGE);
}
}
}
vamsasSave.setVisible(false);
vamsasStop.setVisible(false);
vamsasImport.setVisible(true);
- vamsasStart.setText(MessageManager.getString("label.new_vamsas_session"));
+ vamsasStart.setText(MessageManager
+ .getString("label.new_vamsas_session"));
}
public void vamsasStop_actionPerformed(ActionEvent e)
{
JMenuItem sessit = new JMenuItem();
sessit.setText(sess[i]);
- sessit.setToolTipText("Connect to session " + sess[i]);
+ sessit.setToolTipText(MessageManager.formatMessage(
+ "label.connect_to_session", new String[]
+ { sess[i] }));
final Desktop dsktp = this;
final String mysesid = sess[i];
sessit.addActionListener(new ActionListener()
FontMetrics fm = g.getFontMetrics();
if (fm != null)
{
- g.drawString(
- MessageManager.formatMessage("label.memory_stats", new String[]{df.format(totalFreeMemory),df.format(maxMemory),df.format(percentUsage)}), 10,
+ g.drawString(MessageManager.formatMessage(
+ "label.memory_stats",
+ new String[]
+ { df.format(totalFreeMemory), df.format(maxMemory),
+ df.format(percentUsage) }), 10,
getHeight() - fm.getHeight());
}
}
final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
if (handler.canCancel())
{
- JButton cancel = new JButton(MessageManager.getString("action.cancel"));
+ JButton cancel = new JButton(
+ MessageManager.getString("action.cancel"));
final IProgressIndicator us = this;
cancel.addActionListener(new ActionListener()
{
// JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
if (true)
{
- // todo: changesupport handlers need to be transferred
- if (discoverer == null)
- {
- discoverer = new jalview.ws.jws1.Discoverer();
- // register PCS handler for desktop.
- discoverer.addPropertyChangeListener(changeSupport);
- }
- // JAL-940 - disabled JWS1 service configuration - always start discoverer
- // until we phase out completely
+ // todo: changesupport handlers need to be transferred
+ if (discoverer == null)
+ {
+ discoverer = new jalview.ws.jws1.Discoverer();
+ // register PCS handler for desktop.
+ discoverer.addPropertyChangeListener(changeSupport);
+ }
+ // JAL-940 - disabled JWS1 service configuration - always start discoverer
+ // until we phase out completely
(t0 = new Thread(discoverer)).start();
}
dialogPause = false;
block.release();
}
+ @Override
+ protected void snapShotWindow_actionPerformed(ActionEvent e)
+ {
+ invalidate();
+ File of;
+ ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.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());
+ }
}