2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, 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();
92 * Creates a new GDesktop object.
99 this.setJMenuBar(desktopMenubar);
100 } catch (Exception e)
105 if (!new jalview.util.Platform().isAMac())
107 FileMenu.setMnemonic('F');
108 inputLocalFileMenuItem.setMnemonic('L');
109 VamsasMenu.setMnemonic('V');
110 inputURLMenuItem.setMnemonic('U');
111 inputTextboxMenuItem.setMnemonic('C');
112 quit.setMnemonic('Q');
113 saveState.setMnemonic('S');
114 loadState.setMnemonic('L');
115 inputMenu.setMnemonic('I');
125 private void jbInit() throws Exception
127 FileMenu.setText("File");
128 HelpMenu.setText("Help");
129 VamsasMenu.setText("Vamsas");
130 VamsasMenu.setToolTipText("Share data with other vamsas applications.");
131 VamsasStMenu.setText("Connect to");
132 VamsasStMenu.setToolTipText("Join an existing vamsas session");
133 inputLocalFileMenuItem.setText("from File");
134 inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
135 .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
136 .getDefaultToolkit().getMenuShortcutKeyMask(), false));
137 inputLocalFileMenuItem
138 .addActionListener(new java.awt.event.ActionListener()
140 public void actionPerformed(ActionEvent e)
142 inputLocalFileMenuItem_actionPerformed(null);
145 inputURLMenuItem.setText("from URL");
146 inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
148 public void actionPerformed(ActionEvent e)
150 inputURLMenuItem_actionPerformed(null);
153 inputTextboxMenuItem.setText("from Textbox");
155 .addActionListener(new java.awt.event.ActionListener()
157 public void actionPerformed(ActionEvent e)
159 inputTextboxMenuItem_actionPerformed(null);
162 quit.setText("Quit");
163 quit.addActionListener(new java.awt.event.ActionListener()
165 public void actionPerformed(ActionEvent e)
170 aboutMenuItem.setText("About");
171 aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
173 public void actionPerformed(ActionEvent e)
175 aboutMenuItem_actionPerformed(e);
178 documentationMenuItem.setText("Documentation");
179 documentationMenuItem.setAccelerator(javax.swing.KeyStroke
180 .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
181 documentationMenuItem
182 .addActionListener(new java.awt.event.ActionListener()
184 public void actionPerformed(ActionEvent e)
186 documentationMenuItem_actionPerformed(e);
189 this.getContentPane().setLayout(flowLayout1);
190 windowMenu.setText("Window");
191 preferences.setText("Preferences...");
192 preferences.addActionListener(new ActionListener()
194 public void actionPerformed(ActionEvent e)
196 preferences_actionPerformed(e);
199 toolsMenu.setText("Tools");
200 saveState.setText("Save Project");
201 saveState.addActionListener(new ActionListener()
203 public void actionPerformed(ActionEvent e)
205 saveState_actionPerformed(e);
208 loadState.setText("Load Project");
209 loadState.addActionListener(new ActionListener()
211 public void actionPerformed(ActionEvent e)
213 loadState_actionPerformed(e);
216 inputMenu.setText("Input Alignment");
217 vamsasStart.setText("New Vamsas Session...");
218 vamsasStart.setVisible(false);
219 vamsasStart.addActionListener(new ActionListener()
221 public void actionPerformed(ActionEvent e)
223 vamsasStart_actionPerformed(e);
226 vamsasImport.setText("Load Vamsas Session...");
227 vamsasImport.setVisible(false);
228 vamsasImport.addActionListener(new ActionListener()
230 public void actionPerformed(ActionEvent e)
232 vamsasImport_actionPerformed(e);
235 vamsasSave.setText("Save Vamsas Session...");
236 vamsasSave.setVisible(false);
237 vamsasSave.addActionListener(new ActionListener()
239 public void actionPerformed(ActionEvent e)
241 vamsasSave_actionPerformed(e);
244 inputSequence.setText("Fetch Sequence(s)...");
245 inputSequence.addActionListener(new ActionListener()
247 public void actionPerformed(ActionEvent e)
249 inputSequence_actionPerformed(e);
252 vamsasStop.setText("Stop Vamsas Session");
253 vamsasStop.setVisible(false);
254 vamsasStop.addActionListener(new ActionListener()
256 public void actionPerformed(ActionEvent e)
258 vamsasStop_actionPerformed(e);
261 closeAll.setText("Close All");
262 closeAll.addActionListener(new ActionListener()
264 public void actionPerformed(ActionEvent e)
266 closeAll_actionPerformed(e);
269 raiseRelated.setText("Raise Associated Windows");
270 raiseRelated.addActionListener(new ActionListener()
272 public void actionPerformed(ActionEvent e)
274 raiseRelated_actionPerformed(e);
277 minimizeAssociated.setText("Minimize Associated Windows");
278 minimizeAssociated.addActionListener(new ActionListener()
280 public void actionPerformed(ActionEvent e)
282 minimizeAssociated_actionPerformed(e);
285 garbageCollect.setText("Collect Garbage");
286 garbageCollect.addActionListener(new ActionListener()
288 public void actionPerformed(ActionEvent e)
290 garbageCollect_actionPerformed(e);
293 showMemusage.setText("Show Memory Usage");
294 showMemusage.addActionListener(new ActionListener()
296 public void actionPerformed(ActionEvent e)
298 showMemusage_actionPerformed(e);
301 showConsole.setText("Show Java Console");
302 showConsole.addActionListener(new ActionListener()
304 public void actionPerformed(ActionEvent e)
306 showConsole_actionPerformed(e);
309 desktopMenubar.add(FileMenu);
310 desktopMenubar.add(toolsMenu);
311 VamsasMenu.setVisible(false);
312 desktopMenubar.add(VamsasMenu);
313 desktopMenubar.add(HelpMenu);
314 desktopMenubar.add(windowMenu);
315 FileMenu.add(inputMenu);
316 FileMenu.add(inputSequence);
317 FileMenu.addSeparator();
318 FileMenu.add(saveState);
319 FileMenu.add(loadState);
320 FileMenu.addSeparator();
322 HelpMenu.add(aboutMenuItem);
323 HelpMenu.add(documentationMenuItem);
324 VamsasMenu.add(VamsasStMenu);
325 VamsasStMenu.setVisible(false);
326 VamsasMenu.add(vamsasStart);
327 VamsasMenu.add(vamsasImport);
328 VamsasMenu.add(vamsasSave);
329 VamsasMenu.add(vamsasStop);
330 toolsMenu.add(preferences);
331 toolsMenu.add(showMemusage);
332 toolsMenu.add(showConsole);
333 toolsMenu.add(garbageCollect);
334 inputMenu.add(inputLocalFileMenuItem);
335 inputMenu.add(inputURLMenuItem);
336 inputMenu.add(inputTextboxMenuItem);
337 windowMenu.add(closeAll);
338 windowMenu.add(raiseRelated);
339 windowMenu.add(minimizeAssociated);
340 windowMenu.addSeparator();
341 // inputMenu.add(vamsasLoad);
344 protected void showConsole_actionPerformed(ActionEvent e)
346 // TODO Auto-generated method stub
350 protected void showMemusage_actionPerformed(ActionEvent e)
352 // TODO Auto-generated method stub
356 protected void garbageCollect_actionPerformed(ActionEvent e)
358 // TODO Auto-generated method stub
362 protected void vamsasStMenu_actionPerformed()
366 public void vamsasSave_actionPerformed(ActionEvent e)
376 protected void inputLocalFileMenuItem_actionPerformed(
377 jalview.gui.AlignViewport av)
387 protected void inputURLMenuItem_actionPerformed(
388 jalview.gui.AlignViewport av)
398 protected void inputTextboxMenuItem_actionPerformed(
399 jalview.gui.AlignViewport av)
406 protected void quit()
416 protected void aboutMenuItem_actionPerformed(ActionEvent e)
426 protected void documentationMenuItem_actionPerformed(ActionEvent e)
436 public void SaveState_actionPerformed(ActionEvent e)
446 protected void preferences_actionPerformed(ActionEvent e)
456 public void saveState_actionPerformed(ActionEvent e)
466 public void loadState_actionPerformed(ActionEvent e)
476 public void loadJalviewAlign_actionPerformed(ActionEvent e)
480 public void vamsasStart_actionPerformed(ActionEvent e)
485 public void inputSequence_actionPerformed(ActionEvent e)
490 public void vamsasStop_actionPerformed(ActionEvent e)
495 public void closeAll_actionPerformed(ActionEvent e)
500 public void raiseRelated_actionPerformed(ActionEvent e)
505 public void minimizeAssociated_actionPerformed(ActionEvent e)
510 public void vamsasImport_actionPerformed(ActionEvent e)