2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.api.AlignmentViewPanel;
24 import jalview.io.FileFormatException;
25 import jalview.util.MessageManager;
27 import java.awt.FlowLayout;
28 import java.awt.Toolkit;
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
32 import javax.swing.JCheckBoxMenuItem;
33 import javax.swing.JFrame;
34 import javax.swing.JMenu;
35 import javax.swing.JMenuBar;
36 import javax.swing.JMenuItem;
44 public class GDesktop extends JFrame
46 protected static JMenu windowMenu = new JMenu();
48 JMenuBar desktopMenubar = new JMenuBar();
50 JMenu FileMenu = new JMenu();
52 JMenu HelpMenu = new JMenu();
54 protected JMenu VamsasMenu = new JMenu();
56 protected JMenu VamsasStMenu = new JMenu();
58 JMenuItem inputLocalFileMenuItem = new JMenuItem();
60 JMenuItem inputURLMenuItem = new JMenuItem();
62 JMenuItem inputTextboxMenuItem = new JMenuItem();
64 JMenuItem quit = new JMenuItem();
66 JMenuItem aboutMenuItem = new JMenuItem();
68 JMenuItem documentationMenuItem = new JMenuItem();
70 FlowLayout flowLayout1 = new FlowLayout();
72 protected JMenu toolsMenu = new JMenu();
74 JMenuItem preferences = new JMenuItem();
76 JMenuItem saveState = new JMenuItem();
78 JMenuItem loadState = new JMenuItem();
80 JMenu inputMenu = new JMenu();
82 protected JMenuItem vamsasStart = new JMenuItem();
84 protected JMenuItem vamsasImport = new JMenuItem();
86 protected JMenuItem vamsasSave = new JMenuItem();
88 JMenuItem inputSequence = new JMenuItem();
90 protected JMenuItem vamsasStop = new JMenuItem();
92 JMenuItem closeAll = new JMenuItem();
94 JMenuItem raiseRelated = new JMenuItem();
96 JMenuItem minimizeAssociated = new JMenuItem();
98 protected JCheckBoxMenuItem showMemusage = new JCheckBoxMenuItem();
100 JMenuItem garbageCollect = new JMenuItem();
102 protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
104 protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
106 protected JMenuItem snapShotWindow = new JMenuItem();
109 * Creates a new GDesktop object.
116 this.setJMenuBar(desktopMenubar);
117 } catch (Exception e)
122 if (!new jalview.util.Platform().isAMac())
124 FileMenu.setMnemonic('F');
125 inputLocalFileMenuItem.setMnemonic('L');
126 VamsasMenu.setMnemonic('V');
127 inputURLMenuItem.setMnemonic('U');
128 inputTextboxMenuItem.setMnemonic('C');
129 quit.setMnemonic('Q');
130 saveState.setMnemonic('S');
131 loadState.setMnemonic('L');
132 inputMenu.setMnemonic('I');
142 private void jbInit() throws Exception
145 FileMenu.setText(MessageManager.getString("action.file"));
146 HelpMenu.setText(MessageManager.getString("action.help"));
147 VamsasMenu.setText("Vamsas");
148 VamsasMenu.setToolTipText(MessageManager
149 .getString("label.share_data_vamsas_applications"));
150 VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
151 VamsasStMenu.setToolTipText(MessageManager
152 .getString("label.join_existing_vamsas_session"));
153 inputLocalFileMenuItem.setText(MessageManager
154 .getString("label.load_tree_from_file"));
155 inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
156 .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
157 .getDefaultToolkit().getMenuShortcutKeyMask(), false));
158 inputLocalFileMenuItem
159 .addActionListener(new java.awt.event.ActionListener()
162 public void actionPerformed(ActionEvent e)
164 inputLocalFileMenuItem_actionPerformed(null);
167 inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
168 inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
171 public void actionPerformed(ActionEvent e)
175 inputURLMenuItem_actionPerformed(null);
176 } catch (FileFormatException e1)
178 System.err.println("Error loading from URL: " + e1.getMessage());
182 inputTextboxMenuItem.setText(MessageManager
183 .getString("label.from_textbox"));
185 .addActionListener(new java.awt.event.ActionListener()
188 public void actionPerformed(ActionEvent e)
190 inputTextboxMenuItem_actionPerformed(null);
193 quit.setText(MessageManager.getString("action.quit"));
194 quit.addActionListener(new java.awt.event.ActionListener()
197 public void actionPerformed(ActionEvent e)
202 aboutMenuItem.setText(MessageManager.getString("label.about"));
203 aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
206 public void actionPerformed(ActionEvent e)
208 aboutMenuItem_actionPerformed(e);
211 documentationMenuItem.setText(MessageManager
212 .getString("label.documentation"));
213 documentationMenuItem.setAccelerator(javax.swing.KeyStroke
214 .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
215 documentationMenuItem
216 .addActionListener(new java.awt.event.ActionListener()
219 public void actionPerformed(ActionEvent e)
221 documentationMenuItem_actionPerformed(e);
224 this.getContentPane().setLayout(flowLayout1);
225 windowMenu.setText(MessageManager.getString("label.window"));
226 preferences.setText(MessageManager.getString("label.preferences"));
227 preferences.addActionListener(new ActionListener()
230 public void actionPerformed(ActionEvent e)
232 preferences_actionPerformed(e);
235 toolsMenu.setText(MessageManager.getString("label.tools"));
236 saveState.setText(MessageManager.getString("action.save_project"));
237 saveState.addActionListener(new ActionListener()
240 public void actionPerformed(ActionEvent e)
242 saveState_actionPerformed(e);
245 loadState.setText(MessageManager.getString("action.load_project"));
246 loadState.addActionListener(new ActionListener()
249 public void actionPerformed(ActionEvent e)
251 loadState_actionPerformed(e);
254 inputMenu.setText(MessageManager.getString("label.input_alignment"));
255 vamsasStart.setText(MessageManager
256 .getString("label.new_vamsas_session"));
257 vamsasStart.setVisible(false);
258 vamsasStart.addActionListener(new ActionListener()
261 public void actionPerformed(ActionEvent e)
263 vamsasStart_actionPerformed(e);
266 vamsasImport.setText(MessageManager
267 .getString("action.load_vamsas_session"));
268 vamsasImport.setVisible(false);
269 vamsasImport.addActionListener(new ActionListener()
272 public void actionPerformed(ActionEvent e)
274 vamsasImport_actionPerformed(e);
277 vamsasSave.setText(MessageManager
278 .getString("action.save_vamsas_session"));
279 vamsasSave.setVisible(false);
280 vamsasSave.addActionListener(new ActionListener()
283 public void actionPerformed(ActionEvent e)
285 vamsasSave_actionPerformed(e);
288 inputSequence.setText(MessageManager
289 .getString("action.fetch_sequences"));
290 inputSequence.addActionListener(new ActionListener()
293 public void actionPerformed(ActionEvent e)
295 inputSequence_actionPerformed(e);
298 vamsasStop.setText(MessageManager
299 .getString("label.stop_vamsas_session"));
300 vamsasStop.setVisible(false);
301 vamsasStop.addActionListener(new ActionListener()
304 public void actionPerformed(ActionEvent e)
306 vamsasStop_actionPerformed(e);
309 closeAll.setText(MessageManager.getString("action.close_all"));
310 closeAll.addActionListener(new ActionListener()
313 public void actionPerformed(ActionEvent e)
315 closeAll_actionPerformed(e);
318 raiseRelated.setText(MessageManager
319 .getString("action.raise_associated_windows"));
320 raiseRelated.addActionListener(new ActionListener()
323 public void actionPerformed(ActionEvent e)
325 raiseRelated_actionPerformed(e);
328 minimizeAssociated.setText(MessageManager
329 .getString("action.minimize_associated_windows"));
330 minimizeAssociated.addActionListener(new ActionListener()
333 public void actionPerformed(ActionEvent e)
335 minimizeAssociated_actionPerformed(e);
338 garbageCollect.setText(MessageManager
339 .getString("label.collect_garbage"));
340 garbageCollect.addActionListener(new ActionListener()
343 public void actionPerformed(ActionEvent e)
345 garbageCollect_actionPerformed(e);
348 showMemusage.setText(MessageManager
349 .getString("label.show_memory_usage"));
350 showMemusage.addActionListener(new ActionListener()
353 public void actionPerformed(ActionEvent e)
355 showMemusage_actionPerformed(e);
359 .setText(MessageManager.getString("label.show_java_console"));
360 showConsole.addActionListener(new ActionListener()
363 public void actionPerformed(ActionEvent e)
365 showConsole_actionPerformed(e);
368 showNews.setText(MessageManager.getString("label.show_jalview_news"));
369 showNews.addActionListener(new ActionListener()
372 public void actionPerformed(ActionEvent e)
374 showNews_actionPerformed(e);
377 snapShotWindow.setText(MessageManager.getString("label.take_snapshot"));
378 snapShotWindow.addActionListener(new ActionListener()
381 public void actionPerformed(ActionEvent e)
383 snapShotWindow_actionPerformed(e);
387 desktopMenubar.add(FileMenu);
388 desktopMenubar.add(toolsMenu);
389 VamsasMenu.setVisible(false);
390 desktopMenubar.add(VamsasMenu);
391 desktopMenubar.add(HelpMenu);
392 desktopMenubar.add(windowMenu);
393 FileMenu.add(inputMenu);
394 FileMenu.add(inputSequence);
395 FileMenu.addSeparator();
396 FileMenu.add(saveState);
397 FileMenu.add(loadState);
398 FileMenu.addSeparator();
400 HelpMenu.add(aboutMenuItem);
401 HelpMenu.add(documentationMenuItem);
402 VamsasMenu.add(VamsasStMenu);
403 VamsasStMenu.setVisible(false);
404 VamsasMenu.add(vamsasStart);
405 VamsasMenu.add(vamsasImport);
406 VamsasMenu.add(vamsasSave);
407 VamsasMenu.add(vamsasStop);
408 toolsMenu.add(preferences);
409 toolsMenu.add(showMemusage);
410 toolsMenu.add(showConsole);
411 toolsMenu.add(showNews);
412 toolsMenu.add(garbageCollect);
413 // toolsMenu.add(snapShotWindow);
414 inputMenu.add(inputLocalFileMenuItem);
415 inputMenu.add(inputURLMenuItem);
416 inputMenu.add(inputTextboxMenuItem);
417 windowMenu.add(closeAll);
418 windowMenu.add(raiseRelated);
419 windowMenu.add(minimizeAssociated);
420 windowMenu.addSeparator();
421 // inputMenu.add(vamsasLoad);
424 protected void snapShotWindow_actionPerformed(ActionEvent e)
426 // TODO Auto-generated method stub
430 protected void showConsole_actionPerformed(ActionEvent e)
432 // TODO Auto-generated method stub
436 protected void showNews_actionPerformed(ActionEvent e)
438 // TODO Auto-generated method stub
442 protected void showMemusage_actionPerformed(ActionEvent e)
444 // TODO Auto-generated method stub
448 protected void garbageCollect_actionPerformed(ActionEvent e)
450 // TODO Auto-generated method stub
454 protected void vamsasStMenu_actionPerformed()
458 public void vamsasSave_actionPerformed(ActionEvent e)
468 protected void inputLocalFileMenuItem_actionPerformed(
469 jalview.gui.AlignViewport av)
478 * @throws FileFormatException
480 protected void inputURLMenuItem_actionPerformed(
481 jalview.gui.AlignViewport av) throws FileFormatException
491 protected void inputTextboxMenuItem_actionPerformed(AlignmentViewPanel avp)
498 protected void quit()
508 protected void aboutMenuItem_actionPerformed(ActionEvent e)
518 protected void documentationMenuItem_actionPerformed(ActionEvent e)
528 public void SaveState_actionPerformed(ActionEvent e)
538 protected void preferences_actionPerformed(ActionEvent e)
548 public void saveState_actionPerformed(ActionEvent e)
558 public void loadState_actionPerformed(ActionEvent e)
568 public void loadJalviewAlign_actionPerformed(ActionEvent e)
572 public void vamsasStart_actionPerformed(ActionEvent e)
577 public void inputSequence_actionPerformed(ActionEvent e)
582 public void vamsasStop_actionPerformed(ActionEvent e)
587 public void closeAll_actionPerformed(ActionEvent e)
592 public void raiseRelated_actionPerformed(ActionEvent e)
597 public void minimizeAssociated_actionPerformed(ActionEvent e)
602 public void vamsasImport_actionPerformed(ActionEvent e)