X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fjbgui%2FGDesktop.java;h=0ef3f46505e785be746dbde876b115729652bca4;hb=406c75985c3585f3c6bf8d6f4778d9fb28c7bf2c;hp=5165e5e6597441290a58fb2e43c9710d4b9d934c;hpb=28787d9646cca5dd77190930f59b7ff32cf995b4;p=jalview.git
diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java
index 5165e5e..0ef3f46 100755
--- a/src/jalview/jbgui/GDesktop.java
+++ b/src/jalview/jbgui/GDesktop.java
@@ -1,26 +1,39 @@
/*
- * 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-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 java.awt.*;
-import java.awt.event.*;
+import jalview.api.AlignmentViewPanel;
+import jalview.io.FileFormatException;
+import jalview.util.MessageManager;
+import jalview.util.Platform;
-import javax.swing.*;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
/**
* DOCUMENT ME!
@@ -38,10 +51,6 @@ public class GDesktop extends JFrame
JMenu HelpMenu = new JMenu();
- protected JMenu VamsasMenu = new JMenu();
-
- protected JMenu VamsasStMenu = new JMenu();
-
JMenuItem inputLocalFileMenuItem = new JMenuItem();
JMenuItem inputURLMenuItem = new JMenuItem();
@@ -62,20 +71,14 @@ public class GDesktop extends JFrame
JMenuItem saveState = new JMenuItem();
+ JMenuItem saveAsState = new JMenuItem();
+
JMenuItem loadState = new JMenuItem();
JMenu inputMenu = new JMenu();
- protected JMenuItem vamsasStart = new JMenuItem();
-
- protected JMenuItem vamsasImport = new JMenuItem();
-
- protected JMenuItem vamsasSave = new JMenuItem();
-
JMenuItem inputSequence = new JMenuItem();
- protected JMenuItem vamsasStop = new JMenuItem();
-
JMenuItem closeAll = new JMenuItem();
JMenuItem raiseRelated = new JMenuItem();
@@ -86,10 +89,16 @@ 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.
*/
@@ -104,11 +113,10 @@ public class GDesktop extends JFrame
e.printStackTrace();
}
- if (!new jalview.util.Platform().isAMac())
+ if (!Platform.isAMac())
{
FileMenu.setMnemonic('F');
inputLocalFileMenuItem.setMnemonic('L');
- VamsasMenu.setMnemonic('V');
inputURLMenuItem.setMnemonic('U');
inputTextboxMenuItem.setMnemonic('C');
quit.setMnemonic('Q');
@@ -126,224 +134,260 @@ public class GDesktop extends JFrame
*/
private void jbInit() throws Exception
{
-
- FileMenu.setText("File");
- HelpMenu.setText("Help");
- VamsasMenu.setText("Vamsas");
- VamsasMenu.setToolTipText("Share data with other vamsas applications.");
- VamsasStMenu.setText("Connect to");
- VamsasStMenu.setToolTipText("Join an existing vamsas session");
- inputLocalFileMenuItem.setText("from File");
- inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
- .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask(), false));
+
+ FileMenu.setText(MessageManager.getString("action.file"));
+ HelpMenu.setText(MessageManager.getString("action.help"));
+ inputLocalFileMenuItem
+ .setText(MessageManager.getString("label.load_tree_from_file"));
+ inputLocalFileMenuItem.setAccelerator(
+ javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
+ jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx(),
+ false));
inputLocalFileMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
inputLocalFileMenuItem_actionPerformed(null);
}
});
- inputURLMenuItem.setText("from URL");
+ 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("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);
}
});
- quit.setText("Quit");
+ quit.setText(MessageManager.getString("action.quit"));
quit.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
quit();
}
});
- aboutMenuItem.setText("About");
+ aboutMenuItem.setText(MessageManager.getString("label.about"));
aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
aboutMenuItem_actionPerformed(e);
}
});
- documentationMenuItem.setText("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);
}
});
this.getContentPane().setLayout(flowLayout1);
- windowMenu.setText("Window");
- preferences.setText("Preferences...");
+ windowMenu.setText(MessageManager.getString("label.window"));
+ preferences.setText(MessageManager.getString("label.preferences"));
preferences.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
preferences_actionPerformed(e);
}
});
- toolsMenu.setText("Tools");
- saveState.setText("Save Project");
+ toolsMenu.setText(MessageManager.getString("label.tools"));
+ saveState.setText(MessageManager.getString("action.save_project"));
saveState.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- saveState_actionPerformed(e);
- }
- });
- loadState.setText("Load Project");
- loadState.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- loadState_actionPerformed(e);
+ saveState_actionPerformed();
}
});
- inputMenu.setText("Input Alignment");
- vamsasStart.setText("New Vamsas Session...");
- vamsasStart.setVisible(false);
- vamsasStart.addActionListener(new ActionListener()
+ saveAsState.setText(MessageManager.getString("action.save_project_as"));
+ saveAsState.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- vamsasStart_actionPerformed(e);
+ saveAsState_actionPerformed(e);
}
});
- vamsasImport.setText("Load Vamsas Session...");
- vamsasImport.setVisible(false);
- vamsasImport.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- vamsasImport_actionPerformed(e);
- }
- });
- vamsasSave.setText("Save Vamsas Session...");
- vamsasSave.setVisible(false);
- vamsasSave.addActionListener(new ActionListener()
+ loadState.setText(MessageManager.getString("action.load_project"));
+ loadState.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- vamsasSave_actionPerformed(e);
+ loadState_actionPerformed();
}
});
- inputSequence.setText("Fetch Sequence(s)...");
+ inputMenu.setText(MessageManager.getString("label.input_alignment"));
+ inputSequence
+ .setText(MessageManager.getString("action.fetch_sequences"));
inputSequence.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
inputSequence_actionPerformed(e);
}
});
- vamsasStop.setText("Stop Vamsas Session");
- vamsasStop.setVisible(false);
- vamsasStop.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- vamsasStop_actionPerformed(e);
- }
- });
- closeAll.setText("Close All");
+ closeAll.setText(MessageManager.getString("action.close_all"));
closeAll.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
closeAll_actionPerformed(e);
}
});
- raiseRelated.setText("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("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("Collect Garbage");
+ garbageCollect
+ .setText(MessageManager.getString("label.collect_garbage"));
garbageCollect.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
garbageCollect_actionPerformed(e);
}
});
- showMemusage.setText("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("Show Java Console");
+ showConsole
+ .setText(MessageManager.getString("label.show_java_console"));
showConsole.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
showConsole_actionPerformed(e);
}
});
- showNews.setText("Show Jalview News");
+ 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);
+ }
+ });
+
+ Float specversion = Float.parseFloat(System.getProperty("java.specification.version"));
+
desktopMenubar.add(FileMenu);
desktopMenubar.add(toolsMenu);
- VamsasMenu.setVisible(false);
- desktopMenubar.add(VamsasMenu);
desktopMenubar.add(HelpMenu);
desktopMenubar.add(windowMenu);
- desktopMenubar.setBackground(Color.lightGray);
FileMenu.add(inputMenu);
FileMenu.add(inputSequence);
FileMenu.addSeparator();
- FileMenu.add(saveState);
+ //FileMenu.add(saveState);
+ FileMenu.add(saveAsState);
FileMenu.add(loadState);
FileMenu.addSeparator();
FileMenu.add(quit);
HelpMenu.add(aboutMenuItem);
HelpMenu.add(documentationMenuItem);
- VamsasMenu.add(VamsasStMenu);
- VamsasStMenu.setVisible(false);
- VamsasMenu.add(vamsasStart);
- VamsasMenu.add(vamsasImport);
- VamsasMenu.add(vamsasSave);
- VamsasMenu.add(vamsasStop);
- toolsMenu.add(preferences);
+ if (!Platform.isAMac() || specversion < 11)
+ {
+ toolsMenu.add(preferences);
+ }
toolsMenu.add(showMemusage);
toolsMenu.add(showConsole);
toolsMenu.add(showNews);
toolsMenu.add(garbageCollect);
+ toolsMenu.add(groovyShell);
+ toolsMenu.add(experimentalFeatures);
+ // toolsMenu.add(snapShotWindow);
inputMenu.add(inputLocalFileMenuItem);
inputMenu.add(inputURLMenuItem);
inputMenu.add(inputTextboxMenuItem);
@@ -354,6 +398,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
@@ -402,9 +460,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
{
}
@@ -415,7 +474,7 @@ public class GDesktop extends JFrame
* DOCUMENT ME!
*/
protected void inputTextboxMenuItem_actionPerformed(
- jalview.gui.AlignViewport av)
+ AlignmentViewPanel avp)
{
}
@@ -424,6 +483,7 @@ public class GDesktop extends JFrame
*/
protected void quit()
{
+ //System.out.println("********** GDesktop.quit()");
}
/**
@@ -452,7 +512,7 @@ public class GDesktop extends JFrame
* @param e
* DOCUMENT ME!
*/
- public void SaveState_actionPerformed(ActionEvent e)
+ protected void preferences_actionPerformed(ActionEvent e)
{
}
@@ -462,17 +522,11 @@ public class GDesktop extends JFrame
* @param e
* DOCUMENT ME!
*/
- protected void preferences_actionPerformed(ActionEvent e)
+ public void saveState_actionPerformed()
{
}
- /**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
- */
- public void saveState_actionPerformed(ActionEvent e)
+ public void saveAsState_actionPerformed(ActionEvent e)
{
}
@@ -482,7 +536,7 @@ public class GDesktop extends JFrame
* @param e
* DOCUMENT ME!
*/
- public void loadState_actionPerformed(ActionEvent e)
+ public void loadState_actionPerformed()
{
}