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.MessageManager;
25 import java.awt.BorderLayout;
26 import java.awt.Color;
27 import java.awt.FlowLayout;
29 import java.awt.GridLayout;
30 import java.awt.event.ActionEvent;
31 import java.awt.event.ActionListener;
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;
45 public class GPCAPanel extends JInternalFrame
47 private static final Font VERDANA_12 = new Font("Verdana", 0, 12);
49 protected JComboBox<String> xCombobox = new JComboBox<String>();
51 protected JComboBox<String> yCombobox = new JComboBox<String>();
53 protected JComboBox<String> zCombobox = new JComboBox<String>();
55 protected JMenu scoreModelMenu = new JMenu();
57 protected JMenu viewMenu = new JMenu();
59 protected JCheckBoxMenuItem showLabels = new JCheckBoxMenuItem();
61 protected JMenu associateViewsMenu = new JMenu();
63 protected JMenu calcSettings = new JMenu();
65 protected JCheckBoxMenuItem nuclSetting = new JCheckBoxMenuItem();
67 protected JCheckBoxMenuItem protSetting = new JCheckBoxMenuItem();
69 protected JCheckBoxMenuItem jvVersionSetting = new JCheckBoxMenuItem();
71 protected JLabel statusBar = new JLabel();
73 protected JPanel statusPanel = new JPanel();
85 for (int i = 1; i < 8; i++)
87 xCombobox.addItem("dim " + i);
88 yCombobox.addItem("dim " + i);
89 zCombobox.addItem("dim " + i);
93 private void jbInit() throws Exception
95 this.getContentPane().setLayout(new BorderLayout());
96 JPanel jPanel2 = new JPanel();
97 jPanel2.setLayout(new FlowLayout());
98 JLabel jLabel1 = new JLabel();
99 jLabel1.setFont(VERDANA_12);
100 jLabel1.setText("x=");
101 JLabel jLabel2 = new JLabel();
102 jLabel2.setFont(VERDANA_12);
103 jLabel2.setText("y=");
104 JLabel jLabel3 = new JLabel();
105 jLabel3.setFont(VERDANA_12);
106 jLabel3.setText("z=");
107 jPanel2.setBackground(Color.white);
108 jPanel2.setBorder(null);
109 zCombobox.setFont(VERDANA_12);
110 zCombobox.addActionListener(new ActionListener()
113 public void actionPerformed(ActionEvent e)
115 zCombobox_actionPerformed(e);
118 yCombobox.setFont(VERDANA_12);
119 yCombobox.addActionListener(new ActionListener()
122 public void actionPerformed(ActionEvent e)
124 yCombobox_actionPerformed(e);
127 xCombobox.setFont(VERDANA_12);
128 xCombobox.addActionListener(new ActionListener()
131 public void actionPerformed(ActionEvent e)
133 xCombobox_actionPerformed(e);
136 JButton resetButton = new JButton();
137 resetButton.setFont(VERDANA_12);
138 resetButton.setText(MessageManager.getString("action.reset"));
139 resetButton.addActionListener(new ActionListener()
142 public void actionPerformed(ActionEvent e)
144 resetButton_actionPerformed(e);
147 JMenu fileMenu = new JMenu();
148 fileMenu.setText(MessageManager.getString("action.file"));
149 JMenu saveMenu = new JMenu();
150 saveMenu.setText(MessageManager.getString("action.save_as"));
151 JMenuItem eps = new JMenuItem("EPS");
152 eps.addActionListener(new ActionListener()
155 public void actionPerformed(ActionEvent e)
157 eps_actionPerformed(e);
160 JMenuItem png = new JMenuItem("PNG");
161 png.addActionListener(new ActionListener()
164 public void actionPerformed(ActionEvent e)
166 png_actionPerformed(e);
169 JMenuItem outputValues = new JMenuItem();
170 outputValues.setText(MessageManager.getString("label.output_values"));
171 outputValues.addActionListener(new ActionListener()
174 public void actionPerformed(ActionEvent e)
176 outputValues_actionPerformed(e);
179 JMenuItem outputPoints = new JMenuItem();
180 outputPoints.setText(MessageManager.getString("label.output_points"));
181 outputPoints.addActionListener(new ActionListener()
184 public void actionPerformed(ActionEvent e)
186 outputPoints_actionPerformed(e);
189 JMenuItem outputProjPoints = new JMenuItem();
190 outputProjPoints.setText(MessageManager
191 .getString("label.output_transformed_points"));
192 outputProjPoints.addActionListener(new ActionListener()
195 public void actionPerformed(ActionEvent e)
197 outputProjPoints_actionPerformed(e);
200 JMenuItem print = new JMenuItem();
201 print.setText(MessageManager.getString("action.print"));
202 print.addActionListener(new ActionListener()
205 public void actionPerformed(ActionEvent e)
207 print_actionPerformed(e);
210 viewMenu.setText(MessageManager.getString("action.view"));
211 viewMenu.addMenuListener(new MenuListener()
214 public void menuSelected(MenuEvent e)
216 viewMenu_menuSelected();
220 public void menuDeselected(MenuEvent e)
225 public void menuCanceled(MenuEvent e)
229 scoreModelMenu.setText(MessageManager
230 .getString("label.select_score_model"));
231 scoreModelMenu.addMenuListener(new MenuListener()
234 public void menuSelected(MenuEvent e)
236 scoreModel_menuSelected();
240 public void menuDeselected(MenuEvent e)
245 public void menuCanceled(MenuEvent e)
249 showLabels.setText(MessageManager.getString("label.show_labels"));
250 showLabels.addActionListener(new ActionListener()
253 public void actionPerformed(ActionEvent e)
255 showLabels_actionPerformed(e);
258 JMenuItem bgcolour = new JMenuItem();
259 bgcolour.setText(MessageManager.getString("action.background_colour"));
260 bgcolour.addActionListener(new ActionListener()
263 public void actionPerformed(ActionEvent e)
265 bgcolour_actionPerformed(e);
268 JMenuItem originalSeqData = new JMenuItem();
269 originalSeqData.setText(MessageManager.getString("label.input_data"));
270 originalSeqData.addActionListener(new ActionListener()
273 public void actionPerformed(ActionEvent e)
275 originalSeqData_actionPerformed(e);
278 associateViewsMenu.setText(MessageManager
279 .getString("label.associate_nodes_with"));
280 calcSettings.setText(MessageManager.getString("action.change_params"));
282 .setText(MessageManager.getString("label.nucleotide_matrix"));
283 protSetting.setText(MessageManager.getString("label.protein_matrix"));
284 nuclSetting.addActionListener(new ActionListener()
288 public void actionPerformed(ActionEvent arg0)
290 nuclSetting_actionPerfomed(arg0);
293 protSetting.addActionListener(new ActionListener()
297 public void actionPerformed(ActionEvent arg0)
299 protSetting_actionPerfomed(arg0);
302 jvVersionSetting.setText(MessageManager
303 .getString("label.jalview_pca_calculation"));
304 jvVersionSetting.addActionListener(new ActionListener()
307 public void actionPerformed(ActionEvent arg0)
309 jvVersionSetting_actionPerfomed(arg0);
312 // calcSettings.add(jvVersionSetting); // todo remove? JAL-2416
313 calcSettings.add(nuclSetting);
314 calcSettings.add(protSetting);
315 calcSettings.add(scoreModelMenu);
316 statusPanel.setLayout(new GridLayout());
317 statusBar.setFont(VERDANA_12);
318 // statusPanel.setBackground(Color.lightGray);
319 // statusBar.setBackground(Color.lightGray);
320 // statusPanel.add(statusBar, null);
321 JPanel panelBar = new JPanel(new BorderLayout());
322 panelBar.add(jPanel2, BorderLayout.NORTH);
323 panelBar.add(statusPanel, BorderLayout.SOUTH);
324 this.getContentPane().add(panelBar, BorderLayout.SOUTH);
325 jPanel2.add(jLabel1, null);
326 jPanel2.add(xCombobox, null);
327 jPanel2.add(jLabel2, null);
328 jPanel2.add(yCombobox, null);
329 jPanel2.add(jLabel3, null);
330 jPanel2.add(zCombobox, null);
331 jPanel2.add(resetButton, null);
333 JMenuBar jMenuBar1 = new JMenuBar();
334 jMenuBar1.add(fileMenu);
335 jMenuBar1.add(viewMenu);
336 jMenuBar1.add(calcSettings);
337 setJMenuBar(jMenuBar1);
338 fileMenu.add(saveMenu);
339 fileMenu.add(outputValues);
341 fileMenu.add(originalSeqData);
342 fileMenu.add(outputPoints);
343 fileMenu.add(outputProjPoints);
346 viewMenu.add(showLabels);
347 viewMenu.add(bgcolour);
348 viewMenu.add(associateViewsMenu);
351 protected void scoreModel_menuSelected()
353 // TODO Auto-generated method stub
357 protected void resetButton_actionPerformed(ActionEvent e)
359 // TODO Auto-generated method stub
363 protected void protSetting_actionPerfomed(ActionEvent arg0)
365 // TODO Auto-generated method stub
369 protected void nuclSetting_actionPerfomed(ActionEvent arg0)
371 // TODO Auto-generated method stub
375 protected void outputPoints_actionPerformed(ActionEvent e)
377 // TODO Auto-generated method stub
381 protected void outputProjPoints_actionPerformed(ActionEvent e)
383 // TODO Auto-generated method stub
387 protected void xCombobox_actionPerformed(ActionEvent e)
391 protected void yCombobox_actionPerformed(ActionEvent e)
395 protected void zCombobox_actionPerformed(ActionEvent e)
399 public void eps_actionPerformed(ActionEvent e)
404 public void png_actionPerformed(ActionEvent e)
409 public void outputValues_actionPerformed(ActionEvent e)
414 public void print_actionPerformed(ActionEvent e)
419 public void showLabels_actionPerformed(ActionEvent e)
424 public void bgcolour_actionPerformed(ActionEvent e)
429 public void originalSeqData_actionPerformed(ActionEvent e)
434 public void viewMenu_menuSelected()
439 protected void jvVersionSetting_actionPerfomed(ActionEvent arg0)
441 // TODO Auto-generated method stub