1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package mc_view; |
22 |
|
|
23 |
|
import jalview.appletgui.AlignmentPanel; |
24 |
|
import jalview.appletgui.EmbmenuFrame; |
25 |
|
import jalview.datamodel.PDBEntry; |
26 |
|
import jalview.datamodel.SequenceI; |
27 |
|
import jalview.io.DataSourceType; |
28 |
|
import jalview.schemes.BuriedColourScheme; |
29 |
|
import jalview.schemes.HelixColourScheme; |
30 |
|
import jalview.schemes.HydrophobicColourScheme; |
31 |
|
import jalview.schemes.StrandColourScheme; |
32 |
|
import jalview.schemes.TaylorColourScheme; |
33 |
|
import jalview.schemes.TurnColourScheme; |
34 |
|
import jalview.schemes.ZappoColourScheme; |
35 |
|
import jalview.util.MessageManager; |
36 |
|
|
37 |
|
import java.awt.BorderLayout; |
38 |
|
import java.awt.CheckboxGroup; |
39 |
|
import java.awt.CheckboxMenuItem; |
40 |
|
import java.awt.Frame; |
41 |
|
import java.awt.Menu; |
42 |
|
import java.awt.MenuBar; |
43 |
|
import java.awt.MenuItem; |
44 |
|
import java.awt.event.ActionEvent; |
45 |
|
import java.awt.event.ActionListener; |
46 |
|
import java.awt.event.ItemEvent; |
47 |
|
import java.awt.event.ItemListener; |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 147 (147) |
Complexity: 21 |
Complexity Density: 0.19 |
|
49 |
|
public class AppletPDBViewer extends EmbmenuFrame |
50 |
|
implements ActionListener, ItemListener |
51 |
|
{ |
52 |
|
AppletPDBCanvas pdbcanvas; |
53 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.25 |
|
54 |
0 |
public AppletPDBViewer(PDBEntry pdbentry, SequenceI[] seq,... |
55 |
|
String[] chains, AlignmentPanel ap, DataSourceType protocol) |
56 |
|
{ |
57 |
0 |
try |
58 |
|
{ |
59 |
0 |
jbInit(); |
60 |
|
} catch (Exception ex) |
61 |
|
{ |
62 |
0 |
ex.printStackTrace(); |
63 |
|
} |
64 |
|
|
65 |
0 |
pdbcanvas = new AppletPDBCanvas(pdbentry, seq, chains, ap, protocol); |
66 |
|
|
67 |
0 |
embedMenuIfNeeded(pdbcanvas); |
68 |
0 |
add(pdbcanvas, BorderLayout.CENTER); |
69 |
|
|
70 |
0 |
StringBuffer title = new StringBuffer( |
71 |
|
seq[0].getName() + ":" + pdbcanvas.pdbentry.getFile()); |
72 |
|
|
73 |
0 |
jalview.bin.JalviewLite.addFrame(this, title.toString(), 400, 400); |
74 |
|
|
75 |
|
} |
76 |
|
|
|
|
| 0% |
Uncovered Elements: 58 (58) |
Complexity: 13 |
Complexity Density: 0.38 |
|
77 |
0 |
@Override... |
78 |
|
public void actionPerformed(ActionEvent evt) |
79 |
|
{ |
80 |
0 |
if (evt.getSource() == mapping) |
81 |
|
{ |
82 |
0 |
jalview.appletgui.CutAndPasteTransfer cap = new jalview.appletgui.CutAndPasteTransfer( |
83 |
|
false, null); |
84 |
0 |
Frame frame = new Frame(); |
85 |
0 |
frame.add(cap); |
86 |
0 |
jalview.bin.JalviewLite.addFrame(frame, |
87 |
|
MessageManager.getString("label.pdb_sequence_mapping"), 500, |
88 |
|
600); |
89 |
0 |
cap.setText(pdbcanvas.mappingDetails.toString()); |
90 |
|
|
91 |
|
} |
92 |
0 |
else if (evt.getSource() == charge) |
93 |
|
{ |
94 |
0 |
pdbcanvas.bysequence = false; |
95 |
0 |
pdbcanvas.pdb.setChargeColours(); |
96 |
|
} |
97 |
|
|
98 |
0 |
else if (evt.getSource() == chain) |
99 |
|
{ |
100 |
0 |
pdbcanvas.bysequence = false; |
101 |
0 |
pdbcanvas.pdb.setChainColours(); |
102 |
|
} |
103 |
0 |
else if (evt.getSource() == seqButton) |
104 |
|
{ |
105 |
0 |
pdbcanvas.bysequence = true; |
106 |
0 |
pdbcanvas.colourBySequence(); |
107 |
|
|
108 |
|
} |
109 |
0 |
else if (evt.getSource() == zappo) |
110 |
|
{ |
111 |
0 |
pdbcanvas.setColours(new ZappoColourScheme()); |
112 |
|
} |
113 |
0 |
else if (evt.getSource() == taylor) |
114 |
|
{ |
115 |
0 |
pdbcanvas.setColours(new TaylorColourScheme()); |
116 |
|
} |
117 |
0 |
else if (evt.getSource() == hydro) |
118 |
|
{ |
119 |
0 |
pdbcanvas.setColours(new HydrophobicColourScheme()); |
120 |
|
} |
121 |
0 |
else if (evt.getSource() == helix) |
122 |
|
{ |
123 |
0 |
pdbcanvas.setColours(new HelixColourScheme()); |
124 |
|
} |
125 |
0 |
else if (evt.getSource() == strand) |
126 |
|
{ |
127 |
0 |
pdbcanvas.setColours(new StrandColourScheme()); |
128 |
|
} |
129 |
0 |
else if (evt.getSource() == turn) |
130 |
|
{ |
131 |
0 |
pdbcanvas.setColours(new TurnColourScheme()); |
132 |
|
} |
133 |
0 |
else if (evt.getSource() == buried) |
134 |
|
{ |
135 |
0 |
pdbcanvas.setColours(new BuriedColourScheme()); |
136 |
|
} |
137 |
0 |
else if (evt.getSource() == user) |
138 |
|
{ |
139 |
0 |
pdbcanvas.bysequence = false; |
140 |
0 |
new jalview.appletgui.UserDefinedColours(pdbcanvas); |
141 |
|
} |
142 |
|
|
143 |
0 |
pdbcanvas.redrawneeded = true; |
144 |
0 |
pdbcanvas.repaint(); |
145 |
|
|
146 |
|
} |
147 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 5 |
Complexity Density: 0.5 |
|
148 |
0 |
@Override... |
149 |
|
public void itemStateChanged(ItemEvent evt) |
150 |
|
{ |
151 |
0 |
if (evt.getSource() == allchains) |
152 |
|
{ |
153 |
0 |
pdbcanvas.setAllchainsVisible(allchains.getState()); |
154 |
|
} |
155 |
0 |
else if (evt.getSource() == wire) |
156 |
|
{ |
157 |
0 |
pdbcanvas.wire = !pdbcanvas.wire; |
158 |
|
} |
159 |
0 |
else if (evt.getSource() == depth) |
160 |
|
{ |
161 |
0 |
pdbcanvas.depthcue = !pdbcanvas.depthcue; |
162 |
|
} |
163 |
0 |
else if (evt.getSource() == zbuffer) |
164 |
|
{ |
165 |
0 |
pdbcanvas.zbuffer = !pdbcanvas.zbuffer; |
166 |
|
} |
167 |
0 |
pdbcanvas.redrawneeded = true; |
168 |
0 |
pdbcanvas.repaint(); |
169 |
|
} |
170 |
|
|
|
|
| 0% |
Uncovered Elements: 59 (59) |
Complexity: 1 |
Complexity Density: 0.02 |
|
171 |
0 |
private void jbInit() throws Exception... |
172 |
|
{ |
173 |
0 |
setMenuBar(jMenuBar1); |
174 |
0 |
fileMenu.setLabel(MessageManager.getString("action.file")); |
175 |
0 |
coloursMenu.setLabel(MessageManager.getString("label.colours")); |
176 |
0 |
mapping.setLabel(MessageManager.getString("label.view_mapping")); |
177 |
0 |
mapping.addActionListener(this); |
178 |
0 |
wire.setLabel(MessageManager.getString("label.wireframe")); |
179 |
0 |
wire.addItemListener(this); |
180 |
0 |
depth.setState(true); |
181 |
0 |
depth.setLabel(MessageManager.getString("label.depthcue")); |
182 |
0 |
depth.addItemListener(this); |
183 |
0 |
zbuffer.setState(true); |
184 |
0 |
zbuffer.setLabel(MessageManager.getString("label.z_buffering")); |
185 |
0 |
zbuffer.addItemListener(this); |
186 |
0 |
charge.setLabel(MessageManager.getString("label.charge_cysteine")); |
187 |
0 |
charge.addActionListener(this); |
188 |
0 |
hydro.setLabel( |
189 |
|
MessageManager.getString("label.colourScheme_hydrophobic")); |
190 |
0 |
hydro.addActionListener(this); |
191 |
0 |
chain.setLabel(MessageManager.getString("action.by_chain")); |
192 |
0 |
chain.addActionListener(this); |
193 |
0 |
seqButton.setLabel(MessageManager.getString("action.by_sequence")); |
194 |
0 |
seqButton.addActionListener(this); |
195 |
0 |
allchains |
196 |
|
.setLabel(MessageManager.getString("label.all_chains_visible")); |
197 |
0 |
allchains.addItemListener(this); |
198 |
0 |
viewMenu.setLabel(MessageManager.getString("action.view")); |
199 |
0 |
zappo.setLabel(MessageManager.getString("label.colourScheme_zappo")); |
200 |
0 |
zappo.addActionListener(this); |
201 |
0 |
taylor.setLabel(MessageManager.getString("label.colourScheme_taylor")); |
202 |
0 |
taylor.addActionListener(this); |
203 |
0 |
helix.setLabel( |
204 |
|
MessageManager.getString("label.colourScheme_helixpropensity")); |
205 |
0 |
helix.addActionListener(this); |
206 |
0 |
strand.setLabel(MessageManager |
207 |
|
.getString("label.colourScheme_strandpropensity")); |
208 |
0 |
strand.addActionListener(this); |
209 |
0 |
turn.setLabel( |
210 |
|
MessageManager.getString("label.colourScheme_turnpropensity")); |
211 |
0 |
turn.addActionListener(this); |
212 |
0 |
buried.setLabel( |
213 |
|
MessageManager.getString("label.colourScheme_buriedindex")); |
214 |
0 |
buried.addActionListener(this); |
215 |
0 |
user.setLabel(MessageManager.getString("action.user_defined")); |
216 |
0 |
user.addActionListener(this); |
217 |
0 |
jMenuBar1.add(fileMenu); |
218 |
0 |
jMenuBar1.add(coloursMenu); |
219 |
0 |
jMenuBar1.add(viewMenu); |
220 |
0 |
fileMenu.add(mapping); |
221 |
0 |
; |
222 |
|
|
223 |
0 |
coloursMenu.add(seqButton); |
224 |
0 |
coloursMenu.add(chain); |
225 |
0 |
coloursMenu.add(charge); |
226 |
0 |
coloursMenu.add(zappo); |
227 |
0 |
coloursMenu.add(taylor); |
228 |
0 |
coloursMenu.add(hydro); |
229 |
0 |
coloursMenu.add(helix); |
230 |
0 |
coloursMenu.add(strand); |
231 |
0 |
coloursMenu.add(turn); |
232 |
0 |
coloursMenu.add(buried); |
233 |
0 |
coloursMenu.add(user); |
234 |
0 |
viewMenu.add(wire); |
235 |
0 |
viewMenu.add(depth); |
236 |
0 |
viewMenu.add(zbuffer); |
237 |
0 |
viewMenu.add(allchains); |
238 |
0 |
allchains.setState(true); |
239 |
|
} |
240 |
|
|
241 |
|
MenuBar jMenuBar1 = new MenuBar(); |
242 |
|
|
243 |
|
Menu fileMenu = new Menu(); |
244 |
|
|
245 |
|
Menu coloursMenu = new Menu(); |
246 |
|
|
247 |
|
MenuItem mapping = new MenuItem(); |
248 |
|
|
249 |
|
CheckboxGroup bg = new CheckboxGroup(); |
250 |
|
|
251 |
|
CheckboxMenuItem wire = new CheckboxMenuItem(); |
252 |
|
|
253 |
|
CheckboxMenuItem depth = new CheckboxMenuItem(); |
254 |
|
|
255 |
|
CheckboxMenuItem zbuffer = new CheckboxMenuItem(); |
256 |
|
|
257 |
|
MenuItem charge = new MenuItem(); |
258 |
|
|
259 |
|
MenuItem hydro = new MenuItem(); |
260 |
|
|
261 |
|
MenuItem chain = new MenuItem(); |
262 |
|
|
263 |
|
MenuItem seqButton = new MenuItem(); |
264 |
|
|
265 |
|
CheckboxMenuItem allchains = new CheckboxMenuItem(); |
266 |
|
|
267 |
|
Menu viewMenu = new Menu(); |
268 |
|
|
269 |
|
MenuItem turn = new MenuItem(); |
270 |
|
|
271 |
|
MenuItem strand = new MenuItem(); |
272 |
|
|
273 |
|
MenuItem helix = new MenuItem(); |
274 |
|
|
275 |
|
MenuItem taylor = new MenuItem(); |
276 |
|
|
277 |
|
MenuItem zappo = new MenuItem(); |
278 |
|
|
279 |
|
MenuItem buried = new MenuItem(); |
280 |
|
|
281 |
|
MenuItem user = new MenuItem(); |
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
} |