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