2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 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.util.MessageManager;
25 import java.awt.FlowLayout;
26 import java.awt.Toolkit;
27 import java.awt.event.ActionEvent;
28 import java.awt.event.ActionListener;
30 import javax.swing.JCheckBoxMenuItem;
31 import javax.swing.JFrame;
32 import javax.swing.JMenu;
33 import javax.swing.JMenuBar;
34 import javax.swing.JMenuItem;
42 public class GDesktop extends JFrame
44 protected static JMenu windowMenu = new JMenu();
46 JMenuBar desktopMenubar = new JMenuBar();
48 JMenu FileMenu = new JMenu();
50 JMenu HelpMenu = new JMenu();
52 protected JMenu VamsasMenu = new JMenu();
54 protected JMenu VamsasStMenu = new JMenu();
56 JMenuItem inputLocalFileMenuItem = new JMenuItem();
58 JMenuItem inputURLMenuItem = new JMenuItem();
60 JMenuItem inputTextboxMenuItem = new JMenuItem();
62 JMenuItem quit = new JMenuItem();
64 JMenuItem aboutMenuItem = new JMenuItem();
66 JMenuItem documentationMenuItem = new JMenuItem();
68 FlowLayout flowLayout1 = new FlowLayout();
70 protected JMenu toolsMenu = new JMenu();
72 JMenuItem preferences = new JMenuItem();
74 JMenuItem saveState = new JMenuItem();
76 JMenuItem loadState = new JMenuItem();
78 JMenu inputMenu = new JMenu();
80 protected JMenuItem vamsasStart = new JMenuItem();
82 protected JMenuItem vamsasImport = new JMenuItem();
84 protected JMenuItem vamsasSave = new JMenuItem();
86 JMenuItem inputSequence = new JMenuItem();
88 protected JMenuItem vamsasStop = new JMenuItem();
90 JMenuItem closeAll = new JMenuItem();
92 JMenuItem raiseRelated = new JMenuItem();
94 JMenuItem minimizeAssociated = new JMenuItem();
96 protected JCheckBoxMenuItem showMemusage = new JCheckBoxMenuItem();
98 JMenuItem garbageCollect = new JMenuItem();
100 protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
102 protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
104 protected JMenuItem snapShotWindow = new JMenuItem();
106 * Creates a new GDesktop object.
113 this.setJMenuBar(desktopMenubar);
114 } catch (Exception e)
119 if (!new jalview.util.Platform().isAMac())
121 FileMenu.setMnemonic('F');
122 inputLocalFileMenuItem.setMnemonic('L');
123 VamsasMenu.setMnemonic('V');
124 inputURLMenuItem.setMnemonic('U');
125 inputTextboxMenuItem.setMnemonic('C');
126 quit.setMnemonic('Q');
127 saveState.setMnemonic('S');
128 loadState.setMnemonic('L');
129 inputMenu.setMnemonic('I');
139 private void jbInit() throws Exception
142 FileMenu.setText(MessageManager.getString("action.file"));
143 HelpMenu.setText(MessageManager.getString("action.help"));
144 VamsasMenu.setText("Vamsas");
145 VamsasMenu.setToolTipText(MessageManager
146 .getString("label.share_data_vamsas_applications"));
147 VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
148 VamsasStMenu.setToolTipText(MessageManager
149 .getString("label.join_existing_vamsas_session"));
150 inputLocalFileMenuItem.setText(MessageManager
151 .getString("label.load_tree_from_file"));
152 inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
153 .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
154 .getDefaultToolkit().getMenuShortcutKeyMask(), false));
155 inputLocalFileMenuItem
156 .addActionListener(new java.awt.event.ActionListener()
158 public void actionPerformed(ActionEvent e)
160 inputLocalFileMenuItem_actionPerformed(null);
163 inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
164 inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
166 public void actionPerformed(ActionEvent e)
168 inputURLMenuItem_actionPerformed(null);
171 inputTextboxMenuItem.setText(MessageManager
172 .getString("label.from_textbox"));
174 .addActionListener(new java.awt.event.ActionListener()
176 public void actionPerformed(ActionEvent e)
178 inputTextboxMenuItem_actionPerformed(null);
181 quit.setText(MessageManager.getString("action.quit"));
182 quit.addActionListener(new java.awt.event.ActionListener()
184 public void actionPerformed(ActionEvent e)
189 aboutMenuItem.setText(MessageManager.getString("label.about"));
190 aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
192 public void actionPerformed(ActionEvent e)
194 aboutMenuItem_actionPerformed(e);
197 documentationMenuItem.setText(MessageManager
198 .getString("label.documentation"));
199 documentationMenuItem.setAccelerator(javax.swing.KeyStroke
200 .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
201 documentationMenuItem
202 .addActionListener(new java.awt.event.ActionListener()
204 public void actionPerformed(ActionEvent e)
206 documentationMenuItem_actionPerformed(e);
209 this.getContentPane().setLayout(flowLayout1);
210 windowMenu.setText(MessageManager.getString("label.window"));
211 preferences.setText(MessageManager.getString("label.preferences")
213 preferences.addActionListener(new ActionListener()
215 public void actionPerformed(ActionEvent e)
217 preferences_actionPerformed(e);
220 toolsMenu.setText(MessageManager.getString("label.tools"));
221 saveState.setText(MessageManager.getString("action.save_project"));
222 saveState.addActionListener(new ActionListener()
224 public void actionPerformed(ActionEvent e)
226 saveState_actionPerformed(e);
229 loadState.setText(MessageManager.getString("action.load_project"));
230 loadState.addActionListener(new ActionListener()
232 public void actionPerformed(ActionEvent e)
234 loadState_actionPerformed(e);
237 inputMenu.setText(MessageManager.getString("label.input_alignment"));
238 vamsasStart.setText(MessageManager
239 .getString("label.new_vamsas_session") + "...");
240 vamsasStart.setVisible(false);
241 vamsasStart.addActionListener(new ActionListener()
243 public void actionPerformed(ActionEvent e)
245 vamsasStart_actionPerformed(e);
248 vamsasImport.setText(MessageManager
249 .getString("label.load_vamsas_session") + "...");
250 vamsasImport.setVisible(false);
251 vamsasImport.addActionListener(new ActionListener()
253 public void actionPerformed(ActionEvent e)
255 vamsasImport_actionPerformed(e);
258 vamsasSave.setText(MessageManager
259 .getString("label.save_vamsas_session") + "...");
260 vamsasSave.setVisible(false);
261 vamsasSave.addActionListener(new ActionListener()
263 public void actionPerformed(ActionEvent e)
265 vamsasSave_actionPerformed(e);
268 inputSequence.setText(MessageManager.getString("label.fetch_sequences")
270 inputSequence.addActionListener(new ActionListener()
272 public void actionPerformed(ActionEvent e)
274 inputSequence_actionPerformed(e);
277 vamsasStop.setText(MessageManager
278 .getString("label.stop_vamsas_session"));
279 vamsasStop.setVisible(false);
280 vamsasStop.addActionListener(new ActionListener()
282 public void actionPerformed(ActionEvent e)
284 vamsasStop_actionPerformed(e);
287 closeAll.setText(MessageManager.getString("action.close_all"));
288 closeAll.addActionListener(new ActionListener()
290 public void actionPerformed(ActionEvent e)
292 closeAll_actionPerformed(e);
295 raiseRelated.setText(MessageManager
296 .getString("action.raise_associated_windows"));
297 raiseRelated.addActionListener(new ActionListener()
299 public void actionPerformed(ActionEvent e)
301 raiseRelated_actionPerformed(e);
304 minimizeAssociated.setText(MessageManager
305 .getString("action.minimize_associated_windows"));
306 minimizeAssociated.addActionListener(new ActionListener()
308 public void actionPerformed(ActionEvent e)
310 minimizeAssociated_actionPerformed(e);
313 garbageCollect.setText(MessageManager
314 .getString("label.collect_garbage"));
315 garbageCollect.addActionListener(new ActionListener()
317 public void actionPerformed(ActionEvent e)
319 garbageCollect_actionPerformed(e);
322 showMemusage.setText(MessageManager
323 .getString("label.show_memory_usage"));
324 showMemusage.addActionListener(new ActionListener()
326 public void actionPerformed(ActionEvent e)
328 showMemusage_actionPerformed(e);
332 .setText(MessageManager.getString("label.show_java_console"));
333 showConsole.addActionListener(new ActionListener()
335 public void actionPerformed(ActionEvent e)
337 showConsole_actionPerformed(e);
340 showNews.setText(MessageManager.getString("label.show_jalview_news"));
341 showNews.addActionListener(new ActionListener()
343 public void actionPerformed(ActionEvent e)
345 showNews_actionPerformed(e);
348 snapShotWindow.setText(MessageManager.getString("label.take_snapshot"));
349 snapShotWindow.addActionListener(new ActionListener()
351 public void actionPerformed(ActionEvent e)
353 snapShotWindow_actionPerformed(e);
357 desktopMenubar.add(FileMenu);
358 desktopMenubar.add(toolsMenu);
359 VamsasMenu.setVisible(false);
360 desktopMenubar.add(VamsasMenu);
361 desktopMenubar.add(HelpMenu);
362 desktopMenubar.add(windowMenu);
363 FileMenu.add(inputMenu);
364 FileMenu.add(inputSequence);
365 FileMenu.addSeparator();
366 FileMenu.add(saveState);
367 FileMenu.add(loadState);
368 FileMenu.addSeparator();
370 HelpMenu.add(aboutMenuItem);
371 HelpMenu.add(documentationMenuItem);
372 VamsasMenu.add(VamsasStMenu);
373 VamsasStMenu.setVisible(false);
374 VamsasMenu.add(vamsasStart);
375 VamsasMenu.add(vamsasImport);
376 VamsasMenu.add(vamsasSave);
377 VamsasMenu.add(vamsasStop);
378 toolsMenu.add(preferences);
379 toolsMenu.add(showMemusage);
380 toolsMenu.add(showConsole);
381 toolsMenu.add(showNews);
382 toolsMenu.add(garbageCollect);
383 // toolsMenu.add(snapShotWindow);
384 inputMenu.add(inputLocalFileMenuItem);
385 inputMenu.add(inputURLMenuItem);
386 inputMenu.add(inputTextboxMenuItem);
387 windowMenu.add(closeAll);
388 windowMenu.add(raiseRelated);
389 windowMenu.add(minimizeAssociated);
390 windowMenu.addSeparator();
391 // inputMenu.add(vamsasLoad);
394 protected void snapShotWindow_actionPerformed(ActionEvent e)
396 // TODO Auto-generated method stub
400 protected void showConsole_actionPerformed(ActionEvent e)
402 // TODO Auto-generated method stub
406 protected void showNews_actionPerformed(ActionEvent e)
408 // TODO Auto-generated method stub
412 protected void showMemusage_actionPerformed(ActionEvent e)
414 // TODO Auto-generated method stub
418 protected void garbageCollect_actionPerformed(ActionEvent e)
420 // TODO Auto-generated method stub
424 protected void vamsasStMenu_actionPerformed()
428 public void vamsasSave_actionPerformed(ActionEvent e)
438 protected void inputLocalFileMenuItem_actionPerformed(
439 jalview.gui.AlignViewport av)
449 protected void inputURLMenuItem_actionPerformed(
450 jalview.gui.AlignViewport av)
460 protected void inputTextboxMenuItem_actionPerformed(
461 jalview.gui.AlignViewport av)
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)