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