2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
21 package jalview.jbgui;
23 import jalview.util.ImageMaker.TYPE;
24 import jalview.util.MessageManager;
26 import java.awt.BorderLayout;
27 import java.awt.Color;
28 import java.awt.FlowLayout;
30 import java.awt.GridLayout;
31 import java.awt.event.ActionEvent;
32 import java.awt.event.ActionListener;
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;
46 public class GPCAPanel extends JInternalFrame
48 private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
50 protected JComboBox<String> xCombobox = new JComboBox<String>();
52 protected JComboBox<String> yCombobox = new JComboBox<String>();
54 protected JComboBox<String> zCombobox = new JComboBox<String>();
56 protected JMenu scoreModelMenu = new JMenu();
58 protected JMenu viewMenu = new JMenu();
60 protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
62 protected JMenu associateViewsMenu = new JMenu();
64 protected JMenu calcSettings = new JMenu();
66 protected JCheckBoxMenuItem nuclSetting = new JCheckBoxMenuItem();
68 protected JCheckBoxMenuItem protSetting = new JCheckBoxMenuItem();
70 protected JLabel statusBar = new JLabel();
72 protected JPanel statusPanel = new JPanel();
84 for (int i = 1; i < 8; i++)
86 xCombobox.addItem("dim " + i);
87 yCombobox.addItem("dim " + i);
88 zCombobox.addItem("dim " + i);
92 private void jbInit() throws Exception
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()
112 public void actionPerformed(ActionEvent e)
114 zCombobox_actionPerformed(e);
117 yCombobox.setFont(VERDANA_12);
118 yCombobox.addActionListener(new ActionListener()
121 public void actionPerformed(ActionEvent e)
123 yCombobox_actionPerformed(e);
126 xCombobox.setFont(VERDANA_12);
127 xCombobox.addActionListener(new ActionListener()
130 public void actionPerformed(ActionEvent e)
132 xCombobox_actionPerformed(e);
135 JButton resetButton = new JButton();
136 resetButton.setFont(VERDANA_12);
137 resetButton.setText(MessageManager.getString("action.reset"));
138 resetButton.addActionListener(new ActionListener()
141 public void actionPerformed(ActionEvent e)
143 resetButton_actionPerformed(e);
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()
154 public void actionPerformed(ActionEvent e)
156 makePCAImage(TYPE.EPS);
159 JMenuItem png = new JMenuItem("PNG");
160 png.addActionListener(new ActionListener()
163 public void actionPerformed(ActionEvent e)
165 makePCAImage(TYPE.PNG);
168 JMenuItem outputValues = new JMenuItem();
169 outputValues.setText(MessageManager.getString("label.output_values"));
170 outputValues.addActionListener(new ActionListener()
173 public void actionPerformed(ActionEvent e)
175 outputValues_actionPerformed(e);
178 JMenuItem outputPoints = new JMenuItem();
179 outputPoints.setText(MessageManager.getString("label.output_points"));
180 outputPoints.addActionListener(new ActionListener()
183 public void actionPerformed(ActionEvent e)
185 outputPoints_actionPerformed(e);
188 JMenuItem outputProjPoints = new JMenuItem();
189 outputProjPoints.setText(
190 MessageManager.getString("label.output_transformed_points"));
191 outputProjPoints.addActionListener(new ActionListener()
194 public void actionPerformed(ActionEvent e)
196 outputProjPoints_actionPerformed(e);
199 JMenuItem print = new JMenuItem();
200 print.setText(MessageManager.getString("action.print"));
201 print.addActionListener(new ActionListener()
204 public void actionPerformed(ActionEvent e)
206 print_actionPerformed(e);
209 viewMenu.setText(MessageManager.getString("action.view"));
210 viewMenu.addMenuListener(new MenuListener()
213 public void menuSelected(MenuEvent e)
215 viewMenu_menuSelected();
219 public void menuDeselected(MenuEvent e)
224 public void menuCanceled(MenuEvent e)
229 .setText(MessageManager.getString("label.select_score_model"));
230 scoreModelMenu.addMenuListener(new MenuListener()
233 public void menuSelected(MenuEvent e)
235 scoreModel_menuSelected();
239 public void menuDeselected(MenuEvent e)
244 public void menuCanceled(MenuEvent e)
248 showLabels.setText(MessageManager.getString("label.show_labels"));
249 showLabels.addActionListener(new ActionListener()
252 public void actionPerformed(ActionEvent e)
254 showLabels_actionPerformed(e);
257 JMenuItem bgcolour = new JMenuItem();
258 bgcolour.setText(MessageManager.getString("action.background_colour"));
259 bgcolour.addActionListener(new ActionListener()
262 public void actionPerformed(ActionEvent e)
264 bgcolour_actionPerformed(e);
267 JMenuItem originalSeqData = new JMenuItem();
268 originalSeqData.setText(MessageManager.getString("label.input_data"));
269 originalSeqData.addActionListener(new ActionListener()
272 public void actionPerformed(ActionEvent e)
274 originalSeqData_actionPerformed(e);
277 associateViewsMenu.setText(
278 MessageManager.getString("label.associate_nodes_with"));
279 calcSettings.setText(MessageManager.getString("action.change_params"));
281 .setText(MessageManager.getString("label.nucleotide_matrix"));
282 protSetting.setText(MessageManager.getString("label.protein_matrix"));
283 nuclSetting.addActionListener(new ActionListener()
287 public void actionPerformed(ActionEvent arg0)
289 nuclSetting_actionPerfomed(arg0);
292 protSetting.addActionListener(new ActionListener()
296 public void actionPerformed(ActionEvent arg0)
298 protSetting_actionPerfomed(arg0);
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);
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);
330 fileMenu.add(originalSeqData);
331 fileMenu.add(outputPoints);
332 fileMenu.add(outputProjPoints);
335 viewMenu.add(showLabels);
336 viewMenu.add(bgcolour);
337 viewMenu.add(associateViewsMenu);
340 protected void scoreModel_menuSelected()
342 // TODO Auto-generated method stub
346 protected void resetButton_actionPerformed(ActionEvent e)
348 // TODO Auto-generated method stub
352 protected void protSetting_actionPerfomed(ActionEvent arg0)
354 // TODO Auto-generated method stub
358 protected void nuclSetting_actionPerfomed(ActionEvent arg0)
360 // TODO Auto-generated method stub
364 protected void outputPoints_actionPerformed(ActionEvent e)
366 // TODO Auto-generated method stub
370 protected void outputProjPoints_actionPerformed(ActionEvent e)
372 // TODO Auto-generated method stub
376 protected void xCombobox_actionPerformed(ActionEvent e)
380 protected void yCombobox_actionPerformed(ActionEvent e)
384 protected void zCombobox_actionPerformed(ActionEvent e)
388 public void makePCAImage(TYPE imageType)
392 public void outputValues_actionPerformed(ActionEvent e)
397 public void print_actionPerformed(ActionEvent e)
402 public void showLabels_actionPerformed(ActionEvent e)
407 public void bgcolour_actionPerformed(ActionEvent e)
412 public void originalSeqData_actionPerformed(ActionEvent e)
417 public void viewMenu_menuSelected()