Clover icon

Coverage Report

  1. Project Clover database Mon Nov 11 2024 15:05:32 GMT
  2. Package jalview.jbgui

File GPCAPanel.java

 

Coverage histogram

../../img/srcFileCovDistChart8.png
20% of files have more coverage

Code metrics

2
115
32
1
365
303
34
0.3
3.59
32
1.06

Classes

Class Line # Actions
GPCAPanel 46 115 34
0.7248322472.5%
 

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