Merge branch 'docs/2_8_1_Release' into Release_2_8_2_Branch
[jalview.git] / src / jalview / jbgui / GDesktop.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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.
10  *  
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.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.jbgui;
20
21 import jalview.util.MessageManager;
22
23 import java.awt.*;
24 import java.awt.event.*;
25
26 import javax.swing.*;
27
28 /**
29  * DOCUMENT ME!
30  * 
31  * @author $author$
32  * @version $Revision$
33  */
34 public class GDesktop extends JFrame
35 {
36   protected static JMenu windowMenu = new JMenu();
37
38   JMenuBar desktopMenubar = new JMenuBar();
39
40   JMenu FileMenu = new JMenu();
41
42   JMenu HelpMenu = new JMenu();
43
44   protected JMenu VamsasMenu = new JMenu();
45
46   protected JMenu VamsasStMenu = new JMenu();
47
48   JMenuItem inputLocalFileMenuItem = new JMenuItem();
49
50   JMenuItem inputURLMenuItem = new JMenuItem();
51
52   JMenuItem inputTextboxMenuItem = new JMenuItem();
53
54   JMenuItem quit = new JMenuItem();
55
56   JMenuItem aboutMenuItem = new JMenuItem();
57
58   JMenuItem documentationMenuItem = new JMenuItem();
59
60   FlowLayout flowLayout1 = new FlowLayout();
61
62   protected JMenu toolsMenu = new JMenu();
63
64   JMenuItem preferences = new JMenuItem();
65
66   JMenuItem saveState = new JMenuItem();
67
68   JMenuItem loadState = new JMenuItem();
69
70   JMenu inputMenu = new JMenu();
71
72   protected JMenuItem vamsasStart = new JMenuItem();
73
74   protected JMenuItem vamsasImport = new JMenuItem();
75
76   protected JMenuItem vamsasSave = new JMenuItem();
77
78   JMenuItem inputSequence = new JMenuItem();
79
80   protected JMenuItem vamsasStop = new JMenuItem();
81
82   JMenuItem closeAll = new JMenuItem();
83
84   JMenuItem raiseRelated = new JMenuItem();
85
86   JMenuItem minimizeAssociated = new JMenuItem();
87
88   protected JCheckBoxMenuItem showMemusage = new JCheckBoxMenuItem();
89
90   JMenuItem garbageCollect = new JMenuItem();
91
92   protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
93
94   protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
95
96   /**
97    * Creates a new GDesktop object.
98    */
99   public GDesktop()
100   {
101     try
102     {
103       jbInit();
104       this.setJMenuBar(desktopMenubar);
105     } catch (Exception e)
106     {
107       e.printStackTrace();
108     }
109
110     if (!new jalview.util.Platform().isAMac())
111     {
112       FileMenu.setMnemonic('F');
113       inputLocalFileMenuItem.setMnemonic('L');
114       VamsasMenu.setMnemonic('V');
115       inputURLMenuItem.setMnemonic('U');
116       inputTextboxMenuItem.setMnemonic('C');
117       quit.setMnemonic('Q');
118       saveState.setMnemonic('S');
119       loadState.setMnemonic('L');
120       inputMenu.setMnemonic('I');
121     }
122   }
123
124   /**
125    * DOCUMENT ME!
126    * 
127    * @throws Exception
128    *           DOCUMENT ME!
129    */
130   private void jbInit() throws Exception
131   {
132          
133     FileMenu.setText(MessageManager.getString("action.file"));
134     HelpMenu.setText(MessageManager.getString("action.help"));
135     VamsasMenu.setText("Vamsas");
136     VamsasMenu.setToolTipText(MessageManager.getString("label.share_data_vamsas_applications"));
137     VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
138     VamsasStMenu.setToolTipText(MessageManager.getString("label.join_existing_vamsas_session"));
139     inputLocalFileMenuItem.setText(MessageManager.getString("label.load_tree_from_file"));
140     inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
141             .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
142                     .getDefaultToolkit().getMenuShortcutKeyMask(), false));
143     inputLocalFileMenuItem
144             .addActionListener(new java.awt.event.ActionListener()
145             {
146               public void actionPerformed(ActionEvent e)
147               {
148                 inputLocalFileMenuItem_actionPerformed(null);
149               }
150             });
151     inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
152     inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
153     {
154       public void actionPerformed(ActionEvent e)
155       {
156         inputURLMenuItem_actionPerformed(null);
157       }
158     });
159     inputTextboxMenuItem.setText(MessageManager.getString("label.from_textbox"));
160     inputTextboxMenuItem
161             .addActionListener(new java.awt.event.ActionListener()
162             {
163               public void actionPerformed(ActionEvent e)
164               {
165                 inputTextboxMenuItem_actionPerformed(null);
166               }
167             });
168     quit.setText(MessageManager.getString("action.quit"));
169     quit.addActionListener(new java.awt.event.ActionListener()
170     {
171       public void actionPerformed(ActionEvent e)
172       {
173         quit();
174       }
175     });
176     aboutMenuItem.setText(MessageManager.getString("label.about"));
177     aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
178     {
179       public void actionPerformed(ActionEvent e)
180       {
181         aboutMenuItem_actionPerformed(e);
182       }
183     });
184     documentationMenuItem.setText(MessageManager.getString("label.documentation"));
185     documentationMenuItem.setAccelerator(javax.swing.KeyStroke
186             .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
187     documentationMenuItem
188             .addActionListener(new java.awt.event.ActionListener()
189             {
190               public void actionPerformed(ActionEvent e)
191               {
192                 documentationMenuItem_actionPerformed(e);
193               }
194             });
195     this.getContentPane().setLayout(flowLayout1);
196     windowMenu.setText(MessageManager.getString("label.window"));
197     preferences.setText(MessageManager.getString("label.preferences") + "...");
198     preferences.addActionListener(new ActionListener()
199     {
200       public void actionPerformed(ActionEvent e)
201       {
202         preferences_actionPerformed(e);
203       }
204     });
205     toolsMenu.setText(MessageManager.getString("label.tools"));
206     saveState.setText(MessageManager.getString("action.save_project"));
207     saveState.addActionListener(new ActionListener()
208     {
209       public void actionPerformed(ActionEvent e)
210       {
211         saveState_actionPerformed(e);
212       }
213     });
214     loadState.setText(MessageManager.getString("action.load_project"));
215     loadState.addActionListener(new ActionListener()
216     {
217       public void actionPerformed(ActionEvent e)
218       {
219         loadState_actionPerformed(e);
220       }
221     });
222     inputMenu.setText(MessageManager.getString("label.input_alignment"));
223     vamsasStart.setText(MessageManager.getString("label.new_vamsas_session") + "...");
224     vamsasStart.setVisible(false);
225     vamsasStart.addActionListener(new ActionListener()
226     {
227       public void actionPerformed(ActionEvent e)
228       {
229         vamsasStart_actionPerformed(e);
230       }
231     });
232     vamsasImport.setText(MessageManager.getString("label.load_vamsas_session") + "...");
233     vamsasImport.setVisible(false);
234     vamsasImport.addActionListener(new ActionListener()
235     {
236       public void actionPerformed(ActionEvent e)
237       {
238         vamsasImport_actionPerformed(e);
239       }
240     });
241     vamsasSave.setText(MessageManager.getString("label.save_vamsas_session") + "...");
242     vamsasSave.setVisible(false);
243     vamsasSave.addActionListener(new ActionListener()
244     {
245       public void actionPerformed(ActionEvent e)
246       {
247         vamsasSave_actionPerformed(e);
248       }
249     });
250     inputSequence.setText(MessageManager.getString("label.fetch_sequences") + "...");
251     inputSequence.addActionListener(new ActionListener()
252     {
253       public void actionPerformed(ActionEvent e)
254       {
255         inputSequence_actionPerformed(e);
256       }
257     });
258     vamsasStop.setText(MessageManager.getString("label.stop_vamsas_session"));
259     vamsasStop.setVisible(false);
260     vamsasStop.addActionListener(new ActionListener()
261     {
262       public void actionPerformed(ActionEvent e)
263       {
264         vamsasStop_actionPerformed(e);
265       }
266     });
267     closeAll.setText(MessageManager.getString("action.close_all"));
268     closeAll.addActionListener(new ActionListener()
269     {
270       public void actionPerformed(ActionEvent e)
271       {
272         closeAll_actionPerformed(e);
273       }
274     });
275     raiseRelated.setText(MessageManager.getString("action.raise_associated_windows"));
276     raiseRelated.addActionListener(new ActionListener()
277     {
278       public void actionPerformed(ActionEvent e)
279       {
280         raiseRelated_actionPerformed(e);
281       }
282     });
283     minimizeAssociated.setText(MessageManager.getString("action.minimize_associated_windows"));
284     minimizeAssociated.addActionListener(new ActionListener()
285     {
286       public void actionPerformed(ActionEvent e)
287       {
288         minimizeAssociated_actionPerformed(e);
289       }
290     });
291     garbageCollect.setText(MessageManager.getString("label.collect_garbage"));
292     garbageCollect.addActionListener(new ActionListener()
293     {
294       public void actionPerformed(ActionEvent e)
295       {
296         garbageCollect_actionPerformed(e);
297       }
298     });
299     showMemusage.setText(MessageManager.getString("label.show_memory_usage"));
300     showMemusage.addActionListener(new ActionListener()
301     {
302       public void actionPerformed(ActionEvent e)
303       {
304         showMemusage_actionPerformed(e);
305       }
306     });
307     showConsole.setText(MessageManager.getString("label.show_java_console"));
308     showConsole.addActionListener(new ActionListener()
309     {
310       public void actionPerformed(ActionEvent e)
311       {
312         showConsole_actionPerformed(e);
313       }
314     });
315     showNews.setText(MessageManager.getString("label.show_jalview_news"));
316     showNews.addActionListener(new ActionListener()
317     {
318       public void actionPerformed(ActionEvent e)
319       {
320         showNews_actionPerformed(e);
321       }
322     });
323     desktopMenubar.add(FileMenu);
324     desktopMenubar.add(toolsMenu);
325     VamsasMenu.setVisible(false);
326     desktopMenubar.add(VamsasMenu);
327     desktopMenubar.add(HelpMenu);
328     desktopMenubar.add(windowMenu);
329     FileMenu.add(inputMenu);
330     FileMenu.add(inputSequence);
331     FileMenu.addSeparator();
332     FileMenu.add(saveState);
333     FileMenu.add(loadState);
334     FileMenu.addSeparator();
335     FileMenu.add(quit);
336     HelpMenu.add(aboutMenuItem);
337     HelpMenu.add(documentationMenuItem);
338     VamsasMenu.add(VamsasStMenu);
339     VamsasStMenu.setVisible(false);
340     VamsasMenu.add(vamsasStart);
341     VamsasMenu.add(vamsasImport);
342     VamsasMenu.add(vamsasSave);
343     VamsasMenu.add(vamsasStop);
344     toolsMenu.add(preferences);
345     toolsMenu.add(showMemusage);
346     toolsMenu.add(showConsole);
347     toolsMenu.add(showNews);
348     toolsMenu.add(garbageCollect);
349     inputMenu.add(inputLocalFileMenuItem);
350     inputMenu.add(inputURLMenuItem);
351     inputMenu.add(inputTextboxMenuItem);
352     windowMenu.add(closeAll);
353     windowMenu.add(raiseRelated);
354     windowMenu.add(minimizeAssociated);
355     windowMenu.addSeparator();
356     // inputMenu.add(vamsasLoad);
357   }
358
359   protected void showConsole_actionPerformed(ActionEvent e)
360   {
361     // TODO Auto-generated method stub
362
363   }
364
365   protected void showNews_actionPerformed(ActionEvent e)
366   {
367     // TODO Auto-generated method stub
368
369   }
370
371   protected void showMemusage_actionPerformed(ActionEvent e)
372   {
373     // TODO Auto-generated method stub
374
375   }
376
377   protected void garbageCollect_actionPerformed(ActionEvent e)
378   {
379     // TODO Auto-generated method stub
380
381   }
382
383   protected void vamsasStMenu_actionPerformed()
384   {
385   }
386
387   public void vamsasSave_actionPerformed(ActionEvent e)
388   {
389   }
390
391   /**
392    * DOCUMENT ME!
393    * 
394    * @param e
395    *          DOCUMENT ME!
396    */
397   protected void inputLocalFileMenuItem_actionPerformed(
398           jalview.gui.AlignViewport av)
399   {
400   }
401
402   /**
403    * DOCUMENT ME!
404    * 
405    * @param e
406    *          DOCUMENT ME!
407    */
408   protected void inputURLMenuItem_actionPerformed(
409           jalview.gui.AlignViewport av)
410   {
411   }
412
413   /**
414    * DOCUMENT ME!
415    * 
416    * @param e
417    *          DOCUMENT ME!
418    */
419   protected void inputTextboxMenuItem_actionPerformed(
420           jalview.gui.AlignViewport av)
421   {
422   }
423
424   /**
425    * DOCUMENT ME!
426    */
427   protected void quit()
428   {
429   }
430
431   /**
432    * DOCUMENT ME!
433    * 
434    * @param e
435    *          DOCUMENT ME!
436    */
437   protected void aboutMenuItem_actionPerformed(ActionEvent e)
438   {
439   }
440
441   /**
442    * DOCUMENT ME!
443    * 
444    * @param e
445    *          DOCUMENT ME!
446    */
447   protected void documentationMenuItem_actionPerformed(ActionEvent e)
448   {
449   }
450
451   /**
452    * DOCUMENT ME!
453    * 
454    * @param e
455    *          DOCUMENT ME!
456    */
457   public void SaveState_actionPerformed(ActionEvent e)
458   {
459   }
460
461   /**
462    * DOCUMENT ME!
463    * 
464    * @param e
465    *          DOCUMENT ME!
466    */
467   protected void preferences_actionPerformed(ActionEvent e)
468   {
469   }
470
471   /**
472    * DOCUMENT ME!
473    * 
474    * @param e
475    *          DOCUMENT ME!
476    */
477   public void saveState_actionPerformed(ActionEvent e)
478   {
479   }
480
481   /**
482    * DOCUMENT ME!
483    * 
484    * @param e
485    *          DOCUMENT ME!
486    */
487   public void loadState_actionPerformed(ActionEvent e)
488   {
489   }
490
491   /**
492    * DOCUMENT ME!
493    * 
494    * @param e
495    *          DOCUMENT ME!
496    */
497   public void loadJalviewAlign_actionPerformed(ActionEvent e)
498   {
499   }
500
501   public void vamsasStart_actionPerformed(ActionEvent e)
502   {
503
504   }
505
506   public void inputSequence_actionPerformed(ActionEvent e)
507   {
508
509   }
510
511   public void vamsasStop_actionPerformed(ActionEvent e)
512   {
513
514   }
515
516   public void closeAll_actionPerformed(ActionEvent e)
517   {
518
519   }
520
521   public void raiseRelated_actionPerformed(ActionEvent e)
522   {
523
524   }
525
526   public void minimizeAssociated_actionPerformed(ActionEvent e)
527   {
528
529   }
530
531   public void vamsasImport_actionPerformed(ActionEvent e)
532   {
533   }
534 }