Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 16:11:35 GMT
  2. Package jalview.jbgui

File GStructureViewer.java

 

Coverage histogram

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

Code metrics

0
72
20
1
277
197
21
0.29
3.6
20
1.05

Classes

Class Line # Actions
GStructureViewer 43 72 21
0.7065217570.7%
 

Contributing tests

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