Merge branch 'Release_2_8_1_Branch_i18n' into try_r20b1_merge
[jalview.git] / src / jalview / jbgui / GDesktop.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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     FileMenu.setText(MessageManager.getString("action.file"));
133     HelpMenu.setText(MessageManager.getString("action.help"));
134     VamsasMenu.setText("Vamsas");
135     VamsasMenu.setToolTipText(MessageManager.getString("label.share_data_vamsas_applications"));
136     VamsasStMenu.setText(MessageManager.getString("label.connect_to"));
137     VamsasStMenu.setToolTipText(MessageManager.getString("label.join_existing_vamsas_session"));
138     inputLocalFileMenuItem.setText(MessageManager.getString("label.load_tree_from_file"));
139     inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke
140             .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit
141                     .getDefaultToolkit().getMenuShortcutKeyMask(), false));
142     inputLocalFileMenuItem
143             .addActionListener(new java.awt.event.ActionListener()
144             {
145               public void actionPerformed(ActionEvent e)
146               {
147                 inputLocalFileMenuItem_actionPerformed(null);
148               }
149             });
150     inputURLMenuItem.setText(MessageManager.getString("label.from_url"));
151     inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()
152     {
153       public void actionPerformed(ActionEvent e)
154       {
155         inputURLMenuItem_actionPerformed(null);
156       }
157     });
158     inputTextboxMenuItem.setText(MessageManager.getString("label.from_textbox"));
159     inputTextboxMenuItem
160             .addActionListener(new java.awt.event.ActionListener()
161             {
162               public void actionPerformed(ActionEvent e)
163               {
164                 inputTextboxMenuItem_actionPerformed(null);
165               }
166             });
167     quit.setText(MessageManager.getString("action.quit"));
168     quit.addActionListener(new java.awt.event.ActionListener()
169     {
170       public void actionPerformed(ActionEvent e)
171       {
172         quit();
173       }
174     });
175     aboutMenuItem.setText(MessageManager.getString("label.about"));
176     aboutMenuItem.addActionListener(new java.awt.event.ActionListener()
177     {
178       public void actionPerformed(ActionEvent e)
179       {
180         aboutMenuItem_actionPerformed(e);
181       }
182     });
183     documentationMenuItem.setText(MessageManager.getString("label.documentation"));
184     documentationMenuItem.setAccelerator(javax.swing.KeyStroke
185             .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false));
186     documentationMenuItem
187             .addActionListener(new java.awt.event.ActionListener()
188             {
189               public void actionPerformed(ActionEvent e)
190               {
191                 documentationMenuItem_actionPerformed(e);
192               }
193             });
194     this.getContentPane().setLayout(flowLayout1);
195     windowMenu.setText(MessageManager.getString("label.window"));
196     preferences.setText(MessageManager.getString("label.preferences") + "...");
197     preferences.addActionListener(new ActionListener()
198     {
199       public void actionPerformed(ActionEvent e)
200       {
201         preferences_actionPerformed(e);
202       }
203     });
204     toolsMenu.setText(MessageManager.getString("label.tools"));
205     saveState.setText(MessageManager.getString("action.save_project"));
206     saveState.addActionListener(new ActionListener()
207     {
208       public void actionPerformed(ActionEvent e)
209       {
210         saveState_actionPerformed(e);
211       }
212     });
213     loadState.setText(MessageManager.getString("action.load_project"));
214     loadState.addActionListener(new ActionListener()
215     {
216       public void actionPerformed(ActionEvent e)
217       {
218         loadState_actionPerformed(e);
219       }
220     });
221     inputMenu.setText(MessageManager.getString("label.input_alignment"));
222     vamsasStart.setText(MessageManager.getString("label.new_vamsas_session") + "...");
223     vamsasStart.setVisible(false);
224     vamsasStart.addActionListener(new ActionListener()
225     {
226       public void actionPerformed(ActionEvent e)
227       {
228         vamsasStart_actionPerformed(e);
229       }
230     });
231     vamsasImport.setText(MessageManager.getString("label.load_vamsas_session") + "...");
232     vamsasImport.setVisible(false);
233     vamsasImport.addActionListener(new ActionListener()
234     {
235       public void actionPerformed(ActionEvent e)
236       {
237         vamsasImport_actionPerformed(e);
238       }
239     });
240     vamsasSave.setText(MessageManager.getString("label.save_vamsas_session") + "...");
241     vamsasSave.setVisible(false);
242     vamsasSave.addActionListener(new ActionListener()
243     {
244       public void actionPerformed(ActionEvent e)
245       {
246         vamsasSave_actionPerformed(e);
247       }
248     });
249     inputSequence.setText(MessageManager.getString("label.fetch_sequences") + "...");
250     inputSequence.addActionListener(new ActionListener()
251     {
252       public void actionPerformed(ActionEvent e)
253       {
254         inputSequence_actionPerformed(e);
255       }
256     });
257     vamsasStop.setText(MessageManager.getString("label.stop_vamsas_session"));
258     vamsasStop.setVisible(false);
259     vamsasStop.addActionListener(new ActionListener()
260     {
261       public void actionPerformed(ActionEvent e)
262       {
263         vamsasStop_actionPerformed(e);
264       }
265     });
266     closeAll.setText(MessageManager.getString("action.close_all"));
267     closeAll.addActionListener(new ActionListener()
268     {
269       public void actionPerformed(ActionEvent e)
270       {
271         closeAll_actionPerformed(e);
272       }
273     });
274     raiseRelated.setText(MessageManager.getString("action.raise_associated_windows"));
275     raiseRelated.addActionListener(new ActionListener()
276     {
277       public void actionPerformed(ActionEvent e)
278       {
279         raiseRelated_actionPerformed(e);
280       }
281     });
282     minimizeAssociated.setText(MessageManager.getString("action.minimize_associated_windows"));
283     minimizeAssociated.addActionListener(new ActionListener()
284     {
285       public void actionPerformed(ActionEvent e)
286       {
287         minimizeAssociated_actionPerformed(e);
288       }
289     });
290     garbageCollect.setText(MessageManager.getString("label.collect_garbage"));
291     garbageCollect.addActionListener(new ActionListener()
292     {
293       public void actionPerformed(ActionEvent e)
294       {
295         garbageCollect_actionPerformed(e);
296       }
297     });
298     showMemusage.setText(MessageManager.getString("label.show_memory_usage"));
299     showMemusage.addActionListener(new ActionListener()
300     {
301       public void actionPerformed(ActionEvent e)
302       {
303         showMemusage_actionPerformed(e);
304       }
305     });
306     showConsole.setText(MessageManager.getString("label.show_java_console"));
307     showConsole.addActionListener(new ActionListener()
308     {
309       public void actionPerformed(ActionEvent e)
310       {
311         showConsole_actionPerformed(e);
312       }
313     });
314     showNews.setText(MessageManager.getString("label.show_jalview_news"));
315     showNews.addActionListener(new ActionListener()
316     {
317       public void actionPerformed(ActionEvent e)
318       {
319         showNews_actionPerformed(e);
320       }
321     });
322     desktopMenubar.add(FileMenu);
323     desktopMenubar.add(toolsMenu);
324     VamsasMenu.setVisible(false);
325     desktopMenubar.add(VamsasMenu);
326     desktopMenubar.add(HelpMenu);
327     desktopMenubar.add(windowMenu);
328     FileMenu.add(inputMenu);
329     FileMenu.add(inputSequence);
330     FileMenu.addSeparator();
331     FileMenu.add(saveState);
332     FileMenu.add(loadState);
333     FileMenu.addSeparator();
334     FileMenu.add(quit);
335     HelpMenu.add(aboutMenuItem);
336     HelpMenu.add(documentationMenuItem);
337     VamsasMenu.add(VamsasStMenu);
338     VamsasStMenu.setVisible(false);
339     VamsasMenu.add(vamsasStart);
340     VamsasMenu.add(vamsasImport);
341     VamsasMenu.add(vamsasSave);
342     VamsasMenu.add(vamsasStop);
343     toolsMenu.add(preferences);
344     toolsMenu.add(showMemusage);
345     toolsMenu.add(showConsole);
346     toolsMenu.add(showNews);
347     toolsMenu.add(garbageCollect);
348     inputMenu.add(inputLocalFileMenuItem);
349     inputMenu.add(inputURLMenuItem);
350     inputMenu.add(inputTextboxMenuItem);
351     windowMenu.add(closeAll);
352     windowMenu.add(raiseRelated);
353     windowMenu.add(minimizeAssociated);
354     windowMenu.addSeparator();
355     // inputMenu.add(vamsasLoad);
356   }
357
358   protected void showConsole_actionPerformed(ActionEvent e)
359   {
360     // TODO Auto-generated method stub
361
362   }
363
364   protected void showNews_actionPerformed(ActionEvent e)
365   {
366     // TODO Auto-generated method stub
367
368   }
369
370   protected void showMemusage_actionPerformed(ActionEvent e)
371   {
372     // TODO Auto-generated method stub
373
374   }
375
376   protected void garbageCollect_actionPerformed(ActionEvent e)
377   {
378     // TODO Auto-generated method stub
379
380   }
381
382   protected void vamsasStMenu_actionPerformed()
383   {
384   }
385
386   public void vamsasSave_actionPerformed(ActionEvent e)
387   {
388   }
389
390   /**
391    * DOCUMENT ME!
392    * 
393    * @param e
394    *          DOCUMENT ME!
395    */
396   protected void inputLocalFileMenuItem_actionPerformed(
397           jalview.gui.AlignViewport av)
398   {
399   }
400
401   /**
402    * DOCUMENT ME!
403    * 
404    * @param e
405    *          DOCUMENT ME!
406    */
407   protected void inputURLMenuItem_actionPerformed(
408           jalview.gui.AlignViewport av)
409   {
410   }
411
412   /**
413    * DOCUMENT ME!
414    * 
415    * @param e
416    *          DOCUMENT ME!
417    */
418   protected void inputTextboxMenuItem_actionPerformed(
419           jalview.gui.AlignViewport av)
420   {
421   }
422
423   /**
424    * DOCUMENT ME!
425    */
426   protected void quit()
427   {
428   }
429
430   /**
431    * DOCUMENT ME!
432    * 
433    * @param e
434    *          DOCUMENT ME!
435    */
436   protected void aboutMenuItem_actionPerformed(ActionEvent e)
437   {
438   }
439
440   /**
441    * DOCUMENT ME!
442    * 
443    * @param e
444    *          DOCUMENT ME!
445    */
446   protected void documentationMenuItem_actionPerformed(ActionEvent e)
447   {
448   }
449
450   /**
451    * DOCUMENT ME!
452    * 
453    * @param e
454    *          DOCUMENT ME!
455    */
456   public void SaveState_actionPerformed(ActionEvent e)
457   {
458   }
459
460   /**
461    * DOCUMENT ME!
462    * 
463    * @param e
464    *          DOCUMENT ME!
465    */
466   protected void preferences_actionPerformed(ActionEvent e)
467   {
468   }
469
470   /**
471    * DOCUMENT ME!
472    * 
473    * @param e
474    *          DOCUMENT ME!
475    */
476   public void saveState_actionPerformed(ActionEvent e)
477   {
478   }
479
480   /**
481    * DOCUMENT ME!
482    * 
483    * @param e
484    *          DOCUMENT ME!
485    */
486   public void loadState_actionPerformed(ActionEvent e)
487   {
488   }
489
490   /**
491    * DOCUMENT ME!
492    * 
493    * @param e
494    *          DOCUMENT ME!
495    */
496   public void loadJalviewAlign_actionPerformed(ActionEvent e)
497   {
498   }
499
500   public void vamsasStart_actionPerformed(ActionEvent e)
501   {
502
503   }
504
505   public void inputSequence_actionPerformed(ActionEvent e)
506   {
507
508   }
509
510   public void vamsasStop_actionPerformed(ActionEvent e)
511   {
512
513   }
514
515   public void closeAll_actionPerformed(ActionEvent e)
516   {
517
518   }
519
520   public void raiseRelated_actionPerformed(ActionEvent e)
521   {
522
523   }
524
525   public void minimizeAssociated_actionPerformed(ActionEvent e)
526   {
527
528   }
529
530   public void vamsasImport_actionPerformed(ActionEvent e)
531   {
532   }
533 }