Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.jbgui

File GStructureViewer.java

 

Coverage histogram

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

Code metrics

0
66
20
1
266
189
21
0.32
3.3
20
1.05

Classes

Class Line # Actions
GStructureViewer 41 66 21 26
0.697674469.8%
 

Contributing tests

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