Clover icon

Coverage Report

  1. Project Clover database Thu Aug 13 2020 12:04:21 BST
  2. Package jalview.jbgui

File GStructureViewer.java

 

Coverage histogram

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

Code metrics

0
67
20
1
269
190
21
0.31
3.35
20
1.05

Classes

Class Line # Actions
GStructureViewer 42 67 21
0.689655269%
 

Contributing tests

This file is covered by 5 tests. .

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.GridLayout;
25    import java.awt.event.ActionEvent;
26    import java.awt.event.ActionListener;
27   
28    import javax.swing.JInternalFrame;
29    import javax.swing.JLabel;
30    import javax.swing.JMenu;
31    import javax.swing.JMenuBar;
32    import javax.swing.JMenuItem;
33    import javax.swing.JPanel;
34    import javax.swing.JRadioButtonMenuItem;
35   
36    import jalview.api.structures.JalviewStructureDisplayI;
37    import jalview.gui.ColourMenuHelper.ColourChangeListener;
38    import jalview.util.ImageMaker.TYPE;
39    import jalview.util.MessageManager;
40   
41    @SuppressWarnings("serial")
 
42    public abstract class GStructureViewer extends JInternalFrame
43    implements JalviewStructureDisplayI, ColourChangeListener
44    {
45    // private AAStructureBindingModel bindingModel;
46   
47    protected JMenu savemenu;
48   
49    protected JMenu viewMenu;
50   
51    protected JMenu colourMenu;
52   
53    protected JMenu chainMenu;
54   
55    protected JMenu viewerActionMenu;
56   
57    protected JMenuItem alignStructs;
58   
59    protected JMenuItem fitToWindow;
60   
61    protected JRadioButtonMenuItem seqColour;
62   
63    protected JRadioButtonMenuItem chainColour;
64   
65    protected JRadioButtonMenuItem chargeColour;
66   
67    protected JRadioButtonMenuItem viewerColour;
68   
69    protected JMenuItem helpItem;
70   
71    protected JLabel statusBar;
72   
73    protected JPanel statusPanel;
74   
75    /**
76    * Constructor
77    */
 
78  7 toggle public GStructureViewer()
79    {
80  7 try
81    {
82  7 jbInit();
83    } catch (Exception ex)
84    {
85  0 ex.printStackTrace();
86    }
87    }
88   
 
89  7 toggle private void jbInit() throws Exception
90    {
91   
92  7 setName("jalview-structureviewer");
93   
94  7 JMenuBar menuBar = new JMenuBar();
95  7 this.setJMenuBar(menuBar);
96   
97  7 JMenu fileMenu = new JMenu();
98  7 fileMenu.setText(MessageManager.getString("action.file"));
99   
100  7 savemenu = new JMenu();
101  7 savemenu.setActionCommand(
102    MessageManager.getString("action.save_image"));
103  7 savemenu.setText(MessageManager.getString("action.save_as"));
104   
105  7 JMenuItem pdbFile = new JMenuItem();
106  7 pdbFile.setText(MessageManager.getString("label.pdb_file"));
107  7 pdbFile.addActionListener(new ActionListener()
108    {
 
109  0 toggle @Override
110    public void actionPerformed(ActionEvent actionEvent)
111    {
112  0 pdbFile_actionPerformed();
113    }
114    });
115   
116  7 JMenuItem png = new JMenuItem();
117  7 png.setText("PNG");
118  7 png.addActionListener(new ActionListener()
119    {
 
120  0 toggle @Override
121    public void actionPerformed(ActionEvent actionEvent)
122    {
123  0 makePDBImage(TYPE.PNG);
124    }
125    });
126   
127  7 JMenuItem eps = new JMenuItem();
128  7 eps.setText("EPS");
129  7 eps.addActionListener(new ActionListener()
130    {
 
131  0 toggle @Override
132    public void actionPerformed(ActionEvent actionEvent)
133    {
134  0 makePDBImage(TYPE.EPS);
135    }
136    });
137   
138  7 JMenuItem viewMapping = new JMenuItem();
139  7 viewMapping.setText(MessageManager.getString("label.view_mapping"));
140  7 viewMapping.addActionListener(new ActionListener()
141    {
 
142  0 toggle @Override
143    public void actionPerformed(ActionEvent actionEvent)
144    {
145  0 viewMapping_actionPerformed();
146    }
147    });
148   
149  7 viewMenu = new JMenu();
150  7 viewMenu.setText(MessageManager.getString("action.view"));
151   
152  7 chainMenu = new JMenu();
153  7 chainMenu.setText(MessageManager.getString("action.show_chain"));
154   
155  7 fitToWindow = new JMenuItem();
156  7 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
157  7 fitToWindow.addActionListener(new ActionListener()
158    {
 
159  0 toggle @Override
160    public void actionPerformed(ActionEvent actionEvent)
161    {
162  0 fitToWindow_actionPerformed();
163    }
164    });
165   
166  7 JMenu helpMenu = new JMenu();
167  7 helpMenu.setText(MessageManager.getString("action.help"));
168  7 helpItem = new JMenuItem();
169  7 helpItem.addActionListener(new ActionListener()
170    {
 
171  0 toggle @Override
172    public void actionPerformed(ActionEvent actionEvent)
173    {
174  0 showHelp_actionPerformed();
175    }
176    });
177  7 alignStructs = new JMenuItem();
178  7 alignStructs.setText(
179    MessageManager.getString("label.superpose_structures"));
180  7 alignStructs.addActionListener(new ActionListener()
181    {
 
182  0 toggle @Override
183    public void actionPerformed(ActionEvent actionEvent)
184    {
185  0 alignStructsWithAllAlignPanels();
186    }
187    });
188   
189  7 viewerActionMenu = new JMenu(); // text set in sub-classes
190  7 viewerActionMenu.setVisible(false);
191  7 viewerActionMenu.add(alignStructs);
192  7 colourMenu = new JMenu();
193  7 colourMenu.setText(MessageManager.getString("label.colours"));
194  7 fileMenu.add(savemenu);
195  7 fileMenu.add(viewMapping);
196  7 savemenu.add(pdbFile);
197  7 savemenu.add(png);
198  7 savemenu.add(eps);
199  7 viewMenu.add(chainMenu);
200  7 helpMenu.add(helpItem);
201   
202  7 menuBar.add(fileMenu);
203  7 menuBar.add(viewMenu);
204  7 menuBar.add(colourMenu);
205  7 menuBar.add(viewerActionMenu);
206  7 menuBar.add(helpMenu);
207   
208  7 statusPanel = new JPanel();
209  7 statusPanel.setLayout(new GridLayout());
210  7 this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
211  7 statusBar = new JLabel();
212  7 statusPanel.add(statusBar, null);
213    }
214   
 
215  0 toggle protected void fitToWindow_actionPerformed()
216    {
217  0 getBinding().focusView();
218    }
219   
 
220  0 toggle protected void highlightSelection_actionPerformed()
221    {
222    }
223   
 
224  0 toggle protected void viewerColour_actionPerformed()
225    {
226    }
227   
228    protected abstract String alignStructsWithAllAlignPanels();
229   
 
230  0 toggle public void pdbFile_actionPerformed()
231    {
232   
233    }
234   
 
235  0 toggle public void makePDBImage(TYPE imageType)
236    {
237   
238    }
239   
 
240  0 toggle public void viewMapping_actionPerformed()
241    {
242   
243    }
244   
 
245  0 toggle public void seqColour_actionPerformed()
246    {
247   
248    }
249   
 
250  0 toggle public void chainColour_actionPerformed()
251    {
252   
253    }
254   
 
255  0 toggle public void chargeColour_actionPerformed()
256    {
257   
258    }
259   
 
260  0 toggle public void background_actionPerformed()
261    {
262   
263    }
264   
 
265  0 toggle public void showHelp_actionPerformed()
266    {
267   
268    }
269    }