1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
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 |
|
|
|
|
| 69.8% |
Uncovered Elements: 26 (86) |
Complexity: 21 |
Complexity Density: 0.32 |
|
41 |
|
public abstract class GStructureViewer extends JInternalFrame |
42 |
|
implements JalviewStructureDisplayI, ColourChangeListener |
43 |
|
{ |
44 |
|
|
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 |
|
|
76 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
77 |
10 |
public GStructureViewer()... |
78 |
|
{ |
79 |
10 |
try |
80 |
|
{ |
81 |
10 |
jbInit(); |
82 |
|
} catch (Exception ex) |
83 |
|
{ |
84 |
0 |
ex.printStackTrace(); |
85 |
|
} |
86 |
|
} |
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (56) |
Complexity: 1 |
Complexity Density: 0.02 |
|
88 |
10 |
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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
0 |
@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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0 |
@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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
127 |
0 |
@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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
0 |
@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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
155 |
0 |
@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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
0 |
@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 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
179 |
0 |
@Override... |
180 |
|
public void actionPerformed(ActionEvent actionEvent) |
181 |
|
{ |
182 |
0 |
alignStructs_actionPerformed(actionEvent); |
183 |
|
} |
184 |
|
}); |
185 |
|
|
186 |
10 |
viewerActionMenu = new JMenu(); |
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 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
212 |
0 |
protected void fitToWindow_actionPerformed()... |
213 |
|
{ |
214 |
|
} |
215 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
216 |
0 |
protected void highlightSelection_actionPerformed()... |
217 |
|
{ |
218 |
|
} |
219 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
220 |
0 |
protected void viewerColour_actionPerformed(ActionEvent actionEvent)... |
221 |
|
{ |
222 |
|
} |
223 |
|
|
224 |
|
protected abstract String alignStructs_actionPerformed( |
225 |
|
ActionEvent actionEvent); |
226 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
227 |
0 |
public void pdbFile_actionPerformed(ActionEvent actionEvent)... |
228 |
|
{ |
229 |
|
|
230 |
|
} |
231 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
232 |
0 |
public void makePDBImage(TYPE imageType)... |
233 |
|
{ |
234 |
|
|
235 |
|
} |
236 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
237 |
0 |
public void viewMapping_actionPerformed(ActionEvent actionEvent)... |
238 |
|
{ |
239 |
|
|
240 |
|
} |
241 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
242 |
0 |
public void seqColour_actionPerformed(ActionEvent actionEvent)... |
243 |
|
{ |
244 |
|
|
245 |
|
} |
246 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
247 |
0 |
public void chainColour_actionPerformed(ActionEvent actionEvent)... |
248 |
|
{ |
249 |
|
|
250 |
|
} |
251 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
252 |
0 |
public void chargeColour_actionPerformed(ActionEvent actionEvent)... |
253 |
|
{ |
254 |
|
|
255 |
|
} |
256 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
257 |
0 |
public void background_actionPerformed(ActionEvent actionEvent)... |
258 |
|
{ |
259 |
|
|
260 |
|
} |
261 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
262 |
0 |
public void showHelp_actionPerformed(ActionEvent actionEvent)... |
263 |
|
{ |
264 |
|
|
265 |
|
} |
266 |
|
} |