24961c060b5773ad6729914d3b74b418b1585188
[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 JCheckBoxMenuItem jvVersionSetting = new JCheckBoxMenuItem();
70
71   protected JLabel statusBar = new JLabel();
72
73   protected JPanel statusPanel = new JPanel();
74
75   public GPCAPanel()
76   {
77     try
78     {
79       jbInit();
80     } catch (Exception e)
81     {
82       e.printStackTrace();
83     }
84
85     for (int i = 1; i < 8; i++)
86     {
87       xCombobox.addItem("dim " + i);
88       yCombobox.addItem("dim " + i);
89       zCombobox.addItem("dim " + i);
90     }
91   }
92
93   private void jbInit() throws Exception
94   {
95     this.getContentPane().setLayout(new BorderLayout());
96     JPanel jPanel2 = new JPanel();
97     jPanel2.setLayout(new FlowLayout());
98     JLabel jLabel1 = new JLabel();
99     jLabel1.setFont(VERDANA_12);
100     jLabel1.setText("x=");
101     JLabel jLabel2 = new JLabel();
102     jLabel2.setFont(VERDANA_12);
103     jLabel2.setText("y=");
104     JLabel jLabel3 = new JLabel();
105     jLabel3.setFont(VERDANA_12);
106     jLabel3.setText("z=");
107     jPanel2.setBackground(Color.white);
108     jPanel2.setBorder(null);
109     zCombobox.setFont(VERDANA_12);
110     zCombobox.addActionListener(new ActionListener()
111     {
112       @Override
113       public void actionPerformed(ActionEvent e)
114       {
115         zCombobox_actionPerformed(e);
116       }
117     });
118     yCombobox.setFont(VERDANA_12);
119     yCombobox.addActionListener(new ActionListener()
120     {
121       @Override
122       public void actionPerformed(ActionEvent e)
123       {
124         yCombobox_actionPerformed(e);
125       }
126     });
127     xCombobox.setFont(VERDANA_12);
128     xCombobox.addActionListener(new ActionListener()
129     {
130       @Override
131       public void actionPerformed(ActionEvent e)
132       {
133         xCombobox_actionPerformed(e);
134       }
135     });
136     JButton resetButton = new JButton();
137     resetButton.setFont(VERDANA_12);
138     resetButton.setText(MessageManager.getString("action.reset"));
139     resetButton.addActionListener(new ActionListener()
140     {
141       @Override
142       public void actionPerformed(ActionEvent e)
143       {
144         resetButton_actionPerformed(e);
145       }
146     });
147     JMenu fileMenu = new JMenu();
148     fileMenu.setText(MessageManager.getString("action.file"));
149     JMenu saveMenu = new JMenu();
150     saveMenu.setText(MessageManager.getString("action.save_as"));
151     JMenuItem eps = new JMenuItem("EPS");
152     eps.addActionListener(new ActionListener()
153     {
154       @Override
155       public void actionPerformed(ActionEvent e)
156       {
157         eps_actionPerformed(e);
158       }
159     });
160     JMenuItem png = new JMenuItem("PNG");
161     png.addActionListener(new ActionListener()
162     {
163       @Override
164       public void actionPerformed(ActionEvent e)
165       {
166         png_actionPerformed(e);
167       }
168     });
169     JMenuItem outputValues = new JMenuItem();
170     outputValues.setText(MessageManager.getString("label.output_values"));
171     outputValues.addActionListener(new ActionListener()
172     {
173       @Override
174       public void actionPerformed(ActionEvent e)
175       {
176         outputValues_actionPerformed(e);
177       }
178     });
179     JMenuItem outputPoints = new JMenuItem();
180     outputPoints.setText(MessageManager.getString("label.output_points"));
181     outputPoints.addActionListener(new ActionListener()
182     {
183       @Override
184       public void actionPerformed(ActionEvent e)
185       {
186         outputPoints_actionPerformed(e);
187       }
188     });
189     JMenuItem outputProjPoints = new JMenuItem();
190     outputProjPoints.setText(MessageManager
191             .getString("label.output_transformed_points"));
192     outputProjPoints.addActionListener(new ActionListener()
193     {
194       @Override
195       public void actionPerformed(ActionEvent e)
196       {
197         outputProjPoints_actionPerformed(e);
198       }
199     });
200     JMenuItem print = new JMenuItem();
201     print.setText(MessageManager.getString("action.print"));
202     print.addActionListener(new ActionListener()
203     {
204       @Override
205       public void actionPerformed(ActionEvent e)
206       {
207         print_actionPerformed(e);
208       }
209     });
210     viewMenu.setText(MessageManager.getString("action.view"));
211     viewMenu.addMenuListener(new MenuListener()
212     {
213       @Override
214       public void menuSelected(MenuEvent e)
215       {
216         viewMenu_menuSelected();
217       }
218
219       @Override
220       public void menuDeselected(MenuEvent e)
221       {
222       }
223
224       @Override
225       public void menuCanceled(MenuEvent e)
226       {
227       }
228     });
229     scoreModelMenu.setText(MessageManager
230             .getString("label.select_score_model"));
231     scoreModelMenu.addMenuListener(new MenuListener()
232     {
233       @Override
234       public void menuSelected(MenuEvent e)
235       {
236         scoreModel_menuSelected();
237       }
238
239       @Override
240       public void menuDeselected(MenuEvent e)
241       {
242       }
243
244       @Override
245       public void menuCanceled(MenuEvent e)
246       {
247       }
248     });
249     showLabels.setText(MessageManager.getString("label.show_labels"));
250     showLabels.addActionListener(new ActionListener()
251     {
252       @Override
253       public void actionPerformed(ActionEvent e)
254       {
255         showLabels_actionPerformed(e);
256       }
257     });
258     JMenuItem bgcolour = new JMenuItem();
259     bgcolour.setText(MessageManager.getString("action.background_colour"));
260     bgcolour.addActionListener(new ActionListener()
261     {
262       @Override
263       public void actionPerformed(ActionEvent e)
264       {
265         bgcolour_actionPerformed(e);
266       }
267     });
268     JMenuItem originalSeqData = new JMenuItem();
269     originalSeqData.setText(MessageManager.getString("label.input_data"));
270     originalSeqData.addActionListener(new ActionListener()
271     {
272       @Override
273       public void actionPerformed(ActionEvent e)
274       {
275         originalSeqData_actionPerformed(e);
276       }
277     });
278     associateViewsMenu.setText(MessageManager
279             .getString("label.associate_nodes_with"));
280     calcSettings.setText(MessageManager.getString("action.change_params"));
281     nuclSetting
282             .setText(MessageManager.getString("label.nucleotide_matrix"));
283     protSetting.setText(MessageManager.getString("label.protein_matrix"));
284     nuclSetting.addActionListener(new ActionListener()
285     {
286
287       @Override
288       public void actionPerformed(ActionEvent arg0)
289       {
290         nuclSetting_actionPerfomed(arg0);
291       }
292     });
293     protSetting.addActionListener(new ActionListener()
294     {
295
296       @Override
297       public void actionPerformed(ActionEvent arg0)
298       {
299         protSetting_actionPerfomed(arg0);
300       }
301     });
302     jvVersionSetting.setText(MessageManager
303             .getString("label.jalview_pca_calculation"));
304     jvVersionSetting.addActionListener(new ActionListener()
305     {
306       @Override
307       public void actionPerformed(ActionEvent arg0)
308       {
309         jvVersionSetting_actionPerfomed(arg0);
310       }
311     });
312     // calcSettings.add(jvVersionSetting); // todo remove? JAL-2416
313     calcSettings.add(nuclSetting);
314     calcSettings.add(protSetting);
315     calcSettings.add(scoreModelMenu);
316     statusPanel.setLayout(new GridLayout());
317     statusBar.setFont(VERDANA_12);
318     // statusPanel.setBackground(Color.lightGray);
319     // statusBar.setBackground(Color.lightGray);
320     // statusPanel.add(statusBar, null);
321     JPanel panelBar = new JPanel(new BorderLayout());
322     panelBar.add(jPanel2, BorderLayout.NORTH);
323     panelBar.add(statusPanel, BorderLayout.SOUTH);
324     this.getContentPane().add(panelBar, BorderLayout.SOUTH);
325     jPanel2.add(jLabel1, null);
326     jPanel2.add(xCombobox, null);
327     jPanel2.add(jLabel2, null);
328     jPanel2.add(yCombobox, null);
329     jPanel2.add(jLabel3, null);
330     jPanel2.add(zCombobox, null);
331     jPanel2.add(resetButton, null);
332
333     JMenuBar jMenuBar1 = new JMenuBar();
334     jMenuBar1.add(fileMenu);
335     jMenuBar1.add(viewMenu);
336     jMenuBar1.add(calcSettings);
337     setJMenuBar(jMenuBar1);
338     fileMenu.add(saveMenu);
339     fileMenu.add(outputValues);
340     fileMenu.add(print);
341     fileMenu.add(originalSeqData);
342     fileMenu.add(outputPoints);
343     fileMenu.add(outputProjPoints);
344     saveMenu.add(eps);
345     saveMenu.add(png);
346     viewMenu.add(showLabels);
347     viewMenu.add(bgcolour);
348     viewMenu.add(associateViewsMenu);
349   }
350
351   protected void scoreModel_menuSelected()
352   {
353     // TODO Auto-generated method stub
354
355   }
356
357   protected void resetButton_actionPerformed(ActionEvent e)
358   {
359     // TODO Auto-generated method stub
360
361   }
362
363   protected void protSetting_actionPerfomed(ActionEvent arg0)
364   {
365     // TODO Auto-generated method stub
366
367   }
368
369   protected void nuclSetting_actionPerfomed(ActionEvent arg0)
370   {
371     // TODO Auto-generated method stub
372
373   }
374
375   protected void outputPoints_actionPerformed(ActionEvent e)
376   {
377     // TODO Auto-generated method stub
378
379   }
380
381   protected void outputProjPoints_actionPerformed(ActionEvent e)
382   {
383     // TODO Auto-generated method stub
384
385   }
386
387   protected void xCombobox_actionPerformed(ActionEvent e)
388   {
389   }
390
391   protected void yCombobox_actionPerformed(ActionEvent e)
392   {
393   }
394
395   protected void zCombobox_actionPerformed(ActionEvent e)
396   {
397   }
398
399   public void eps_actionPerformed(ActionEvent e)
400   {
401
402   }
403
404   public void png_actionPerformed(ActionEvent e)
405   {
406
407   }
408
409   public void outputValues_actionPerformed(ActionEvent e)
410   {
411
412   }
413
414   public void print_actionPerformed(ActionEvent e)
415   {
416
417   }
418
419   public void showLabels_actionPerformed(ActionEvent e)
420   {
421
422   }
423
424   public void bgcolour_actionPerformed(ActionEvent e)
425   {
426
427   }
428
429   public void originalSeqData_actionPerformed(ActionEvent e)
430   {
431
432   }
433
434   public void viewMenu_menuSelected()
435   {
436
437   }
438
439   protected void jvVersionSetting_actionPerfomed(ActionEvent arg0)
440   {
441     // TODO Auto-generated method stub
442
443   }
444 }