X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGDesktop.java;h=34c7d3136689511b7c06748a1ec1b092ea590268;hb=7047b076a62df177047ceb16c3611efe020bdd76;hp=51b40139a1911f335d7659d969ba24a7a2c76a86;hpb=a8f483d04205bb8273ee311c12968b7e86d205fa;p=jalview.git
diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java
index 51b4013..34c7d31 100755
--- a/src/jalview/jbgui/GDesktop.java
+++ b/src/jalview/jbgui/GDesktop.java
@@ -1,29 +1,41 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.jbgui;
+import jalview.api.AlignmentViewPanel;
+import jalview.bin.Jalview;
+import jalview.io.FileFormatException;
import jalview.util.MessageManager;
+import jalview.util.Platform;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.FlowLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
-import javax.swing.*;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
/**
* DOCUMENT ME!
@@ -33,6 +45,23 @@ import javax.swing.*;
*/
public class GDesktop extends JFrame
{
+
+ public static javax.swing.JTabbedPane createTabbedPane()
+ {
+ // now just always return JTabbedPane
+ return new javax.swing.JTabbedPane();
+// // BH 2018 coercing jalview.jbgui.swing.JTabbedPane() for now
+// if (/** @j2sNative false && */
+// true)
+// {
+// // Java
+// return new javax.swing.JTabbedPane();
+// }
+// // JavaScript
+// return (javax.swing.JTabbedPane) (Object) new jalview.jbgui.swing.JTabbedPane();
+ }
+
+
protected static JMenu windowMenu = new JMenu();
JMenuBar desktopMenubar = new JMenuBar();
@@ -89,15 +118,22 @@ public class GDesktop extends JFrame
JMenuItem garbageCollect = new JMenuItem();
+ protected JMenuItem groovyShell;
+
+ protected JCheckBoxMenuItem experimentalFeatures;
+
protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
+ protected JMenuItem snapShotWindow = new JMenuItem();
+
/**
* Creates a new GDesktop object.
*/
public GDesktop()
{
+ super();
try
{
jbInit();
@@ -107,7 +143,7 @@ public class GDesktop extends JFrame
e.printStackTrace();
}
- if (!new jalview.util.Platform().isAMac())
+ if (!Platform.isAMac())
{
FileMenu.setMnemonic('F');
inputLocalFileMenuItem.setMnemonic('L');
@@ -129,20 +165,25 @@ public class GDesktop extends JFrame
*/
private void jbInit() throws Exception
{
-
+
FileMenu.setText(MessageManager.getString("action.file"));
HelpMenu.setText(MessageManager.getString("action.help"));
VamsasMenu.setText("Vamsas");
- VamsasMenu.setToolTipText(MessageManager.getString("label.share_data_vamsas_applications"));
+ VamsasMenu.setToolTipText(MessageManager
+ .getString("label.share_data_vamsas_applications"));
VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
- VamsasStMenu.setToolTipText(MessageManager.getString("label.join_existing_vamsas_session"));
- inputLocalFileMenuItem.setText(MessageManager.getString("label.load_tree_from_file"));
- inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
+ VamsasStMenu.setToolTipText(
+ MessageManager.getString("label.join_existing_vamsas_session"));
+ inputLocalFileMenuItem
+ .setText(MessageManager.getString("label.load_tree_from_file"));
+ inputLocalFileMenuItem.setAccelerator(
+ javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(),
+ false));
inputLocalFileMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
inputLocalFileMenuItem_actionPerformed(null);
@@ -151,15 +192,24 @@ public class GDesktop extends JFrame
inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- inputURLMenuItem_actionPerformed(null);
+ try
+ {
+ inputURLMenuItem_actionPerformed(null);
+ } catch (FileFormatException e1)
+ {
+ System.err.println("Error loading from URL: " + e1.getMessage());
+ }
}
});
- inputTextboxMenuItem.setText(MessageManager.getString("label.from_textbox"));
+ inputTextboxMenuItem
+ .setText(MessageManager.getString("label.from_textbox"));
inputTextboxMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
inputTextboxMenuItem_actionPerformed(null);
@@ -168,6 +218,7 @@ public class GDesktop extends JFrame
quit.setText(MessageManager.getString("action.quit"));
quit.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
quit();
@@ -176,27 +227,31 @@ public class GDesktop extends JFrame
aboutMenuItem.setText(MessageManager.getString("label.about"));
aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
aboutMenuItem_actionPerformed(e);
}
});
- documentationMenuItem.setText(MessageManager.getString("label.documentation"));
+ documentationMenuItem
+ .setText(MessageManager.getString("label.documentation"));
documentationMenuItem.setAccelerator(javax.swing.KeyStroke
.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
documentationMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- documentationMenuItem_actionPerformed(e);
+ documentationMenuItem_actionPerformed();
}
});
this.getContentPane().setLayout(flowLayout1);
windowMenu.setText(MessageManager.getString("label.window"));
- preferences.setText(MessageManager.getString("label.preferences") + "...");
+ preferences.setText(MessageManager.getString("label.preferences"));
preferences.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
preferences_actionPerformed(e);
@@ -206,59 +261,89 @@ public class GDesktop extends JFrame
saveState.setText(MessageManager.getString("action.save_project"));
saveState.addActionListener(new ActionListener()
{
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ saveState_actionPerformed(true);
+ }
+ });
+ JMenuItem saveAsJaxb = new JMenuItem("Save Project as JAXB");
+ saveAsJaxb.addActionListener(new ActionListener()
+ {
+ @Override
public void actionPerformed(ActionEvent e)
{
- saveState_actionPerformed(e);
+ saveState_actionPerformed(false);
}
});
loadState.setText(MessageManager.getString("action.load_project"));
loadState.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- loadState_actionPerformed(e);
+ loadState_actionPerformed(true);
+ }
+ });
+ JMenuItem loadAsJaxb = new JMenuItem("Load Project as JAXB");
+ loadAsJaxb.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ loadState_actionPerformed(false);
}
});
inputMenu.setText(MessageManager.getString("label.input_alignment"));
- vamsasStart.setText(MessageManager.getString("label.new_vamsas_session") + "...");
+ vamsasStart
+ .setText(MessageManager.getString("label.new_vamsas_session"));
vamsasStart.setVisible(false);
vamsasStart.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
vamsasStart_actionPerformed(e);
}
});
- vamsasImport.setText(MessageManager.getString("label.load_vamsas_session") + "...");
+ vamsasImport.setText(
+ MessageManager.getString("action.load_vamsas_session"));
vamsasImport.setVisible(false);
vamsasImport.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
vamsasImport_actionPerformed(e);
}
});
- vamsasSave.setText(MessageManager.getString("label.save_vamsas_session") + "...");
+ vamsasSave.setText(
+ MessageManager.getString("action.save_vamsas_session"));
vamsasSave.setVisible(false);
vamsasSave.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
vamsasSave_actionPerformed(e);
}
});
- inputSequence.setText(MessageManager.getString("label.fetch_sequences") + "...");
+ inputSequence
+ .setText(MessageManager.getString("action.fetch_sequences"));
inputSequence.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
inputSequence_actionPerformed(e);
}
});
- vamsasStop.setText(MessageManager.getString("label.stop_vamsas_session"));
+ vamsasStop
+ .setText(MessageManager.getString("label.stop_vamsas_session"));
vamsasStop.setVisible(false);
vamsasStop.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
vamsasStop_actionPerformed(e);
@@ -267,46 +352,57 @@ public class GDesktop extends JFrame
closeAll.setText(MessageManager.getString("action.close_all"));
closeAll.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
closeAll_actionPerformed(e);
}
});
- raiseRelated.setText(MessageManager.getString("action.raise_associated_windows"));
+ raiseRelated.setText(
+ MessageManager.getString("action.raise_associated_windows"));
raiseRelated.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
raiseRelated_actionPerformed(e);
}
});
- minimizeAssociated.setText(MessageManager.getString("action.minimize_associated_windows"));
+ minimizeAssociated.setText(
+ MessageManager.getString("action.minimize_associated_windows"));
minimizeAssociated.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
minimizeAssociated_actionPerformed(e);
}
});
- garbageCollect.setText(MessageManager.getString("label.collect_garbage"));
+ garbageCollect
+ .setText(MessageManager.getString("label.collect_garbage"));
garbageCollect.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
garbageCollect_actionPerformed(e);
}
});
- showMemusage.setText(MessageManager.getString("label.show_memory_usage"));
+ showMemusage
+ .setText(MessageManager.getString("label.show_memory_usage"));
showMemusage.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showMemusage_actionPerformed(e);
}
});
- showConsole.setText(MessageManager.getString("label.show_java_console"));
+ showConsole
+ .setText(MessageManager.getString("label.show_java_console"));
showConsole.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showConsole_actionPerformed(e);
@@ -315,11 +411,46 @@ public class GDesktop extends JFrame
showNews.setText(MessageManager.getString("label.show_jalview_news"));
showNews.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showNews_actionPerformed(e);
}
});
+ groovyShell = new JMenuItem();
+ groovyShell.setText(MessageManager.getString("label.groovy_console"));
+ groovyShell.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ groovyShell_actionPerformed();
+ }
+ });
+ experimentalFeatures = new JCheckBoxMenuItem();
+ experimentalFeatures
+ .setText(MessageManager.getString("label.show_experimental"));
+ experimentalFeatures.setToolTipText(
+ MessageManager.getString("label.show_experimental_tip"));
+ experimentalFeatures.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showExperimental_actionPerformed(experimentalFeatures.isSelected());
+ }
+ });
+
+ snapShotWindow.setText(MessageManager.getString("label.take_snapshot"));
+ snapShotWindow.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ snapShotWindow_actionPerformed(e);
+ }
+ });
+
desktopMenubar.add(FileMenu);
desktopMenubar.add(toolsMenu);
VamsasMenu.setVisible(false);
@@ -329,8 +460,13 @@ public class GDesktop extends JFrame
FileMenu.add(inputMenu);
FileMenu.add(inputSequence);
FileMenu.addSeparator();
- FileMenu.add(saveState);
- FileMenu.add(loadState);
+ FileMenu.add(saveAsJaxb);
+ FileMenu.add(loadAsJaxb);
+ if (!Jalview.isJS())
+ {
+ FileMenu.add(saveState);
+ FileMenu.add(loadState);
+ }
FileMenu.addSeparator();
FileMenu.add(quit);
HelpMenu.add(aboutMenuItem);
@@ -342,10 +478,19 @@ public class GDesktop extends JFrame
VamsasMenu.add(vamsasSave);
VamsasMenu.add(vamsasStop);
toolsMenu.add(preferences);
- toolsMenu.add(showMemusage);
- toolsMenu.add(showConsole);
- toolsMenu.add(showNews);
- toolsMenu.add(garbageCollect);
+ if (!Jalview.isJS())
+ {
+ toolsMenu.add(showMemusage);
+ toolsMenu.add(showConsole);
+ }
+ if (!Jalview.isJS())
+ {
+ toolsMenu.add(showNews);
+ toolsMenu.add(garbageCollect);
+ toolsMenu.add(groovyShell);
+ }
+ toolsMenu.add(experimentalFeatures);
+ // toolsMenu.add(snapShotWindow);
inputMenu.add(inputLocalFileMenuItem);
inputMenu.add(inputURLMenuItem);
inputMenu.add(inputTextboxMenuItem);
@@ -356,6 +501,20 @@ public class GDesktop extends JFrame
// inputMenu.add(vamsasLoad);
}
+ protected void showExperimental_actionPerformed(boolean selected)
+ {
+ }
+
+ protected void groovyShell_actionPerformed()
+ {
+ }
+
+ protected void snapShotWindow_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void showConsole_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
@@ -404,9 +563,10 @@ public class GDesktop extends JFrame
*
* @param e
* DOCUMENT ME!
+ * @throws FileFormatException
*/
protected void inputURLMenuItem_actionPerformed(
- jalview.gui.AlignViewport av)
+ jalview.gui.AlignViewport av) throws FileFormatException
{
}
@@ -417,7 +577,7 @@ public class GDesktop extends JFrame
* DOCUMENT ME!
*/
protected void inputTextboxMenuItem_actionPerformed(
- jalview.gui.AlignViewport av)
+ AlignmentViewPanel avp)
{
}
@@ -438,13 +598,7 @@ public class GDesktop extends JFrame
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- protected void documentationMenuItem_actionPerformed(ActionEvent e)
+ protected void documentationMenuItem_actionPerformed()
{
}
@@ -474,7 +628,7 @@ public class GDesktop extends JFrame
* @param e
* DOCUMENT ME!
*/
- public void saveState_actionPerformed(ActionEvent e)
+ public void saveState_actionPerformed(boolean asCastor)
{
}
@@ -484,7 +638,7 @@ public class GDesktop extends JFrame
* @param e
* DOCUMENT ME!
*/
- public void loadState_actionPerformed(ActionEvent e)
+ public void loadState_actionPerformed(boolean asCastor)
{
}