JAL-1125 option to switch between Jalview and SeqSpace PCA calculation modes
[jalview.git] / src / jalview / jbgui / GPCAPanel.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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  */
18 package jalview.jbgui;
19
20 import java.awt.*;
21 import java.awt.event.*;
22
23 import javax.swing.*;
24 import javax.swing.event.*;
25
26 public class GPCAPanel extends JInternalFrame
27 {
28   JPanel jPanel2 = new JPanel();
29
30   JLabel jLabel1 = new JLabel();
31
32   JLabel jLabel2 = new JLabel();
33
34   JLabel jLabel3 = new JLabel();
35
36   protected JComboBox xCombobox = new JComboBox();
37
38   protected JComboBox yCombobox = new JComboBox();
39
40   protected JComboBox zCombobox = new JComboBox();
41   
42   protected JButton resetButton = new JButton();
43   
44   FlowLayout flowLayout1 = new FlowLayout();
45
46   BorderLayout borderLayout1 = new BorderLayout();
47
48   JMenuBar jMenuBar1 = new JMenuBar();
49
50   JMenu fileMenu = new JMenu();
51
52   JMenu saveMenu = new JMenu();
53
54   JMenuItem eps = new JMenuItem();
55
56   JMenuItem png = new JMenuItem();
57
58   JMenuItem print = new JMenuItem();
59
60   JMenuItem outputValues = new JMenuItem();
61
62   JMenuItem outputPoints = new JMenuItem();
63
64   JMenuItem outputProjPoints = new JMenuItem();
65
66   protected JMenu viewMenu = new JMenu();
67
68   protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
69
70   JMenuItem bgcolour = new JMenuItem();
71
72   JMenuItem originalSeqData = new JMenuItem();
73
74   protected JMenu associateViewsMenu = new JMenu();
75
76   protected JMenu calcSettings=new JMenu();
77   protected JCheckBoxMenuItem nuclSetting=new JCheckBoxMenuItem();
78   protected JCheckBoxMenuItem protSetting=new JCheckBoxMenuItem();
79   protected JCheckBoxMenuItem jvVersionSetting=new JCheckBoxMenuItem();
80   
81   protected JLabel statusBar = new JLabel();
82   protected GridLayout statusPanelLayout = new GridLayout();
83   protected JPanel statusPanel=new JPanel();
84   public GPCAPanel()
85   {
86     try
87     {
88       jbInit();
89     } catch (Exception e)
90     {
91       e.printStackTrace();
92     }
93
94     for (int i = 1; i < 8; i++)
95     {
96       xCombobox.addItem("dim " + i);
97       yCombobox.addItem("dim " + i);
98       zCombobox.addItem("dim " + i);
99     }
100
101     setJMenuBar(jMenuBar1);
102   }
103
104   private void jbInit() throws Exception
105   {
106     this.getContentPane().setLayout(borderLayout1);
107     jPanel2.setLayout(flowLayout1);
108     jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));
109     jLabel1.setText("x=");
110     jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));
111     jLabel2.setText("y=");
112     jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));
113     jLabel3.setText("z=");
114     jPanel2.setBackground(Color.white);
115     jPanel2.setBorder(null);
116     zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
117     zCombobox.addActionListener(new java.awt.event.ActionListener()
118     {
119       public void actionPerformed(ActionEvent e)
120       {
121         zCombobox_actionPerformed(e);
122       }
123     });
124     yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
125     yCombobox.addActionListener(new java.awt.event.ActionListener()
126     {
127       public void actionPerformed(ActionEvent e)
128       {
129         yCombobox_actionPerformed(e);
130       }
131     });
132     xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
133     xCombobox.addActionListener(new java.awt.event.ActionListener()
134     {
135       public void actionPerformed(ActionEvent e)
136       {
137         xCombobox_actionPerformed(e);
138       }
139     });
140     resetButton.setFont(new java.awt.Font("Verdana",0,12));
141     resetButton.setText("Reset");
142     resetButton.addActionListener(new java.awt.event.ActionListener()
143     {
144       @Override
145       public void actionPerformed(ActionEvent e)
146       {
147         resetButton_actionPerformed(e);
148       }
149     });
150     fileMenu.setText("File");
151     saveMenu.setText("Save as");
152     eps.setText("EPS");
153     eps.addActionListener(new ActionListener()
154     {
155       public void actionPerformed(ActionEvent e)
156       {
157         eps_actionPerformed(e);
158       }
159     });
160     png.setText("PNG");
161     png.addActionListener(new ActionListener()
162     {
163       public void actionPerformed(ActionEvent e)
164       {
165         png_actionPerformed(e);
166       }
167     });
168     outputValues.setText("Output Values...");
169     outputValues.addActionListener(new ActionListener()
170     {
171       public void actionPerformed(ActionEvent e)
172       {
173         outputValues_actionPerformed(e);
174       }
175     });
176     outputPoints.setText("Output points...");
177     outputPoints.addActionListener(new ActionListener()
178     {
179       public void actionPerformed(ActionEvent e)
180       {
181         outputPoints_actionPerformed(e);
182       }
183     });
184     outputProjPoints.setText("Output transformed points...");
185     outputProjPoints.addActionListener(new ActionListener()
186     {
187       public void actionPerformed(ActionEvent e)
188       {
189         outputProjPoints_actionPerformed(e);
190       }
191     });
192     print.addActionListener(new ActionListener()
193     {
194       public void actionPerformed(ActionEvent e)
195       {
196         print_actionPerformed(e);
197       }
198     });
199     viewMenu.setText("View");
200     viewMenu.addMenuListener(new MenuListener()
201     {
202       public void menuSelected(MenuEvent e)
203       {
204         viewMenu_menuSelected();
205       }
206
207       public void menuDeselected(MenuEvent e)
208       {
209       }
210
211       public void menuCanceled(MenuEvent e)
212       {
213       }
214     });
215     showLabels.setText("Show Labels");
216     showLabels.addActionListener(new ActionListener()
217     {
218       public void actionPerformed(ActionEvent e)
219       {
220         showLabels_actionPerformed(e);
221       }
222     });
223     print.setText("Print");
224     bgcolour.setText("Background Colour...");
225     bgcolour.addActionListener(new ActionListener()
226     {
227       public void actionPerformed(ActionEvent e)
228       {
229         bgcolour_actionPerformed(e);
230       }
231     });
232     originalSeqData.setText("Input Data...");
233     originalSeqData.addActionListener(new ActionListener()
234     {
235       public void actionPerformed(ActionEvent e)
236       {
237         originalSeqData_actionPerformed(e);
238       }
239     });
240     associateViewsMenu.setText("Associate Nodes With");
241     calcSettings.setText("Change Parameters");
242     nuclSetting.setText("Nucleotide matrix");
243     protSetting.setText("Protein matrix");
244     nuclSetting.addActionListener(new ActionListener()
245     {
246       
247       @Override
248       public void actionPerformed(ActionEvent arg0)
249       {
250         nuclSetting_actionPerfomed(arg0);
251       }
252     });
253     protSetting.addActionListener(new ActionListener()
254     {
255       
256       @Override
257       public void actionPerformed(ActionEvent arg0)
258       {
259         protSetting_actionPerfomed(arg0);
260       }
261     });
262     jvVersionSetting.setText("Jalview PCA Calculation");
263     jvVersionSetting.addActionListener(new ActionListener()
264     {
265       @Override
266       public void actionPerformed(ActionEvent arg0)
267       {
268         jvVersionSetting_actionPerfomed(arg0);
269       }
270     });
271     calcSettings.add(jvVersionSetting);
272     calcSettings.add(nuclSetting);
273     calcSettings.add(protSetting);
274     statusPanel.setLayout(statusPanelLayout);
275     statusBar.setFont(new java.awt.Font("Verdana",0,12));
276     //statusPanel.setBackground(Color.lightGray);
277     //statusBar.setBackground(Color.lightGray);
278     //statusPanel.add(statusBar, null);
279     JPanel panelBar = new JPanel(new BorderLayout());
280     panelBar.add(jPanel2, BorderLayout.NORTH);
281     panelBar.add(statusPanel, BorderLayout.SOUTH);
282     this.getContentPane().add(panelBar, BorderLayout.SOUTH);
283     jPanel2.add(jLabel1, null);
284     jPanel2.add(xCombobox, null);
285     jPanel2.add(jLabel2, null);
286     jPanel2.add(yCombobox, null);
287     jPanel2.add(jLabel3, null);
288     jPanel2.add(zCombobox, null);
289     jPanel2.add(resetButton, null);
290     jMenuBar1.add(fileMenu);
291     jMenuBar1.add(viewMenu);
292     jMenuBar1.add(calcSettings);
293     fileMenu.add(saveMenu);
294     fileMenu.add(outputValues);
295     fileMenu.add(print);
296     fileMenu.add(originalSeqData);
297     fileMenu.add(outputPoints);
298     fileMenu.add(outputProjPoints);
299     saveMenu.add(eps);
300     saveMenu.add(png);
301     viewMenu.add(showLabels);
302     viewMenu.add(bgcolour);
303     viewMenu.add(associateViewsMenu);
304   }
305
306   protected void resetButton_actionPerformed(ActionEvent e)
307   {
308     // TODO Auto-generated method stub
309     
310   }
311
312   protected void protSetting_actionPerfomed(ActionEvent arg0)
313   {
314     // TODO Auto-generated method stub
315     
316   }
317
318   protected void nuclSetting_actionPerfomed(ActionEvent arg0)
319   {
320     // TODO Auto-generated method stub
321     
322   }
323
324   protected void outputPoints_actionPerformed(ActionEvent e)
325   {
326     // TODO Auto-generated method stub
327
328   }
329
330   protected void outputProjPoints_actionPerformed(ActionEvent e)
331   {
332     // TODO Auto-generated method stub
333
334   }
335
336   protected void xCombobox_actionPerformed(ActionEvent e)
337   {
338   }
339
340   protected void yCombobox_actionPerformed(ActionEvent e)
341   {
342   }
343
344   protected void zCombobox_actionPerformed(ActionEvent e)
345   {
346   }
347
348   public void eps_actionPerformed(ActionEvent e)
349   {
350
351   }
352
353   public void png_actionPerformed(ActionEvent e)
354   {
355
356   }
357
358   public void outputValues_actionPerformed(ActionEvent e)
359   {
360
361   }
362
363   public void print_actionPerformed(ActionEvent e)
364   {
365
366   }
367
368   public void showLabels_actionPerformed(ActionEvent e)
369   {
370
371   }
372
373   public void bgcolour_actionPerformed(ActionEvent e)
374   {
375
376   }
377
378   public void originalSeqData_actionPerformed(ActionEvent e)
379   {
380
381   }
382
383   public void viewMenu_menuSelected()
384   {
385
386   }
387
388   protected void jvVersionSetting_actionPerfomed(ActionEvent arg0)
389   {
390     // TODO Auto-generated method stub
391     
392   }
393 }