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