Clover icon

Coverage Report

  1. Project Clover database Wed Dec 3 2025 17:03:17 GMT
  2. Package jalview.jbgui

File GPCAPanel.java

 

Coverage histogram

../../img/srcFileCovDistChart7.png
30% of files have more coverage

Code metrics

4
113
30
1
355
296
34
0.3
3.77
30
1.13

Classes

Class Line # Actions
GPCAPanel 47 113 34
0.6870748468.7%
 

Contributing tests

This file is covered by 1 test. .

Source view

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