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