2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.jbgui;
21 import java.awt.event.*;
31 public class GDesktop extends JFrame
33 protected static JMenu windowMenu = new JMenu();
35 JMenuBar desktopMenubar = new JMenuBar();
37 JMenu FileMenu = new JMenu();
39 JMenu HelpMenu = new JMenu();
41 protected JMenu VamsasMenu = new JMenu();
43 protected JMenu VamsasStMenu = new JMenu();
45 JMenuItem inputLocalFileMenuItem = new JMenuItem();
47 JMenuItem inputURLMenuItem = new JMenuItem();
49 JMenuItem inputTextboxMenuItem = new JMenuItem();
51 JMenuItem quit = new JMenuItem();
53 JMenuItem aboutMenuItem = new JMenuItem();
55 JMenuItem documentationMenuItem = new JMenuItem();
57 FlowLayout flowLayout1 = new FlowLayout();
59 protected JMenu toolsMenu = new JMenu();
61 JMenuItem preferences = new JMenuItem();
63 JMenuItem saveState = new JMenuItem();
65 JMenuItem loadState = new JMenuItem();
67 JMenu inputMenu = new JMenu();
69 protected JMenuItem vamsasStart = new JMenuItem();
71 protected JMenuItem vamsasImport = new JMenuItem();
73 protected JMenuItem vamsasSave = new JMenuItem();
75 JMenuItem inputSequence = new JMenuItem();
77 protected JMenuItem vamsasStop = new JMenuItem();
79 JMenuItem closeAll = new JMenuItem();
81 JMenuItem raiseRelated = new JMenuItem();
83 JMenuItem minimizeAssociated = new JMenuItem();
85 protected JCheckBoxMenuItem showMemusage = new JCheckBoxMenuItem();
87 JMenuItem garbageCollect = new JMenuItem();
89 protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
91 protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
94 * Creates a new GDesktop object.
101 this.setJMenuBar(desktopMenubar);
102 } catch (Exception e)
107 if (!new jalview.util.Platform().isAMac())
109 FileMenu.setMnemonic('F');
110 inputLocalFileMenuItem.setMnemonic('L');
111 VamsasMenu.setMnemonic('V');
112 inputURLMenuItem.setMnemonic('U');
113 inputTextboxMenuItem.setMnemonic('C');
114 quit.setMnemonic('Q');
115 saveState.setMnemonic('S');
116 loadState.setMnemonic('L');
117 inputMenu.setMnemonic('I');
127 private void jbInit() throws Exception
129 FileMenu.setText("File");
130 HelpMenu.setText("Help");
131 VamsasMenu.setText("Vamsas");
132 VamsasMenu.setToolTipText("Share data with other vamsas applications.");
133 VamsasStMenu.setText("Connect to");
134 VamsasStMenu.setToolTipText("Join an existing vamsas session");
135 inputLocalFileMenuItem.setText("from File");
136 inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
137 .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
138 .getDefaultToolkit().getMenuShortcutKeyMask(), false));
139 inputLocalFileMenuItem
140 .addActionListener(new java.awt.event.ActionListener()
142 public void actionPerformed(ActionEvent e)
144 inputLocalFileMenuItem_actionPerformed(null);
147 inputURLMenuItem.setText("from URL");
148 inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
150 public void actionPerformed(ActionEvent e)
152 inputURLMenuItem_actionPerformed(null);
155 inputTextboxMenuItem.setText("from Textbox");
157 .addActionListener(new java.awt.event.ActionListener()
159 public void actionPerformed(ActionEvent e)
161 inputTextboxMenuItem_actionPerformed(null);
164 quit.setText("Quit");
165 quit.addActionListener(new java.awt.event.ActionListener()
167 public void actionPerformed(ActionEvent e)
172 aboutMenuItem.setText("About");
173 aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
175 public void actionPerformed(ActionEvent e)
177 aboutMenuItem_actionPerformed(e);
180 documentationMenuItem.setText("Documentation");
181 documentationMenuItem.setAccelerator(javax.swing.KeyStroke
182 .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
183 documentationMenuItem
184 .addActionListener(new java.awt.event.ActionListener()
186 public void actionPerformed(ActionEvent e)
188 documentationMenuItem_actionPerformed(e);
191 this.getContentPane().setLayout(flowLayout1);
192 windowMenu.setText("Window");
193 preferences.setText("Preferences...");
194 preferences.addActionListener(new ActionListener()
196 public void actionPerformed(ActionEvent e)
198 preferences_actionPerformed(e);
201 toolsMenu.setText("Tools");
202 saveState.setText("Save Project");
203 saveState.addActionListener(new ActionListener()
205 public void actionPerformed(ActionEvent e)
207 saveState_actionPerformed(e);
210 loadState.setText("Load Project");
211 loadState.addActionListener(new ActionListener()
213 public void actionPerformed(ActionEvent e)
215 loadState_actionPerformed(e);
218 inputMenu.setText("Input Alignment");
219 vamsasStart.setText("New Vamsas Session...");
220 vamsasStart.setVisible(false);
221 vamsasStart.addActionListener(new ActionListener()
223 public void actionPerformed(ActionEvent e)
225 vamsasStart_actionPerformed(e);
228 vamsasImport.setText("Load Vamsas Session...");
229 vamsasImport.setVisible(false);
230 vamsasImport.addActionListener(new ActionListener()
232 public void actionPerformed(ActionEvent e)
234 vamsasImport_actionPerformed(e);
237 vamsasSave.setText("Save Vamsas Session...");
238 vamsasSave.setVisible(false);
239 vamsasSave.addActionListener(new ActionListener()
241 public void actionPerformed(ActionEvent e)
243 vamsasSave_actionPerformed(e);
246 inputSequence.setText("Fetch Sequence(s)...");
247 inputSequence.addActionListener(new ActionListener()
249 public void actionPerformed(ActionEvent e)
251 inputSequence_actionPerformed(e);
254 vamsasStop.setText("Stop Vamsas Session");
255 vamsasStop.setVisible(false);
256 vamsasStop.addActionListener(new ActionListener()
258 public void actionPerformed(ActionEvent e)
260 vamsasStop_actionPerformed(e);
263 closeAll.setText("Close All");
264 closeAll.addActionListener(new ActionListener()
266 public void actionPerformed(ActionEvent e)
268 closeAll_actionPerformed(e);
271 raiseRelated.setText("Raise Associated Windows");
272 raiseRelated.addActionListener(new ActionListener()
274 public void actionPerformed(ActionEvent e)
276 raiseRelated_actionPerformed(e);
279 minimizeAssociated.setText("Minimize Associated Windows");
280 minimizeAssociated.addActionListener(new ActionListener()
282 public void actionPerformed(ActionEvent e)
284 minimizeAssociated_actionPerformed(e);
287 garbageCollect.setText("Collect Garbage");
288 garbageCollect.addActionListener(new ActionListener()
290 public void actionPerformed(ActionEvent e)
292 garbageCollect_actionPerformed(e);
295 showMemusage.setText("Show Memory Usage");
296 showMemusage.addActionListener(new ActionListener()
298 public void actionPerformed(ActionEvent e)
300 showMemusage_actionPerformed(e);
303 showConsole.setText("Show Java Console");
304 showConsole.addActionListener(new ActionListener()
306 public void actionPerformed(ActionEvent e)
308 showConsole_actionPerformed(e);
311 showNews.setText("Show Jalview News");
312 showNews.addActionListener(new ActionListener()
314 public void actionPerformed(ActionEvent e)
316 showNews_actionPerformed(e);
319 desktopMenubar.add(FileMenu);
320 desktopMenubar.add(toolsMenu);
321 VamsasMenu.setVisible(false);
322 desktopMenubar.add(VamsasMenu);
323 desktopMenubar.add(HelpMenu);
324 desktopMenubar.add(windowMenu);
325 FileMenu.add(inputMenu);
326 FileMenu.add(inputSequence);
327 FileMenu.addSeparator();
328 FileMenu.add(saveState);
329 FileMenu.add(loadState);
330 FileMenu.addSeparator();
332 HelpMenu.add(aboutMenuItem);
333 HelpMenu.add(documentationMenuItem);
334 VamsasMenu.add(VamsasStMenu);
335 VamsasStMenu.setVisible(false);
336 VamsasMenu.add(vamsasStart);
337 VamsasMenu.add(vamsasImport);
338 VamsasMenu.add(vamsasSave);
339 VamsasMenu.add(vamsasStop);
340 toolsMenu.add(preferences);
341 toolsMenu.add(showMemusage);
342 toolsMenu.add(showConsole);
343 toolsMenu.add(showNews);
344 toolsMenu.add(garbageCollect);
345 inputMenu.add(inputLocalFileMenuItem);
346 inputMenu.add(inputURLMenuItem);
347 inputMenu.add(inputTextboxMenuItem);
348 windowMenu.add(closeAll);
349 windowMenu.add(raiseRelated);
350 windowMenu.add(minimizeAssociated);
351 windowMenu.addSeparator();
352 // inputMenu.add(vamsasLoad);
355 protected void showConsole_actionPerformed(ActionEvent e)
357 // TODO Auto-generated method stub
360 protected void showNews_actionPerformed(ActionEvent e)
362 // TODO Auto-generated method stub
365 protected void showMemusage_actionPerformed(ActionEvent e)
367 // TODO Auto-generated method stub
371 protected void garbageCollect_actionPerformed(ActionEvent e)
373 // TODO Auto-generated method stub
377 protected void vamsasStMenu_actionPerformed()
381 public void vamsasSave_actionPerformed(ActionEvent e)
391 protected void inputLocalFileMenuItem_actionPerformed(
392 jalview.gui.AlignViewport av)
402 protected void inputURLMenuItem_actionPerformed(
403 jalview.gui.AlignViewport av)
413 protected void inputTextboxMenuItem_actionPerformed(
414 jalview.gui.AlignViewport av)
421 protected void quit()
431 protected void aboutMenuItem_actionPerformed(ActionEvent e)
441 protected void documentationMenuItem_actionPerformed(ActionEvent e)
451 public void SaveState_actionPerformed(ActionEvent e)
461 protected void preferences_actionPerformed(ActionEvent e)
471 public void saveState_actionPerformed(ActionEvent e)
481 public void loadState_actionPerformed(ActionEvent e)
491 public void loadJalviewAlign_actionPerformed(ActionEvent e)
495 public void vamsasStart_actionPerformed(ActionEvent e)
500 public void inputSequence_actionPerformed(ActionEvent e)
505 public void vamsasStop_actionPerformed(ActionEvent e)
510 public void closeAll_actionPerformed(ActionEvent e)
515 public void raiseRelated_actionPerformed(ActionEvent e)
520 public void minimizeAssociated_actionPerformed(ActionEvent e)
525 public void vamsasImport_actionPerformed(ActionEvent e)