2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.jbgui;
\r
22 import java.awt.event.*;
\r
23 import javax.swing.*;
\r
29 * @version $Revision$
\r
31 public class GDesktop
\r
34 protected static JMenu windowMenu = new JMenu();
\r
35 JMenuBar desktopMenubar = new JMenuBar();
\r
36 JMenu FileMenu = new JMenu();
\r
37 JMenu HelpMenu = new JMenu();
\r
38 protected JMenu VamsasMenu = new JMenu();
\r
39 JMenuItem inputLocalFileMenuItem = new JMenuItem();
\r
40 JMenuItem inputURLMenuItem = new JMenuItem();
\r
41 JMenuItem inputTextboxMenuItem = new JMenuItem();
\r
42 JMenuItem quit = new JMenuItem();
\r
43 JMenuItem aboutMenuItem = new JMenuItem();
\r
44 JMenuItem documentationMenuItem = new JMenuItem();
\r
45 FlowLayout flowLayout1 = new FlowLayout();
\r
46 JMenu toolsMenu = new JMenu();
\r
47 JMenuItem preferences = new JMenuItem();
\r
48 JMenuItem saveState = new JMenuItem();
\r
49 JMenuItem loadState = new JMenuItem();
\r
50 JMenu inputMenu = new JMenu();
\r
51 protected JMenuItem vamsasLoad = new JMenuItem();
\r
52 JMenuItem inputSequence = new JMenuItem();
\r
53 protected JMenuItem vamsasStop = new JMenuItem();
\r
54 JMenuItem closeAll = new JMenuItem();
\r
55 JMenuItem raiseRelated = new JMenuItem();
\r
56 JMenuItem minimizeAssociated = new JMenuItem();
\r
59 * Creates a new GDesktop object.
\r
66 this.setJMenuBar(desktopMenubar);
\r
70 e.printStackTrace();
\r
73 if (!System.getProperty("os.name").startsWith("Mac"))
\r
75 FileMenu.setMnemonic('F');
\r
76 inputLocalFileMenuItem.setMnemonic('L');
\r
77 VamsasMenu.setMnemonic('V');
\r
78 inputURLMenuItem.setMnemonic('U');
\r
79 inputTextboxMenuItem.setMnemonic('C');
\r
80 quit.setMnemonic('Q');
\r
81 saveState.setMnemonic('S');
\r
82 loadState.setMnemonic('L');
\r
83 inputMenu.setMnemonic('I');
\r
90 * @throws Exception DOCUMENT ME!
\r
92 private void jbInit()
\r
95 FileMenu.setText("File");
\r
96 HelpMenu.setText("Help");
\r
97 VamsasMenu.setText("Vamsas");
\r
98 VamsasMenu.setToolTipText("Share data with other vamsas applications.");
\r
99 inputLocalFileMenuItem.setText("from File");
\r
100 inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
\r
101 java.awt.event.KeyEvent.VK_O,
\r
102 Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));
\r
103 inputLocalFileMenuItem.addActionListener(new java.awt.event.ActionListener()
\r
105 public void actionPerformed(ActionEvent e)
\r
107 inputLocalFileMenuItem_actionPerformed(null);
\r
110 inputURLMenuItem.setText("from URL");
\r
111 inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
\r
113 public void actionPerformed(ActionEvent e)
\r
115 inputURLMenuItem_actionPerformed(null);
\r
118 inputTextboxMenuItem.setText("from Textbox");
\r
119 inputTextboxMenuItem.addActionListener(new java.awt.event.ActionListener()
\r
121 public void actionPerformed(ActionEvent e)
\r
123 inputTextboxMenuItem_actionPerformed(null);
\r
126 quit.setText("Quit");
\r
127 quit.addActionListener(new java.awt.event.ActionListener()
\r
129 public void actionPerformed(ActionEvent e)
\r
134 aboutMenuItem.setText("About");
\r
135 aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
\r
137 public void actionPerformed(ActionEvent e)
\r
139 aboutMenuItem_actionPerformed(e);
\r
142 documentationMenuItem.setText("Documentation");
\r
143 documentationMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
\r
144 java.awt.event.KeyEvent.VK_F1, 0, false));
\r
145 documentationMenuItem.addActionListener(new java.awt.event.ActionListener()
\r
147 public void actionPerformed(ActionEvent e)
\r
149 documentationMenuItem_actionPerformed(e);
\r
152 this.getContentPane().setLayout(flowLayout1);
\r
153 windowMenu.setText("Window");
\r
154 preferences.setText("Preferences...");
\r
155 preferences.addActionListener(new ActionListener()
\r
157 public void actionPerformed(ActionEvent e)
\r
159 preferences_actionPerformed(e);
\r
162 toolsMenu.setText("Tools");
\r
163 saveState.setText("Save Project");
\r
164 saveState.addActionListener(new ActionListener()
\r
166 public void actionPerformed(ActionEvent e)
\r
168 saveState_actionPerformed(e);
\r
171 loadState.setText("Load Project");
\r
172 loadState.addActionListener(new ActionListener()
\r
174 public void actionPerformed(ActionEvent e)
\r
176 loadState_actionPerformed(e);
\r
179 inputMenu.setText("Input Alignment");
\r
180 vamsasLoad.setText("Start Vamsas Session...");
\r
181 vamsasLoad.setVisible(false);
\r
182 vamsasLoad.addActionListener(new ActionListener()
\r
184 public void actionPerformed(ActionEvent e)
\r
186 vamsasLoad_actionPerformed(e);
\r
189 inputSequence.setText("Fetch Sequence(s)...");
\r
190 inputSequence.addActionListener(new ActionListener()
\r
192 public void actionPerformed(ActionEvent e)
\r
194 inputSequence_actionPerformed(e);
\r
197 vamsasStop.setText("Stop Vamsas Session");
\r
198 vamsasStop.setVisible(false);
\r
199 vamsasStop.addActionListener(new ActionListener()
\r
201 public void actionPerformed(ActionEvent e)
\r
203 vamsasStop_actionPerformed(e);
\r
206 closeAll.setText("Close All");
\r
207 closeAll.addActionListener(new ActionListener()
\r
209 public void actionPerformed(ActionEvent e)
\r
211 closeAll_actionPerformed(e);
\r
214 raiseRelated.setText("Raise Associated Windows");
\r
215 raiseRelated.addActionListener(new ActionListener()
\r
217 public void actionPerformed(ActionEvent e)
\r
219 raiseRelated_actionPerformed(e);
\r
222 minimizeAssociated.setText("Minimize Associated Windows");
\r
223 minimizeAssociated.addActionListener(new ActionListener()
\r
225 public void actionPerformed(ActionEvent e)
\r
227 minimizeAssociated_actionPerformed(e);
\r
230 desktopMenubar.add(FileMenu);
\r
231 desktopMenubar.add(toolsMenu);
\r
232 VamsasMenu.setVisible(false);
\r
233 desktopMenubar.add(VamsasMenu);
\r
234 desktopMenubar.add(HelpMenu);
\r
235 desktopMenubar.add(windowMenu);
\r
236 FileMenu.add(inputMenu);
\r
237 FileMenu.add(inputSequence);
\r
238 FileMenu.addSeparator();
\r
239 FileMenu.add(saveState);
\r
240 FileMenu.add(loadState);
\r
241 FileMenu.addSeparator();
\r
242 FileMenu.add(quit);
\r
243 HelpMenu.add(aboutMenuItem);
\r
244 HelpMenu.add(documentationMenuItem);
\r
245 VamsasMenu.add(vamsasLoad);
\r
246 VamsasMenu.add(vamsasStop);
\r
247 toolsMenu.add(preferences);
\r
248 inputMenu.add(inputLocalFileMenuItem);
\r
249 inputMenu.add(inputURLMenuItem);
\r
250 inputMenu.add(inputTextboxMenuItem);
\r
251 windowMenu.add(closeAll);
\r
252 windowMenu.add(raiseRelated);
\r
253 windowMenu.add(minimizeAssociated);
\r
254 windowMenu.addSeparator();
\r
255 // inputMenu.add(vamsasLoad);
\r
261 * @param e DOCUMENT ME!
\r
263 protected void inputLocalFileMenuItem_actionPerformed(jalview.gui.
\r
271 * @param e DOCUMENT ME!
\r
273 protected void inputURLMenuItem_actionPerformed(jalview.gui.AlignViewport av)
\r
280 * @param e DOCUMENT ME!
\r
282 protected void inputTextboxMenuItem_actionPerformed(jalview.gui.AlignViewport
\r
290 protected void quit()
\r
297 * @param e DOCUMENT ME!
\r
299 protected void aboutMenuItem_actionPerformed(ActionEvent e)
\r
306 * @param e DOCUMENT ME!
\r
308 protected void documentationMenuItem_actionPerformed(ActionEvent e)
\r
315 * @param e DOCUMENT ME!
\r
317 public void SaveState_actionPerformed(ActionEvent e)
\r
324 * @param e DOCUMENT ME!
\r
326 protected void preferences_actionPerformed(ActionEvent e)
\r
333 * @param e DOCUMENT ME!
\r
335 public void saveState_actionPerformed(ActionEvent e)
\r
342 * @param e DOCUMENT ME!
\r
344 public void loadState_actionPerformed(ActionEvent e)
\r
351 * @param e DOCUMENT ME!
\r
353 public void loadJalviewAlign_actionPerformed(ActionEvent e)
\r
357 public void vamsasLoad_actionPerformed(ActionEvent e)
\r
362 public void inputSequence_actionPerformed(ActionEvent e)
\r
367 public void vamsasStop_actionPerformed(ActionEvent e)
\r
372 public void closeAll_actionPerformed(ActionEvent e)
\r
377 public void raiseRelated_actionPerformed(ActionEvent e)
\r
382 public void minimizeAssociated_actionPerformed(ActionEvent e)
\r