JAL-2393 code tidying for review comments
[jalview.git] / src / jalview / jbgui / GPCAPanel.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ 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
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.jbgui;
22
23 import jalview.util.MessageManager;
24
25 import java.awt.BorderLayout;
26 import java.awt.Color;
27 import java.awt.FlowLayout;
28 import java.awt.Font;
29 import java.awt.GridLayout;
30 import java.awt.event.ActionEvent;
31 import java.awt.event.ActionListener;
32
33 import javax.swing.JButton;
34 import javax.swing.JCheckBoxMenuItem;
35 import javax.swing.JComboBox;
36 import javax.swing.JInternalFrame;
37 import javax.swing.JLabel;
38 import javax.swing.JMenu;
39 import javax.swing.JMenuBar;
40 import javax.swing.JMenuItem;
41 import javax.swing.JPanel;
42 import javax.swing.event.MenuEvent;
43 import javax.swing.event.MenuListener;
44
45 public class GPCAPanel extends JInternalFrame
46 {
47   private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
48
49   protected JComboBox<String> xCombobox = new JComboBox<String>();
50
51   protected JComboBox<String> yCombobox = new JComboBox<String>();
52
53   protected JComboBox<String> zCombobox = new JComboBox<String>();
54
55   protected JMenu scoreModelMenu = new JMenu();
56
57   protected JMenu viewMenu = new JMenu();
58
59   protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
60
61   protected JMenu associateViewsMenu = new JMenu();
62
63   protected JMenu calcSettings = new JMenu();
64
65   protected JCheckBoxMenuItem nuclSetting = new JCheckBoxMenuItem();
66
67   protected JCheckBoxMenuItem protSetting = new JCheckBoxMenuItem();
68
69   protected JLabel statusBar = new JLabel();
70
71   protected JPanel statusPanel = new JPanel();
72
73   public GPCAPanel()
74   {
75     try
76     {
77       jbInit();
78     } catch (Exception e)
79     {
80       e.printStackTrace();
81     }
82
83     for (int i = 1; i < 8; i++)
84     {
85       xCombobox.addItem("dim " + i);
86       yCombobox.addItem("dim " + i);
87       zCombobox.addItem("dim " + i);
88     }
89   }
90
91   private void jbInit() throws Exception
92   {
93     this.getContentPane().setLayout(new BorderLayout());
94     JPanel jPanel2 = new JPanel();
95     jPanel2.setLayout(new FlowLayout());
96     JLabel jLabel1 = new JLabel();
97     jLabel1.setFont(VERDANA_12);
98     jLabel1.setText("x=");
99     JLabel jLabel2 = new JLabel();
100     jLabel2.setFont(VERDANA_12);
101     jLabel2.setText("y=");
102     JLabel jLabel3 = new JLabel();
103     jLabel3.setFont(VERDANA_12);
104     jLabel3.setText("z=");
105     jPanel2.setBackground(Color.white);
106     jPanel2.setBorder(null);
107     zCombobox.setFont(VERDANA_12);
108     zCombobox.addActionListener(new ActionListener()
109     {
110       @Override
111       public void actionPerformed(ActionEvent e)
112       {
113         zCombobox_actionPerformed(e);
114       }
115     });
116     yCombobox.setFont(VERDANA_12);
117     yCombobox.addActionListener(new ActionListener()
118     {
119       @Override
120       public void actionPerformed(ActionEvent e)
121       {
122         yCombobox_actionPerformed(e);
123       }
124     });
125     xCombobox.setFont(VERDANA_12);
126     xCombobox.addActionListener(new ActionListener()
127     {
128       @Override
129       public void actionPerformed(ActionEvent e)
130       {
131         xCombobox_actionPerformed(e);
132       }
133     });
134     JButton resetButton = new JButton();
135     resetButton.setFont(VERDANA_12);
136     resetButton.setText(MessageManager.getString("action.reset"));
137     resetButton.addActionListener(new ActionListener()
138     {
139       @Override
140       public void actionPerformed(ActionEvent e)
141       {
142         resetButton_actionPerformed(e);
143       }
144     });
145     JMenu fileMenu = new JMenu();
146     fileMenu.setText(MessageManager.getString("action.file"));
147     JMenu saveMenu = new JMenu();
148     saveMenu.setText(MessageManager.getString("action.save_as"));
149     JMenuItem eps = new JMenuItem("EPS");
150     eps.addActionListener(new ActionListener()
151     {
152       @Override
153       public void actionPerformed(ActionEvent e)
154       {
155         eps_actionPerformed(e);
156       }
157     });
158     JMenuItem png = new JMenuItem("PNG");
159     png.addActionListener(new ActionListener()
160     {
161       @Override
162       public void actionPerformed(ActionEvent e)
163       {
164         png_actionPerformed(e);
165       }
166     });
167     JMenuItem outputValues = new JMenuItem();
168     outputValues.setText(MessageManager.getString("label.output_values"));
169     outputValues.addActionListener(new ActionListener()
170     {
171       @Override
172       public void actionPerformed(ActionEvent e)
173       {
174         outputValues_actionPerformed(e);
175       }
176     });
177     JMenuItem outputPoints = new JMenuItem();
178     outputPoints.setText(MessageManager.getString("label.output_points"));
179     outputPoints.addActionListener(new ActionListener()
180     {
181       @Override
182       public void actionPerformed(ActionEvent e)
183       {
184         outputPoints_actionPerformed(e);
185       }
186     });
187     JMenuItem outputProjPoints = new JMenuItem();
188     outputProjPoints.setText(MessageManager
189             .getString("label.output_transformed_points"));
190     outputProjPoints.addActionListener(new ActionListener()
191     {
192       @Override
193       public void actionPerformed(ActionEvent e)
194       {
195         outputProjPoints_actionPerformed(e);
196       }
197     });
198     JMenuItem print = new JMenuItem();
199     print.setText(MessageManager.getString("action.print"));
200     print.addActionListener(new ActionListener()
201     {
202       @Override
203       public void actionPerformed(ActionEvent e)
204       {
205         print_actionPerformed(e);
206       }
207     });
208     viewMenu.setText(MessageManager.getString("action.view"));
209     viewMenu.addMenuListener(new MenuListener()
210     {
211       @Override
212       public void menuSelected(MenuEvent e)
213       {
214         viewMenu_menuSelected();
215       }
216
217       @Override
218       public void menuDeselected(MenuEvent e)
219       {
220       }
221
222       @Override
223       public void menuCanceled(MenuEvent e)
224       {
225       }
226     });
227     scoreModelMenu.setText(MessageManager
228             .getString("label.select_score_model"));
229     scoreModelMenu.addMenuListener(new MenuListener()
230     {
231       @Override
232       public void menuSelected(MenuEvent e)
233       {
234         scoreModel_menuSelected();
235       }
236
237       @Override
238       public void menuDeselected(MenuEvent e)
239       {
240       }
241
242       @Override
243       public void menuCanceled(MenuEvent e)
244       {
245       }
246     });
247     showLabels.setText(MessageManager.getString("label.show_labels"));
248     showLabels.addActionListener(new ActionListener()
249     {
250       @Override
251       public void actionPerformed(ActionEvent e)
252       {
253         showLabels_actionPerformed(e);
254       }
255     });
256     JMenuItem bgcolour = new JMenuItem();
257     bgcolour.setText(MessageManager.getString("action.background_colour"));
258     bgcolour.addActionListener(new ActionListener()
259     {
260       @Override
261       public void actionPerformed(ActionEvent e)
262       {
263         bgcolour_actionPerformed(e);
264       }
265     });
266     JMenuItem originalSeqData = new JMenuItem();
267     originalSeqData.setText(MessageManager.getString("label.input_data"));
268     originalSeqData.addActionListener(new ActionListener()
269     {
270       @Override
271       public void actionPerformed(ActionEvent e)
272       {
273         originalSeqData_actionPerformed(e);
274       }
275     });
276     associateViewsMenu.setText(MessageManager
277             .getString("label.associate_nodes_with"));
278     calcSettings.setText(MessageManager.getString("action.change_params"));
279     nuclSetting
280             .setText(MessageManager.getString("label.nucleotide_matrix"));
281     protSetting.setText(MessageManager.getString("label.protein_matrix"));
282     nuclSetting.addActionListener(new ActionListener()
283     {
284
285       @Override
286       public void actionPerformed(ActionEvent arg0)
287       {
288         nuclSetting_actionPerfomed(arg0);
289       }
290     });
291     protSetting.addActionListener(new ActionListener()
292     {
293
294       @Override
295       public void actionPerformed(ActionEvent arg0)
296       {
297         protSetting_actionPerfomed(arg0);
298       }
299     });
300
301     calcSettings.add(nuclSetting);
302     calcSettings.add(protSetting);
303     calcSettings.add(scoreModelMenu);
304     statusPanel.setLayout(new GridLayout());
305     statusBar.setFont(VERDANA_12);
306     // statusPanel.setBackground(Color.lightGray);
307     // statusBar.setBackground(Color.lightGray);
308     // statusPanel.add(statusBar, null);
309     JPanel panelBar = new JPanel(new BorderLayout());
310     panelBar.add(jPanel2, BorderLayout.NORTH);
311     panelBar.add(statusPanel, BorderLayout.SOUTH);
312     this.getContentPane().add(panelBar, BorderLayout.SOUTH);
313     jPanel2.add(jLabel1, null);
314     jPanel2.add(xCombobox, null);
315     jPanel2.add(jLabel2, null);
316     jPanel2.add(yCombobox, null);
317     jPanel2.add(jLabel3, null);
318     jPanel2.add(zCombobox, null);
319     jPanel2.add(resetButton, null);
320
321     JMenuBar jMenuBar1 = new JMenuBar();
322     jMenuBar1.add(fileMenu);
323     jMenuBar1.add(viewMenu);
324     jMenuBar1.add(calcSettings);
325     setJMenuBar(jMenuBar1);
326     fileMenu.add(saveMenu);
327     fileMenu.add(outputValues);
328     fileMenu.add(print);
329     fileMenu.add(originalSeqData);
330     fileMenu.add(outputPoints);
331     fileMenu.add(outputProjPoints);
332     saveMenu.add(eps);
333     saveMenu.add(png);
334     viewMenu.add(showLabels);
335     viewMenu.add(bgcolour);
336     viewMenu.add(associateViewsMenu);
337   }
338
339   protected void scoreModel_menuSelected()
340   {
341     // TODO Auto-generated method stub
342
343   }
344
345   protected void resetButton_actionPerformed(ActionEvent e)
346   {
347     // TODO Auto-generated method stub
348
349   }
350
351   protected void protSetting_actionPerfomed(ActionEvent arg0)
352   {
353     // TODO Auto-generated method stub
354
355   }
356
357   protected void nuclSetting_actionPerfomed(ActionEvent arg0)
358   {
359     // TODO Auto-generated method stub
360
361   }
362
363   protected void outputPoints_actionPerformed(ActionEvent e)
364   {
365     // TODO Auto-generated method stub
366
367   }
368
369   protected void outputProjPoints_actionPerformed(ActionEvent e)
370   {
371     // TODO Auto-generated method stub
372
373   }
374
375   protected void xCombobox_actionPerformed(ActionEvent e)
376   {
377   }
378
379   protected void yCombobox_actionPerformed(ActionEvent e)
380   {
381   }
382
383   protected void zCombobox_actionPerformed(ActionEvent e)
384   {
385   }
386
387   public void eps_actionPerformed(ActionEvent e)
388   {
389
390   }
391
392   public void png_actionPerformed(ActionEvent e)
393   {
394
395   }
396
397   public void outputValues_actionPerformed(ActionEvent e)
398   {
399
400   }
401
402   public void print_actionPerformed(ActionEvent e)
403   {
404
405   }
406
407   public void showLabels_actionPerformed(ActionEvent e)
408   {
409
410   }
411
412   public void bgcolour_actionPerformed(ActionEvent e)
413   {
414
415   }
416
417   public void originalSeqData_actionPerformed(ActionEvent e)
418   {
419
420   }
421
422   public void viewMenu_menuSelected()
423   {
424
425   }
426 }