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.util.MessageManager;
26 import java.awt.FlowLayout;
27 import java.awt.Toolkit;
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
31 import javax.swing.JCheckBoxMenuItem;
32 import javax.swing.JFrame;
33 import javax.swing.JMenu;
34 import javax.swing.JMenuBar;
35 import javax.swing.JMenuItem;
43 public class GDesktop extends JFrame
45 protected static JMenu windowMenu = new JMenu();
47 JMenuBar desktopMenubar = new JMenuBar();
49 JMenu FileMenu = new JMenu();
51 JMenu HelpMenu = new JMenu();
53 protected JMenu VamsasMenu = new JMenu();
55 protected JMenu VamsasStMenu = new JMenu();
57 JMenuItem inputLocalFileMenuItem = new JMenuItem();
59 JMenuItem inputURLMenuItem = new JMenuItem();
61 JMenuItem inputTextboxMenuItem = new JMenuItem();
63 JMenuItem quit = new JMenuItem();
65 JMenuItem aboutMenuItem = new JMenuItem();
67 JMenuItem documentationMenuItem = new JMenuItem();
69 FlowLayout flowLayout1 = new FlowLayout();
71 protected JMenu toolsMenu = new JMenu();
73 JMenuItem preferences = new JMenuItem();
75 JMenuItem saveState = new JMenuItem();
77 JMenuItem loadState = new JMenuItem();
79 JMenu inputMenu = new JMenu();
81 protected JMenuItem vamsasStart = new JMenuItem();
83 protected JMenuItem vamsasImport = new JMenuItem();
85 protected JMenuItem vamsasSave = new JMenuItem();
87 JMenuItem inputSequence = new JMenuItem();
89 protected JMenuItem vamsasStop = new JMenuItem();
91 JMenuItem closeAll = new JMenuItem();
93 JMenuItem raiseRelated = new JMenuItem();
95 JMenuItem minimizeAssociated = new JMenuItem();
97 protected JCheckBoxMenuItem showMemusage = new JCheckBoxMenuItem();
99 JMenuItem garbageCollect = new JMenuItem();
101 protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
103 protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
105 protected JMenuItem snapShotWindow = new JMenuItem();
108 * Creates a new GDesktop object.
115 this.setJMenuBar(desktopMenubar);
116 } catch (Exception e)
121 if (!new jalview.util.Platform().isAMac())
123 FileMenu.setMnemonic('F');
124 inputLocalFileMenuItem.setMnemonic('L');
125 VamsasMenu.setMnemonic('V');
126 inputURLMenuItem.setMnemonic('U');
127 inputTextboxMenuItem.setMnemonic('C');
128 quit.setMnemonic('Q');
129 saveState.setMnemonic('S');
130 loadState.setMnemonic('L');
131 inputMenu.setMnemonic('I');
141 private void jbInit() throws Exception
144 FileMenu.setText(MessageManager.getString("action.file"));
145 HelpMenu.setText(MessageManager.getString("action.help"));
146 VamsasMenu.setText("Vamsas");
147 VamsasMenu.setToolTipText(MessageManager
148 .getString("label.share_data_vamsas_applications"));
149 VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
150 VamsasStMenu.setToolTipText(MessageManager
151 .getString("label.join_existing_vamsas_session"));
152 inputLocalFileMenuItem.setText(MessageManager
153 .getString("label.load_tree_from_file"));
154 inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
155 .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
156 .getDefaultToolkit().getMenuShortcutKeyMask(), false));
157 inputLocalFileMenuItem
158 .addActionListener(new java.awt.event.ActionListener()
160 public void actionPerformed(ActionEvent e)
162 inputLocalFileMenuItem_actionPerformed(null);
165 inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
166 inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
168 public void actionPerformed(ActionEvent e)
170 inputURLMenuItem_actionPerformed(null);
173 inputTextboxMenuItem.setText(MessageManager
174 .getString("label.from_textbox"));
176 .addActionListener(new java.awt.event.ActionListener()
178 public void actionPerformed(ActionEvent e)
180 inputTextboxMenuItem_actionPerformed(null);
183 quit.setText(MessageManager.getString("action.quit"));
184 quit.addActionListener(new java.awt.event.ActionListener()
186 public void actionPerformed(ActionEvent e)
191 aboutMenuItem.setText(MessageManager.getString("label.about"));
192 aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
194 public void actionPerformed(ActionEvent e)
196 aboutMenuItem_actionPerformed(e);
199 documentationMenuItem.setText(MessageManager
200 .getString("label.documentation"));
201 documentationMenuItem.setAccelerator(javax.swing.KeyStroke
202 .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
203 documentationMenuItem
204 .addActionListener(new java.awt.event.ActionListener()
206 public void actionPerformed(ActionEvent e)
208 documentationMenuItem_actionPerformed(e);
211 this.getContentPane().setLayout(flowLayout1);
212 windowMenu.setText(MessageManager.getString("label.window"));
213 preferences.setText(MessageManager.getString("label.preferences"));
214 preferences.addActionListener(new ActionListener()
216 public void actionPerformed(ActionEvent e)
218 preferences_actionPerformed(e);
221 toolsMenu.setText(MessageManager.getString("label.tools"));
222 saveState.setText(MessageManager.getString("action.save_project"));
223 saveState.addActionListener(new ActionListener()
225 public void actionPerformed(ActionEvent e)
227 saveState_actionPerformed(e);
230 loadState.setText(MessageManager.getString("action.load_project"));
231 loadState.addActionListener(new ActionListener()
233 public void actionPerformed(ActionEvent e)
235 loadState_actionPerformed(e);
238 inputMenu.setText(MessageManager.getString("label.input_alignment"));
239 vamsasStart.setText(MessageManager
240 .getString("label.new_vamsas_session"));
241 vamsasStart.setVisible(false);
242 vamsasStart.addActionListener(new ActionListener()
244 public void actionPerformed(ActionEvent e)
246 vamsasStart_actionPerformed(e);
249 vamsasImport.setText(MessageManager
250 .getString("action.load_vamsas_session"));
251 vamsasImport.setVisible(false);
252 vamsasImport.addActionListener(new ActionListener()
254 public void actionPerformed(ActionEvent e)
256 vamsasImport_actionPerformed(e);
259 vamsasSave.setText(MessageManager
260 .getString("action.save_vamsas_session"));
261 vamsasSave.setVisible(false);
262 vamsasSave.addActionListener(new ActionListener()
264 public void actionPerformed(ActionEvent e)
266 vamsasSave_actionPerformed(e);
269 inputSequence.setText(MessageManager
270 .getString("action.fetch_sequences"));
271 inputSequence.addActionListener(new ActionListener()
273 public void actionPerformed(ActionEvent e)
275 inputSequence_actionPerformed(e);
278 vamsasStop.setText(MessageManager
279 .getString("label.stop_vamsas_session"));
280 vamsasStop.setVisible(false);
281 vamsasStop.addActionListener(new ActionListener()
283 public void actionPerformed(ActionEvent e)
285 vamsasStop_actionPerformed(e);
288 closeAll.setText(MessageManager.getString("action.close_all"));
289 closeAll.addActionListener(new ActionListener()
291 public void actionPerformed(ActionEvent e)
293 closeAll_actionPerformed(e);
296 raiseRelated.setText(MessageManager
297 .getString("action.raise_associated_windows"));
298 raiseRelated.addActionListener(new ActionListener()
300 public void actionPerformed(ActionEvent e)
302 raiseRelated_actionPerformed(e);
305 minimizeAssociated.setText(MessageManager
306 .getString("action.minimize_associated_windows"));
307 minimizeAssociated.addActionListener(new ActionListener()
309 public void actionPerformed(ActionEvent e)
311 minimizeAssociated_actionPerformed(e);
314 garbageCollect.setText(MessageManager
315 .getString("label.collect_garbage"));
316 garbageCollect.addActionListener(new ActionListener()
318 public void actionPerformed(ActionEvent e)
320 garbageCollect_actionPerformed(e);
323 showMemusage.setText(MessageManager
324 .getString("label.show_memory_usage"));
325 showMemusage.addActionListener(new ActionListener()
327 public void actionPerformed(ActionEvent e)
329 showMemusage_actionPerformed(e);
333 .setText(MessageManager.getString("label.show_java_console"));
334 showConsole.addActionListener(new ActionListener()
336 public void actionPerformed(ActionEvent e)
338 showConsole_actionPerformed(e);
341 showNews.setText(MessageManager.getString("label.show_jalview_news"));
342 showNews.addActionListener(new ActionListener()
344 public void actionPerformed(ActionEvent e)
346 showNews_actionPerformed(e);
349 snapShotWindow.setText(MessageManager.getString("label.take_snapshot"));
350 snapShotWindow.addActionListener(new ActionListener()
352 public void actionPerformed(ActionEvent e)
354 snapShotWindow_actionPerformed(e);
358 desktopMenubar.add(FileMenu);
359 desktopMenubar.add(toolsMenu);
360 VamsasMenu.setVisible(false);
361 desktopMenubar.add(VamsasMenu);
362 desktopMenubar.add(HelpMenu);
363 desktopMenubar.add(windowMenu);
364 FileMenu.add(inputMenu);
365 FileMenu.add(inputSequence);
366 FileMenu.addSeparator();
367 FileMenu.add(saveState);
368 FileMenu.add(loadState);
369 FileMenu.addSeparator();
371 HelpMenu.add(aboutMenuItem);
372 HelpMenu.add(documentationMenuItem);
373 VamsasMenu.add(VamsasStMenu);
374 VamsasStMenu.setVisible(false);
375 VamsasMenu.add(vamsasStart);
376 VamsasMenu.add(vamsasImport);
377 VamsasMenu.add(vamsasSave);
378 VamsasMenu.add(vamsasStop);
379 toolsMenu.add(preferences);
380 toolsMenu.add(showMemusage);
381 toolsMenu.add(showConsole);
382 toolsMenu.add(showNews);
383 toolsMenu.add(garbageCollect);
384 // toolsMenu.add(snapShotWindow);
385 inputMenu.add(inputLocalFileMenuItem);
386 inputMenu.add(inputURLMenuItem);
387 inputMenu.add(inputTextboxMenuItem);
388 windowMenu.add(closeAll);
389 windowMenu.add(raiseRelated);
390 windowMenu.add(minimizeAssociated);
391 windowMenu.addSeparator();
392 // inputMenu.add(vamsasLoad);
395 protected void snapShotWindow_actionPerformed(ActionEvent e)
397 // TODO Auto-generated method stub
401 protected void showConsole_actionPerformed(ActionEvent e)
403 // TODO Auto-generated method stub
407 protected void showNews_actionPerformed(ActionEvent e)
409 // TODO Auto-generated method stub
413 protected void showMemusage_actionPerformed(ActionEvent e)
415 // TODO Auto-generated method stub
419 protected void garbageCollect_actionPerformed(ActionEvent e)
421 // TODO Auto-generated method stub
425 protected void vamsasStMenu_actionPerformed()
429 public void vamsasSave_actionPerformed(ActionEvent e)
439 protected void inputLocalFileMenuItem_actionPerformed(
440 jalview.gui.AlignViewport av)
450 protected void inputURLMenuItem_actionPerformed(
451 jalview.gui.AlignViewport av)
461 protected void inputTextboxMenuItem_actionPerformed(AlignmentViewPanel avp)
468 protected void quit()
478 protected void aboutMenuItem_actionPerformed(ActionEvent e)
488 protected void documentationMenuItem_actionPerformed(ActionEvent e)
498 public void SaveState_actionPerformed(ActionEvent e)
508 protected void preferences_actionPerformed(ActionEvent e)
518 public void saveState_actionPerformed(ActionEvent e)
528 public void loadState_actionPerformed(ActionEvent e)
538 public void loadJalviewAlign_actionPerformed(ActionEvent e)
542 public void vamsasStart_actionPerformed(ActionEvent e)
547 public void inputSequence_actionPerformed(ActionEvent e)
552 public void vamsasStop_actionPerformed(ActionEvent e)
557 public void closeAll_actionPerformed(ActionEvent e)
562 public void raiseRelated_actionPerformed(ActionEvent e)
567 public void minimizeAssociated_actionPerformed(ActionEvent e)
572 public void vamsasImport_actionPerformed(ActionEvent e)