Merge branch 'develop' into trialMerge
[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<>();
51
52   protected JComboBox<String> yCombobox = new JComboBox<>();
53
54   protected JComboBox<String> zCombobox = new JComboBox<>();
55
56   protected JMenu viewMenu = new JMenu();
57
58   protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
59
60   protected JMenu associateViewsMenu = new JMenu();
61
62   protected JLabel statusBar = new JLabel();
63
64   protected JPanel statusPanel = new JPanel();
65
66   protected JMenuItem originalSeqData;
67
68   /**
69    * Constructor
70    */
71   public GPCAPanel()
72   {
73     try
74     {
75       jbInit();
76     } catch (Exception e)
77     {
78       e.printStackTrace();
79     }
80
81     for (int i = 1; i < 8; i++)
82     {
83       xCombobox.addItem("dim " + i);
84       yCombobox.addItem("dim " + i);
85       zCombobox.addItem("dim " + i);
86     }
87   }
88
89   private void jbInit() throws Exception
90   {
91     this.getContentPane().setLayout(new BorderLayout());
92     JPanel jPanel2 = new JPanel();
93     jPanel2.setLayout(new FlowLayout());
94     JLabel jLabel1 = new JLabel();
95     jLabel1.setFont(VERDANA_12);
96     jLabel1.setText("x=");
97     JLabel jLabel2 = new JLabel();
98     jLabel2.setFont(VERDANA_12);
99     jLabel2.setText("y=");
100     JLabel jLabel3 = new JLabel();
101     jLabel3.setFont(VERDANA_12);
102     jLabel3.setText("z=");
103     jPanel2.setBackground(Color.white);
104     jPanel2.setBorder(null);
105     zCombobox.setFont(VERDANA_12);
106     zCombobox.addActionListener(new ActionListener()
107     {
108       @Override
109       public void actionPerformed(ActionEvent e)
110       {
111         doDimensionChange();
112       }
113     });
114     yCombobox.setFont(VERDANA_12);
115     yCombobox.addActionListener(new ActionListener()
116     {
117       @Override
118       public void actionPerformed(ActionEvent e)
119       {
120         doDimensionChange();
121       }
122     });
123     xCombobox.setFont(VERDANA_12);
124     xCombobox.addActionListener(new ActionListener()
125     {
126       @Override
127       public void actionPerformed(ActionEvent e)
128       {
129         doDimensionChange();
130       }
131     });
132     JButton resetButton = new JButton();
133     resetButton.setFont(VERDANA_12);
134     resetButton.setText(MessageManager.getString("action.reset"));
135     resetButton.addActionListener(new ActionListener()
136     {
137       @Override
138       public void actionPerformed(ActionEvent e)
139       {
140         resetButton_actionPerformed();
141       }
142     });
143     JMenu fileMenu = new JMenu();
144     fileMenu.setText(MessageManager.getString("action.file"));
145     JMenu saveMenu = new JMenu();
146     saveMenu.setText(MessageManager.getString("action.save_as"));
147     JMenuItem eps = new JMenuItem("EPS");
148     eps.addActionListener(new ActionListener()
149     {
150       @Override
151       public void actionPerformed(ActionEvent e)
152       {
153         makePCAImage(TYPE.EPS);
154       }
155     });
156     JMenuItem png = new JMenuItem("PNG");
157     png.addActionListener(new ActionListener()
158     {
159       @Override
160       public void actionPerformed(ActionEvent e)
161       {
162         makePCAImage(TYPE.PNG);
163       }
164     });
165     JMenuItem outputValues = new JMenuItem();
166     outputValues.setText(MessageManager.getString("label.output_values"));
167     outputValues.addActionListener(new ActionListener()
168     {
169       @Override
170       public void actionPerformed(ActionEvent e)
171       {
172         outputValues_actionPerformed();
173       }
174     });
175     JMenuItem outputPoints = new JMenuItem();
176     outputPoints.setText(MessageManager.getString("label.output_points"));
177     outputPoints.addActionListener(new ActionListener()
178     {
179       @Override
180       public void actionPerformed(ActionEvent e)
181       {
182         outputPoints_actionPerformed();
183       }
184     });
185     JMenuItem outputProjPoints = new JMenuItem();
186     outputProjPoints.setText(
187             MessageManager.getString("label.output_transformed_points"));
188     outputProjPoints.addActionListener(new ActionListener()
189     {
190       @Override
191       public void actionPerformed(ActionEvent e)
192       {
193         outputProjPoints_actionPerformed();
194       }
195     });
196     JMenuItem print = new JMenuItem();
197     print.setText(MessageManager.getString("action.print"));
198     print.addActionListener(new ActionListener()
199     {
200       @Override
201       public void actionPerformed(ActionEvent e)
202       {
203         print_actionPerformed();
204       }
205     });
206     viewMenu.setText(MessageManager.getString("action.view"));
207     viewMenu.addMenuListener(new MenuListener()
208     {
209       @Override
210       public void menuSelected(MenuEvent e)
211       {
212         viewMenu_menuSelected();
213       }
214
215       @Override
216       public void menuDeselected(MenuEvent e)
217       {
218       }
219
220       @Override
221       public void menuCanceled(MenuEvent e)
222       {
223       }
224     });
225     showLabels.setText(MessageManager.getString("label.show_labels"));
226     showLabels.addActionListener(new ActionListener()
227     {
228       @Override
229       public void actionPerformed(ActionEvent e)
230       {
231         showLabels_actionPerformed();
232       }
233     });
234     JMenuItem bgcolour = new JMenuItem();
235     bgcolour.setText(MessageManager.getString("action.background_colour"));
236     bgcolour.addActionListener(new ActionListener()
237     {
238       @Override
239       public void actionPerformed(ActionEvent e)
240       {
241         bgcolour_actionPerformed();
242       }
243     });
244     originalSeqData = new JMenuItem();
245     originalSeqData.setText(MessageManager.getString("label.input_data"));
246     originalSeqData.addActionListener(new ActionListener()
247     {
248       @Override
249       public void actionPerformed(ActionEvent e)
250       {
251         originalSeqData_actionPerformed();
252       }
253     });
254     associateViewsMenu.setText(
255             MessageManager.getString("label.associate_nodes_with"));
256
257     statusPanel.setLayout(new GridLayout());
258     statusBar.setFont(VERDANA_12);
259     // statusPanel.setBackground(Color.lightGray);
260     // statusBar.setBackground(Color.lightGray);
261     // statusPanel.add(statusBar, null);
262     JPanel panelBar = new JPanel(new BorderLayout());
263     panelBar.add(jPanel2, BorderLayout.NORTH);
264     panelBar.add(statusPanel, BorderLayout.SOUTH);
265     this.getContentPane().add(panelBar, BorderLayout.SOUTH);
266     jPanel2.add(jLabel1, null);
267     jPanel2.add(xCombobox, null);
268     jPanel2.add(jLabel2, null);
269     jPanel2.add(yCombobox, null);
270     jPanel2.add(jLabel3, null);
271     jPanel2.add(zCombobox, null);
272     jPanel2.add(resetButton, null);
273
274     JMenuBar jMenuBar1 = new JMenuBar();
275     jMenuBar1.add(fileMenu);
276     jMenuBar1.add(viewMenu);
277     setJMenuBar(jMenuBar1);
278     fileMenu.add(saveMenu);
279     fileMenu.add(outputValues);
280     fileMenu.add(print);
281     fileMenu.add(originalSeqData);
282     fileMenu.add(outputPoints);
283     fileMenu.add(outputProjPoints);
284     saveMenu.add(eps);
285     saveMenu.add(png);
286     viewMenu.add(showLabels);
287     viewMenu.add(bgcolour);
288     viewMenu.add(associateViewsMenu);
289   }
290
291   protected void resetButton_actionPerformed()
292   {
293   }
294
295   protected void outputPoints_actionPerformed()
296   {
297   }
298
299   protected void outputProjPoints_actionPerformed()
300   {
301   }
302
303   public void makePCAImage(TYPE imageType)
304   {
305   }
306
307   protected void outputValues_actionPerformed()
308   {
309   }
310
311   protected void print_actionPerformed()
312   {
313   }
314
315   protected void showLabels_actionPerformed()
316   {
317   }
318
319   protected void bgcolour_actionPerformed()
320   {
321   }
322
323   protected void originalSeqData_actionPerformed()
324   {
325   }
326
327   protected void viewMenu_menuSelected()
328   {
329   }
330
331   protected void doDimensionChange()
332   {
333   }
334 }