1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.bin; |
22 |
|
|
23 |
|
import java.applet.Applet; |
24 |
|
import java.awt.Button; |
25 |
|
import java.awt.Color; |
26 |
|
import java.awt.Component; |
27 |
|
import java.awt.EventQueue; |
28 |
|
import java.awt.Font; |
29 |
|
import java.awt.Frame; |
30 |
|
import java.awt.Graphics; |
31 |
|
import java.awt.event.ActionEvent; |
32 |
|
import java.awt.event.WindowAdapter; |
33 |
|
import java.awt.event.WindowEvent; |
34 |
|
import java.io.BufferedReader; |
35 |
|
import java.io.IOException; |
36 |
|
import java.io.InputStreamReader; |
37 |
|
import java.net.URL; |
38 |
|
import java.util.ArrayList; |
39 |
|
import java.util.Hashtable; |
40 |
|
import java.util.List; |
41 |
|
import java.util.Locale; |
42 |
|
import java.util.StringTokenizer; |
43 |
|
import java.util.Vector; |
44 |
|
|
45 |
|
import jalview.analysis.AlignmentUtils; |
46 |
|
import jalview.api.StructureSelectionManagerProvider; |
47 |
|
import jalview.appletgui.AlignFrame; |
48 |
|
import jalview.appletgui.AlignViewport; |
49 |
|
import jalview.appletgui.EmbmenuFrame; |
50 |
|
import jalview.appletgui.FeatureSettings; |
51 |
|
import jalview.appletgui.SplitFrame; |
52 |
|
import jalview.datamodel.Alignment; |
53 |
|
import jalview.datamodel.AlignmentI; |
54 |
|
import jalview.datamodel.AlignmentOrder; |
55 |
|
import jalview.datamodel.ColumnSelection; |
56 |
|
import jalview.datamodel.PDBEntry; |
57 |
|
import jalview.datamodel.Sequence; |
58 |
|
import jalview.datamodel.SequenceGroup; |
59 |
|
import jalview.datamodel.SequenceI; |
60 |
|
import jalview.io.AnnotationFile; |
61 |
|
import jalview.io.AppletFormatAdapter; |
62 |
|
import jalview.io.DataSourceType; |
63 |
|
import jalview.io.FileFormatI; |
64 |
|
import jalview.io.FileFormats; |
65 |
|
import jalview.io.FileParse; |
66 |
|
import jalview.io.IdentifyFile; |
67 |
|
import jalview.io.JPredFile; |
68 |
|
import jalview.io.JnetAnnotationMaker; |
69 |
|
import jalview.io.NewickFile; |
70 |
|
import jalview.javascript.JSFunctionExec; |
71 |
|
import jalview.javascript.JalviewLiteJsApi; |
72 |
|
import jalview.javascript.JsCallBack; |
73 |
|
import jalview.javascript.MouseOverStructureListener; |
74 |
|
import jalview.structure.SelectionListener; |
75 |
|
import jalview.structure.StructureSelectionManager; |
76 |
|
import jalview.util.ColorUtils; |
77 |
|
import jalview.util.HttpUtils; |
78 |
|
import jalview.util.MessageManager; |
79 |
|
import netscape.javascript.JSObject; |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
@author |
85 |
|
@version |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1,011 (1,011) |
Complexity: 293 |
Complexity Density: 0.48 |
|
87 |
|
public class JalviewLite extends Applet |
88 |
|
implements StructureSelectionManagerProvider, JalviewLiteJsApi |
89 |
|
{ |
90 |
|
|
91 |
|
private static final String TRUE = "true"; |
92 |
|
|
93 |
|
private static final String FALSE = "false"; |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0 |
public StructureSelectionManager getStructureSelectionManager()... |
96 |
|
{ |
97 |
0 |
return StructureSelectionManager.getStructureSelectionManager(this); |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
@see |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0 |
@Override... |
109 |
|
public String getSelectedSequences() |
110 |
|
{ |
111 |
0 |
return getSelectedSequencesFrom(getDefaultTargetFrame()); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@see |
118 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
0 |
@Override... |
120 |
|
public String getSelectedSequences(String sep) |
121 |
|
{ |
122 |
0 |
return getSelectedSequencesFrom(getDefaultTargetFrame(), sep); |
123 |
|
} |
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
@see |
129 |
|
|
130 |
|
|
131 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
0 |
@Override... |
133 |
|
public String getSelectedSequencesFrom(AlignFrame alf) |
134 |
|
{ |
135 |
0 |
return getSelectedSequencesFrom(alf, separator); |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
@see |
142 |
|
|
143 |
|
|
144 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
145 |
0 |
@Override... |
146 |
|
public String getSelectedSequencesFrom(AlignFrame alf, String sep) |
147 |
|
{ |
148 |
0 |
StringBuffer result = new StringBuffer(""); |
149 |
0 |
if (sep == null || sep.length() == 0) |
150 |
|
{ |
151 |
0 |
sep = separator; |
152 |
|
} |
153 |
0 |
if (alf.viewport.getSelectionGroup() != null) |
154 |
|
{ |
155 |
0 |
SequenceI[] seqs = alf.viewport.getSelectionGroup() |
156 |
|
.getSequencesInOrder(alf.viewport.getAlignment()); |
157 |
|
|
158 |
0 |
for (int i = 0; i < seqs.length; i++) |
159 |
|
{ |
160 |
0 |
result.append(seqs[i].getName()); |
161 |
0 |
result.append(sep); |
162 |
|
} |
163 |
|
} |
164 |
|
|
165 |
0 |
return result.toString(); |
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
@see |
172 |
|
|
173 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
174 |
0 |
@Override... |
175 |
|
public void highlight(String sequenceId, String position, |
176 |
|
String alignedPosition) |
177 |
|
{ |
178 |
0 |
highlightIn(getDefaultTargetFrame(), sequenceId, position, |
179 |
|
alignedPosition); |
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
@see |
186 |
|
|
187 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0.46 |
|
188 |
0 |
@Override... |
189 |
|
public void highlightIn(final AlignFrame alf, final String sequenceId, |
190 |
|
final String position, final String alignedPosition) |
191 |
|
{ |
192 |
|
|
193 |
0 |
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( |
194 |
|
alf.viewport.getAlignment().getSequencesArray()); |
195 |
0 |
final SequenceI sq = matcher.findIdMatch(sequenceId); |
196 |
0 |
if (sq != null) |
197 |
|
{ |
198 |
0 |
int apos = -1; |
199 |
0 |
try |
200 |
|
{ |
201 |
0 |
apos = Integer.valueOf(position).intValue(); |
202 |
0 |
apos--; |
203 |
|
} catch (NumberFormatException ex) |
204 |
|
{ |
205 |
0 |
return; |
206 |
|
} |
207 |
0 |
final StructureSelectionManagerProvider me = this; |
208 |
0 |
final int pos = apos; |
209 |
|
|
210 |
0 |
if (alignedPosition != null |
211 |
|
&& (alignedPosition.trim().length() == 0 || alignedPosition |
212 |
|
.toLowerCase(Locale.ROOT).indexOf("false") > -1)) |
213 |
|
{ |
214 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
215 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
216 |
0 |
@Override... |
217 |
|
public void run() |
218 |
|
{ |
219 |
0 |
StructureSelectionManager.getStructureSelectionManager(me) |
220 |
|
.mouseOverVamsasSequence(sq, sq.findIndex(pos), null); |
221 |
|
} |
222 |
|
}); |
223 |
|
} |
224 |
|
else |
225 |
|
{ |
226 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
227 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
228 |
0 |
@Override... |
229 |
|
public void run() |
230 |
|
{ |
231 |
0 |
StructureSelectionManager.getStructureSelectionManager(me) |
232 |
|
.mouseOverVamsasSequence(sq, pos, null); |
233 |
|
} |
234 |
|
}); |
235 |
|
} |
236 |
|
} |
237 |
|
} |
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
@see |
243 |
|
|
244 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
245 |
0 |
@Override... |
246 |
|
public void select(String sequenceIds, String columns) |
247 |
|
{ |
248 |
0 |
selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator); |
249 |
|
} |
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
@see |
255 |
|
|
256 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
257 |
0 |
@Override... |
258 |
|
public void select(String sequenceIds, String columns, String sep) |
259 |
|
{ |
260 |
0 |
selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep); |
261 |
|
} |
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
@see |
267 |
|
|
268 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
269 |
0 |
@Override... |
270 |
|
public void selectIn(AlignFrame alf, String sequenceIds, String columns) |
271 |
|
{ |
272 |
0 |
selectIn(alf, sequenceIds, columns, separator); |
273 |
|
} |
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
@see |
279 |
|
|
280 |
|
|
|
|
| 0% |
Uncovered Elements: 145 (145) |
Complexity: 37 |
Complexity Density: 0.4 |
|
281 |
0 |
@Override... |
282 |
|
public void selectIn(final AlignFrame alf, String sequenceIds, |
283 |
|
String columns, String sep) |
284 |
|
{ |
285 |
0 |
if (sep == null || sep.length() == 0) |
286 |
|
{ |
287 |
0 |
sep = separator; |
288 |
|
} |
289 |
|
else |
290 |
|
{ |
291 |
0 |
if (debug) |
292 |
|
{ |
293 |
0 |
jalview.bin.Console |
294 |
|
.errPrintln("Selecting region using separator string '" |
295 |
|
+ separator + "'"); |
296 |
|
} |
297 |
|
} |
298 |
|
|
299 |
0 |
String[] ids = separatorListToArray(sequenceIds, sep); |
300 |
0 |
String[] cols = separatorListToArray(columns, sep); |
301 |
0 |
final SequenceGroup sel = new SequenceGroup(); |
302 |
0 |
final ColumnSelection csel = new ColumnSelection(); |
303 |
0 |
AlignmentI al = alf.viewport.getAlignment(); |
304 |
0 |
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( |
305 |
|
alf.viewport.getAlignment().getSequencesArray()); |
306 |
0 |
int start = 0, end = al.getWidth(), alw = al.getWidth(); |
307 |
0 |
boolean seqsfound = true; |
308 |
0 |
if (ids != null && ids.length > 0) |
309 |
|
{ |
310 |
0 |
seqsfound = false; |
311 |
0 |
for (int i = 0; i < ids.length; i++) |
312 |
|
{ |
313 |
0 |
if (ids[i].trim().length() == 0) |
314 |
|
{ |
315 |
0 |
continue; |
316 |
|
} |
317 |
0 |
SequenceI sq = matcher.findIdMatch(ids[i]); |
318 |
0 |
if (sq != null) |
319 |
|
{ |
320 |
0 |
seqsfound = true; |
321 |
0 |
sel.addSequence(sq, false); |
322 |
|
} |
323 |
|
} |
324 |
|
} |
325 |
0 |
boolean inseqpos = false; |
326 |
0 |
if (cols != null && cols.length > 0) |
327 |
|
{ |
328 |
0 |
boolean seset = false; |
329 |
0 |
for (int i = 0; i < cols.length; i++) |
330 |
|
{ |
331 |
0 |
String cl = cols[i].trim(); |
332 |
0 |
if (cl.length() == 0) |
333 |
|
{ |
334 |
0 |
continue; |
335 |
|
} |
336 |
0 |
int p; |
337 |
0 |
if ((p = cl.indexOf("-")) > -1) |
338 |
|
{ |
339 |
0 |
int from = -1, to = -1; |
340 |
0 |
try |
341 |
|
{ |
342 |
0 |
from = Integer.valueOf(cl.substring(0, p)).intValue(); |
343 |
0 |
from--; |
344 |
|
} catch (NumberFormatException ex) |
345 |
|
{ |
346 |
0 |
jalview.bin.Console.errPrintln( |
347 |
|
"ERROR: Couldn't parse first integer in range element column selection string '" |
348 |
|
+ cl + "' - format is 'from-to'"); |
349 |
0 |
return; |
350 |
|
} |
351 |
0 |
try |
352 |
|
{ |
353 |
0 |
to = Integer.valueOf(cl.substring(p + 1)).intValue(); |
354 |
0 |
to--; |
355 |
|
} catch (NumberFormatException ex) |
356 |
|
{ |
357 |
0 |
jalview.bin.Console.errPrintln( |
358 |
|
"ERROR: Couldn't parse second integer in range element column selection string '" |
359 |
|
+ cl + "' - format is 'from-to'"); |
360 |
0 |
return; |
361 |
|
} |
362 |
0 |
if (from >= 0 && to >= 0) |
363 |
|
{ |
364 |
|
|
365 |
0 |
if (from < to) |
366 |
|
{ |
367 |
0 |
int t = to; |
368 |
0 |
to = from; |
369 |
0 |
to = t; |
370 |
|
} |
371 |
0 |
if (!seset) |
372 |
|
{ |
373 |
0 |
start = from; |
374 |
0 |
end = to; |
375 |
0 |
seset = true; |
376 |
|
} |
377 |
|
else |
378 |
|
{ |
379 |
|
|
380 |
0 |
if (start > from) |
381 |
|
{ |
382 |
0 |
start = from; |
383 |
|
} |
384 |
0 |
if (end < to) |
385 |
|
{ |
386 |
0 |
end = to; |
387 |
|
} |
388 |
|
} |
389 |
0 |
for (int r = from; r <= to; r++) |
390 |
|
{ |
391 |
0 |
if (r >= 0 && r < alw) |
392 |
|
{ |
393 |
0 |
csel.addElement(r); |
394 |
|
} |
395 |
|
} |
396 |
0 |
if (debug) |
397 |
|
{ |
398 |
0 |
jalview.bin.Console.errPrintln("Range '" + cl |
399 |
|
+ "' deparsed as [" + from + "," + to + "]"); |
400 |
|
} |
401 |
|
} |
402 |
|
else |
403 |
|
{ |
404 |
0 |
jalview.bin.Console.errPrintln("ERROR: Invalid Range '" + cl |
405 |
|
+ "' deparsed as [" + from + "," + to + "]"); |
406 |
|
} |
407 |
|
} |
408 |
|
else |
409 |
|
{ |
410 |
0 |
int r = -1; |
411 |
0 |
try |
412 |
|
{ |
413 |
0 |
r = Integer.valueOf(cl).intValue(); |
414 |
0 |
r--; |
415 |
|
} catch (NumberFormatException ex) |
416 |
|
{ |
417 |
0 |
if (cl.toLowerCase(Locale.ROOT).equals("sequence")) |
418 |
|
{ |
419 |
|
|
420 |
0 |
inseqpos = true; |
421 |
|
} |
422 |
|
else |
423 |
|
{ |
424 |
0 |
jalview.bin.Console.errPrintln( |
425 |
|
"ERROR: Couldn't parse integer from point selection element of column selection string '" |
426 |
|
+ cl + "'"); |
427 |
0 |
return; |
428 |
|
} |
429 |
|
} |
430 |
0 |
if (r >= 0 && r <= alw) |
431 |
|
{ |
432 |
0 |
if (!seset) |
433 |
|
{ |
434 |
0 |
start = r; |
435 |
0 |
end = r; |
436 |
0 |
seset = true; |
437 |
|
} |
438 |
|
else |
439 |
|
{ |
440 |
|
|
441 |
0 |
if (start > r) |
442 |
|
{ |
443 |
0 |
start = r; |
444 |
|
} |
445 |
0 |
if (end < r) |
446 |
|
{ |
447 |
0 |
end = r; |
448 |
|
} |
449 |
|
} |
450 |
0 |
csel.addElement(r); |
451 |
0 |
if (debug) |
452 |
|
{ |
453 |
0 |
jalview.bin.Console.errPrintln("Point selection '" + cl |
454 |
|
+ "' deparsed as [" + r + "]"); |
455 |
|
} |
456 |
|
} |
457 |
|
else |
458 |
|
{ |
459 |
0 |
jalview.bin.Console |
460 |
|
.errPrintln("ERROR: Invalid Point selection '" + cl |
461 |
|
+ "' deparsed as [" + r + "]"); |
462 |
|
} |
463 |
|
} |
464 |
|
} |
465 |
|
} |
466 |
0 |
if (seqsfound) |
467 |
|
{ |
468 |
|
|
469 |
|
|
470 |
0 |
if (inseqpos && sel.getSize() > 0) |
471 |
|
{ |
472 |
|
|
473 |
0 |
SequenceI rs = sel.getSequenceAt(0); |
474 |
0 |
start = rs.findIndex(start); |
475 |
0 |
end = rs.findIndex(end); |
476 |
0 |
List<Integer> cs = new ArrayList<>(csel.getSelected()); |
477 |
0 |
csel.clear(); |
478 |
0 |
for (Integer selectedCol : cs) |
479 |
|
{ |
480 |
0 |
csel.addElement(rs.findIndex(selectedCol)); |
481 |
|
} |
482 |
|
} |
483 |
0 |
sel.setStartRes(start); |
484 |
0 |
sel.setEndRes(end); |
485 |
0 |
EventQueue.invokeLater(new Runnable() |
486 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
487 |
0 |
@Override... |
488 |
|
public void run() |
489 |
|
{ |
490 |
0 |
alf.select(sel, csel, |
491 |
|
alf.getAlignViewport().getAlignment().getHiddenColumns()); |
492 |
|
} |
493 |
|
}); |
494 |
|
} |
495 |
|
} |
496 |
|
|
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
@see |
501 |
|
|
502 |
|
|
503 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
504 |
0 |
@Override... |
505 |
|
public String getSelectedSequencesAsAlignment(String format, |
506 |
|
String suffix) |
507 |
|
{ |
508 |
0 |
return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(), |
509 |
|
format, suffix); |
510 |
|
} |
511 |
|
|
512 |
|
|
513 |
|
|
514 |
|
|
515 |
|
@see |
516 |
|
|
517 |
|
|
518 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
519 |
0 |
@Override... |
520 |
|
public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, |
521 |
|
String format, String suffix) |
522 |
|
{ |
523 |
0 |
try |
524 |
|
{ |
525 |
0 |
FileFormatI theFormat = FileFormats.getInstance().forName(format); |
526 |
0 |
boolean seqlimits = suffix.equalsIgnoreCase(TRUE); |
527 |
0 |
if (alf.viewport.getSelectionGroup() != null) |
528 |
|
{ |
529 |
|
|
530 |
|
|
531 |
|
|
532 |
0 |
String reply = new AppletFormatAdapter().formatSequences(theFormat, |
533 |
|
new Alignment(alf.viewport.getSelectionAsNewSequence()), |
534 |
|
seqlimits); |
535 |
0 |
return reply; |
536 |
|
} |
537 |
|
} catch (IllegalArgumentException ex) |
538 |
|
{ |
539 |
0 |
ex.printStackTrace(); |
540 |
0 |
return "Error retrieving alignment, possibly invalid format specifier: " |
541 |
|
+ format; |
542 |
|
} |
543 |
0 |
return ""; |
544 |
|
} |
545 |
|
|
546 |
|
|
547 |
|
|
548 |
|
|
549 |
|
@see |
550 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
551 |
0 |
@Override... |
552 |
|
public String getAlignmentOrder() |
553 |
|
{ |
554 |
0 |
return getAlignmentOrderFrom(getDefaultTargetFrame()); |
555 |
|
} |
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
|
560 |
|
@see |
561 |
|
|
562 |
|
|
563 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
564 |
0 |
@Override... |
565 |
|
public String getAlignmentOrderFrom(AlignFrame alf) |
566 |
|
{ |
567 |
0 |
return getAlignmentOrderFrom(alf, separator); |
568 |
|
} |
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
@see |
574 |
|
|
575 |
|
|
576 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
577 |
0 |
@Override... |
578 |
|
public String getAlignmentOrderFrom(AlignFrame alf, String sep) |
579 |
|
{ |
580 |
0 |
AlignmentI alorder = alf.getAlignViewport().getAlignment(); |
581 |
0 |
String[] order = new String[alorder.getHeight()]; |
582 |
0 |
for (int i = 0; i < order.length; i++) |
583 |
|
{ |
584 |
0 |
order[i] = alorder.getSequenceAt(i).getName(); |
585 |
|
} |
586 |
0 |
return arrayToSeparatorList(order); |
587 |
|
} |
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
@see |
593 |
|
|
594 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
595 |
0 |
@Override... |
596 |
|
public String orderBy(String order, String undoName) |
597 |
|
{ |
598 |
0 |
return orderBy(order, undoName, separator); |
599 |
|
} |
600 |
|
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
|
@see |
605 |
|
|
606 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
607 |
0 |
@Override... |
608 |
|
public String orderBy(String order, String undoName, String sep) |
609 |
|
{ |
610 |
0 |
return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep); |
611 |
|
} |
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
616 |
|
@see |
617 |
|
|
618 |
|
|
619 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 11 |
Complexity Density: 0.44 |
|
620 |
0 |
@Override... |
621 |
|
public String orderAlignmentBy(AlignFrame alf, String order, |
622 |
|
String undoName, String sep) |
623 |
|
{ |
624 |
0 |
String[] ids = separatorListToArray(order, sep); |
625 |
0 |
SequenceI[] sqs = null; |
626 |
0 |
if (ids != null && ids.length > 0) |
627 |
|
{ |
628 |
0 |
jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( |
629 |
|
alf.viewport.getAlignment().getSequencesArray()); |
630 |
0 |
int s = 0; |
631 |
0 |
sqs = new SequenceI[ids.length]; |
632 |
0 |
for (int i = 0; i < ids.length; i++) |
633 |
|
{ |
634 |
0 |
if (ids[i].trim().length() == 0) |
635 |
|
{ |
636 |
0 |
continue; |
637 |
|
} |
638 |
0 |
SequenceI sq = matcher.findIdMatch(ids[i]); |
639 |
0 |
if (sq != null) |
640 |
|
{ |
641 |
0 |
sqs[s++] = sq; |
642 |
|
} |
643 |
|
} |
644 |
0 |
if (s > 0) |
645 |
|
{ |
646 |
0 |
SequenceI[] sqq = new SequenceI[s]; |
647 |
0 |
System.arraycopy(sqs, 0, sqq, 0, s); |
648 |
0 |
sqs = sqq; |
649 |
|
} |
650 |
|
else |
651 |
|
{ |
652 |
0 |
sqs = null; |
653 |
|
} |
654 |
|
} |
655 |
0 |
if (sqs == null) |
656 |
|
{ |
657 |
0 |
return ""; |
658 |
|
} |
659 |
0 |
; |
660 |
0 |
final AlignmentOrder aorder = new AlignmentOrder(sqs); |
661 |
|
|
662 |
0 |
if (undoName != null && undoName.trim().length() == 0) |
663 |
|
{ |
664 |
0 |
undoName = null; |
665 |
|
} |
666 |
0 |
final String _undoName = undoName; |
667 |
|
|
668 |
|
|
669 |
0 |
return alf.sortBy(aorder, _undoName) ? TRUE : ""; |
670 |
|
} |
671 |
|
|
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
@see |
676 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
677 |
0 |
@Override... |
678 |
|
public String getAlignment(String format) |
679 |
|
{ |
680 |
0 |
return getAlignmentFrom(getDefaultTargetFrame(), format, TRUE); |
681 |
|
} |
682 |
|
|
683 |
|
|
684 |
|
|
685 |
|
|
686 |
|
@see |
687 |
|
|
688 |
|
|
689 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
690 |
0 |
@Override... |
691 |
|
public String getAlignmentFrom(AlignFrame alf, String format) |
692 |
|
{ |
693 |
0 |
return getAlignmentFrom(alf, format, TRUE); |
694 |
|
} |
695 |
|
|
696 |
|
|
697 |
|
|
698 |
|
|
699 |
|
@see |
700 |
|
|
701 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
702 |
0 |
@Override... |
703 |
|
public String getAlignment(String format, String suffix) |
704 |
|
{ |
705 |
0 |
return getAlignmentFrom(getDefaultTargetFrame(), format, suffix); |
706 |
|
} |
707 |
|
|
708 |
|
|
709 |
|
|
710 |
|
|
711 |
|
@see |
712 |
|
|
713 |
|
|
714 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
715 |
0 |
@Override... |
716 |
|
public String getAlignmentFrom(AlignFrame alf, String format, |
717 |
|
String suffix) |
718 |
|
{ |
719 |
0 |
try |
720 |
|
{ |
721 |
0 |
boolean seqlimits = suffix.equalsIgnoreCase(TRUE); |
722 |
|
|
723 |
0 |
FileFormatI theFormat = FileFormats.getInstance().forName(format); |
724 |
0 |
String reply = new AppletFormatAdapter().formatSequences(theFormat, |
725 |
|
alf.viewport.getAlignment(), seqlimits); |
726 |
0 |
return reply; |
727 |
|
} catch (IllegalArgumentException ex) |
728 |
|
{ |
729 |
0 |
ex.printStackTrace(); |
730 |
0 |
return "Error retrieving alignment, possibly invalid format specifier: " |
731 |
|
+ format; |
732 |
|
} |
733 |
|
} |
734 |
|
|
735 |
|
|
736 |
|
|
737 |
|
|
738 |
|
@see |
739 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
740 |
0 |
@Override... |
741 |
|
public void loadAnnotation(String annotation) |
742 |
|
{ |
743 |
0 |
loadAnnotationFrom(getDefaultTargetFrame(), annotation); |
744 |
|
} |
745 |
|
|
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
@see |
750 |
|
|
751 |
|
|
752 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
753 |
0 |
@Override... |
754 |
|
public void loadAnnotationFrom(AlignFrame alf, String annotation) |
755 |
|
{ |
756 |
0 |
if (new AnnotationFile().annotateAlignmentView(alf.getAlignViewport(), |
757 |
|
annotation, DataSourceType.PASTE)) |
758 |
|
{ |
759 |
0 |
alf.alignPanel.fontChanged(); |
760 |
0 |
alf.alignPanel.setScrollValues(0, 0); |
761 |
|
} |
762 |
|
else |
763 |
|
{ |
764 |
0 |
alf.parseFeaturesFile(annotation, DataSourceType.PASTE); |
765 |
|
} |
766 |
|
} |
767 |
|
|
768 |
|
|
769 |
|
|
770 |
|
|
771 |
|
@see |
772 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
773 |
0 |
@Override... |
774 |
|
public void loadFeatures(String features, boolean autoenabledisplay) |
775 |
|
{ |
776 |
0 |
loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay); |
777 |
|
} |
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
|
782 |
|
@see |
783 |
|
|
784 |
|
|
785 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
786 |
0 |
@Override... |
787 |
|
public boolean loadFeaturesFrom(AlignFrame alf, String features, |
788 |
|
boolean autoenabledisplay) |
789 |
|
{ |
790 |
0 |
return alf.parseFeaturesFile(features, DataSourceType.PASTE, |
791 |
|
autoenabledisplay); |
792 |
|
} |
793 |
|
|
794 |
|
|
795 |
|
|
796 |
|
|
797 |
|
@see |
798 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
799 |
0 |
@Override... |
800 |
|
public String getFeatures(String format) |
801 |
|
{ |
802 |
0 |
return getFeaturesFrom(getDefaultTargetFrame(), format); |
803 |
|
} |
804 |
|
|
805 |
|
|
806 |
|
|
807 |
|
|
808 |
|
@see |
809 |
|
|
810 |
|
|
811 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
812 |
0 |
@Override... |
813 |
|
public String getFeaturesFrom(AlignFrame alf, String format) |
814 |
|
{ |
815 |
0 |
return alf.outputFeatures(false, format); |
816 |
|
} |
817 |
|
|
818 |
|
|
819 |
|
|
820 |
|
|
821 |
|
@see |
822 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
823 |
0 |
@Override... |
824 |
|
public String getAnnotation() |
825 |
|
{ |
826 |
0 |
return getAnnotationFrom(getDefaultTargetFrame()); |
827 |
|
} |
828 |
|
|
829 |
|
|
830 |
|
|
831 |
|
|
832 |
|
@see |
833 |
|
|
834 |
|
|
835 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
836 |
0 |
@Override... |
837 |
|
public String getAnnotationFrom(AlignFrame alf) |
838 |
|
{ |
839 |
0 |
return alf.outputAnnotations(false); |
840 |
|
} |
841 |
|
|
842 |
|
|
843 |
|
|
844 |
|
|
845 |
|
@see |
846 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
847 |
0 |
@Override... |
848 |
|
public AlignFrame newView() |
849 |
|
{ |
850 |
0 |
return newViewFrom(getDefaultTargetFrame()); |
851 |
|
} |
852 |
|
|
853 |
|
|
854 |
|
|
855 |
|
|
856 |
|
@see |
857 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
858 |
0 |
@Override... |
859 |
|
public AlignFrame newView(String name) |
860 |
|
{ |
861 |
0 |
return newViewFrom(getDefaultTargetFrame(), name); |
862 |
|
} |
863 |
|
|
864 |
|
|
865 |
|
|
866 |
|
|
867 |
|
@see |
868 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
869 |
0 |
@Override... |
870 |
|
public AlignFrame newViewFrom(AlignFrame alf) |
871 |
|
{ |
872 |
0 |
return alf.newView(null); |
873 |
|
} |
874 |
|
|
875 |
|
|
876 |
|
|
877 |
|
|
878 |
|
@see |
879 |
|
|
880 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
881 |
0 |
@Override... |
882 |
|
public AlignFrame newViewFrom(AlignFrame alf, String name) |
883 |
|
{ |
884 |
0 |
return alf.newView(name); |
885 |
|
} |
886 |
|
|
887 |
|
|
888 |
|
|
889 |
|
|
890 |
|
@see |
891 |
|
|
892 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
893 |
0 |
@Override... |
894 |
|
public AlignFrame loadAlignment(String text, String title) |
895 |
|
{ |
896 |
0 |
AlignmentI al = null; |
897 |
|
|
898 |
0 |
try |
899 |
|
{ |
900 |
0 |
FileFormatI format = new IdentifyFile().identify(text, |
901 |
|
DataSourceType.PASTE); |
902 |
0 |
al = new AppletFormatAdapter().readFile(text, DataSourceType.PASTE, |
903 |
|
format); |
904 |
0 |
if (al.getHeight() > 0) |
905 |
|
{ |
906 |
0 |
return new AlignFrame(al, this, title, false); |
907 |
|
} |
908 |
|
} catch (IOException ex) |
909 |
|
{ |
910 |
0 |
ex.printStackTrace(); |
911 |
|
} |
912 |
0 |
return null; |
913 |
|
} |
914 |
|
|
915 |
|
|
916 |
|
|
917 |
|
|
918 |
|
@see |
919 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
920 |
0 |
@Override... |
921 |
|
public void setMouseoverListener(String listener) |
922 |
|
{ |
923 |
0 |
setMouseoverListener(currentAlignFrame, listener); |
924 |
|
} |
925 |
|
|
926 |
|
private Vector<jalview.javascript.JSFunctionExec> javascriptListeners = new Vector<>(); |
927 |
|
|
928 |
|
|
929 |
|
|
930 |
|
|
931 |
|
@see |
932 |
|
|
933 |
|
|
934 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
935 |
0 |
@Override... |
936 |
|
public void setMouseoverListener(AlignFrame af, String listener) |
937 |
|
{ |
938 |
0 |
if (listener != null) |
939 |
|
{ |
940 |
0 |
listener = listener.trim(); |
941 |
0 |
if (listener.length() == 0) |
942 |
|
{ |
943 |
0 |
jalview.bin.Console.errPrintln( |
944 |
|
"jalview Javascript error: Ignoring empty function for mouseover listener."); |
945 |
0 |
return; |
946 |
|
} |
947 |
|
} |
948 |
0 |
jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener( |
949 |
|
this, af, listener); |
950 |
0 |
javascriptListeners.addElement(mol); |
951 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
952 |
|
.addStructureViewerListener(mol); |
953 |
0 |
if (debug) |
954 |
|
{ |
955 |
0 |
jalview.bin.Console.errPrintln("Added a mouseover listener for " |
956 |
0 |
+ ((af == null) ? "All frames" |
957 |
|
: "Just views for " |
958 |
|
+ af.getAlignViewport().getSequenceSetId())); |
959 |
0 |
jalview.bin.Console.errPrintln("There are now " |
960 |
|
+ javascriptListeners.size() + " listeners in total."); |
961 |
|
} |
962 |
|
} |
963 |
|
|
964 |
|
|
965 |
|
|
966 |
|
|
967 |
|
@see |
968 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
969 |
0 |
@Override... |
970 |
|
public void setSelectionListener(String listener) |
971 |
|
{ |
972 |
0 |
setSelectionListener(null, listener); |
973 |
|
} |
974 |
|
|
975 |
|
|
976 |
|
|
977 |
|
|
978 |
|
@see |
979 |
|
|
980 |
|
|
981 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
982 |
0 |
@Override... |
983 |
|
public void setSelectionListener(AlignFrame af, String listener) |
984 |
|
{ |
985 |
0 |
if (listener != null) |
986 |
|
{ |
987 |
0 |
listener = listener.trim(); |
988 |
0 |
if (listener.length() == 0) |
989 |
|
{ |
990 |
0 |
jalview.bin.Console.errPrintln( |
991 |
|
"jalview Javascript error: Ignoring empty function for selection listener."); |
992 |
0 |
return; |
993 |
|
} |
994 |
|
} |
995 |
0 |
jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender( |
996 |
|
this, af, listener); |
997 |
0 |
javascriptListeners.addElement(mol); |
998 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
999 |
|
.addSelectionListener(mol); |
1000 |
0 |
if (debug) |
1001 |
|
{ |
1002 |
0 |
jalview.bin.Console.errPrintln("Added a selection listener for " |
1003 |
0 |
+ ((af == null) ? "All frames" |
1004 |
|
: "Just views for " |
1005 |
|
+ af.getAlignViewport().getSequenceSetId())); |
1006 |
0 |
jalview.bin.Console.errPrintln("There are now " |
1007 |
|
+ javascriptListeners.size() + " listeners in total."); |
1008 |
|
} |
1009 |
|
} |
1010 |
|
|
1011 |
|
|
1012 |
|
|
1013 |
|
|
1014 |
|
|
1015 |
|
@param |
1016 |
|
|
1017 |
|
@param |
1018 |
|
|
1019 |
|
@see |
1020 |
|
|
1021 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
1022 |
0 |
@Override... |
1023 |
|
public void setStructureListener(String listener, String modelSet) |
1024 |
|
{ |
1025 |
0 |
if (listener != null) |
1026 |
|
{ |
1027 |
0 |
listener = listener.trim(); |
1028 |
0 |
if (listener.length() == 0) |
1029 |
|
{ |
1030 |
0 |
jalview.bin.Console.errPrintln( |
1031 |
|
"jalview Javascript error: Ignoring empty function for selection listener."); |
1032 |
0 |
return; |
1033 |
|
} |
1034 |
|
} |
1035 |
0 |
MouseOverStructureListener mol = new MouseOverStructureListener(this, |
1036 |
|
listener, separatorListToArray(modelSet)); |
1037 |
0 |
javascriptListeners.addElement(mol); |
1038 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
1039 |
|
.addStructureViewerListener(mol); |
1040 |
0 |
if (debug) |
1041 |
|
{ |
1042 |
0 |
jalview.bin.Console |
1043 |
|
.errPrintln("Added a javascript structure viewer listener '" |
1044 |
|
+ listener + "'"); |
1045 |
0 |
jalview.bin.Console.errPrintln("There are now " |
1046 |
|
+ javascriptListeners.size() + " listeners in total."); |
1047 |
|
} |
1048 |
|
} |
1049 |
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
1053 |
|
@see |
1054 |
|
|
1055 |
|
|
1056 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 11 |
Complexity Density: 0.55 |
|
1057 |
0 |
@Override... |
1058 |
|
public void removeJavascriptListener(AlignFrame af, String listener) |
1059 |
|
{ |
1060 |
0 |
if (listener != null) |
1061 |
|
{ |
1062 |
0 |
listener = listener.trim(); |
1063 |
0 |
if (listener.length() == 0) |
1064 |
|
{ |
1065 |
0 |
listener = null; |
1066 |
|
} |
1067 |
|
} |
1068 |
0 |
boolean rprt = false; |
1069 |
0 |
for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;) |
1070 |
|
{ |
1071 |
0 |
Object lstn = javascriptListeners.elementAt(ms); |
1072 |
0 |
JsCallBack lstner = (JsCallBack) lstn; |
1073 |
0 |
if ((af == null || lstner.getAlignFrame() == af) && (listener == null |
1074 |
|
|| lstner.getListenerFunction().equals(listener))) |
1075 |
|
{ |
1076 |
0 |
javascriptListeners.removeElement(lstner); |
1077 |
0 |
msSize--; |
1078 |
0 |
if (lstner instanceof SelectionListener) |
1079 |
|
{ |
1080 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
1081 |
|
.removeSelectionListener((SelectionListener) lstner); |
1082 |
|
} |
1083 |
|
else |
1084 |
|
{ |
1085 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
1086 |
|
.removeStructureViewerListener(lstner, null); |
1087 |
|
} |
1088 |
0 |
rprt = debug; |
1089 |
0 |
if (debug) |
1090 |
|
{ |
1091 |
0 |
jalview.bin.Console |
1092 |
|
.errPrintln("Removed listener '" + listener + "'"); |
1093 |
|
} |
1094 |
|
} |
1095 |
|
else |
1096 |
|
{ |
1097 |
0 |
ms++; |
1098 |
|
} |
1099 |
|
} |
1100 |
0 |
if (rprt) |
1101 |
|
{ |
1102 |
0 |
jalview.bin.Console.errPrintln("There are now " |
1103 |
|
+ javascriptListeners.size() + " listeners in total."); |
1104 |
|
} |
1105 |
|
} |
1106 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1107 |
0 |
@Override... |
1108 |
|
public void stop() |
1109 |
|
{ |
1110 |
0 |
jalview.bin.Console.errPrintln("Applet " + getName() + " stop()."); |
1111 |
0 |
tidyUp(); |
1112 |
|
} |
1113 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1114 |
0 |
@Override... |
1115 |
|
public void destroy() |
1116 |
|
{ |
1117 |
0 |
jalview.bin.Console.errPrintln("Applet " + getName() + " destroy()."); |
1118 |
0 |
tidyUp(); |
1119 |
|
} |
1120 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.38 |
|
1121 |
0 |
private void tidyUp()... |
1122 |
|
{ |
1123 |
0 |
removeAll(); |
1124 |
0 |
if (currentAlignFrame != null && currentAlignFrame.viewport != null |
1125 |
|
&& currentAlignFrame.viewport.applet != null) |
1126 |
|
{ |
1127 |
0 |
AlignViewport av = currentAlignFrame.viewport; |
1128 |
0 |
currentAlignFrame.closeMenuItem_actionPerformed(); |
1129 |
0 |
av.applet = null; |
1130 |
0 |
currentAlignFrame = null; |
1131 |
|
} |
1132 |
0 |
if (javascriptListeners != null) |
1133 |
|
{ |
1134 |
0 |
while (javascriptListeners.size() > 0) |
1135 |
|
{ |
1136 |
0 |
jalview.javascript.JSFunctionExec mol = javascriptListeners |
1137 |
|
.elementAt(0); |
1138 |
0 |
javascriptListeners.removeElement(mol); |
1139 |
0 |
if (mol instanceof SelectionListener) |
1140 |
|
{ |
1141 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
1142 |
|
.removeSelectionListener((SelectionListener) mol); |
1143 |
|
} |
1144 |
|
else |
1145 |
|
{ |
1146 |
0 |
StructureSelectionManager.getStructureSelectionManager(this) |
1147 |
|
.removeStructureViewerListener(mol, null); |
1148 |
|
} |
1149 |
0 |
mol.jvlite = null; |
1150 |
|
} |
1151 |
|
} |
1152 |
0 |
if (jsFunctionExec != null) |
1153 |
|
{ |
1154 |
0 |
jsFunctionExec.stopQueue(); |
1155 |
0 |
jsFunctionExec.jvlite = null; |
1156 |
|
} |
1157 |
0 |
initialAlignFrame = null; |
1158 |
0 |
jsFunctionExec = null; |
1159 |
0 |
javascriptListeners = null; |
1160 |
0 |
StructureSelectionManager.release(this); |
1161 |
|
} |
1162 |
|
|
1163 |
|
private jalview.javascript.JSFunctionExec jsFunctionExec; |
1164 |
|
|
1165 |
|
|
1166 |
|
|
1167 |
|
|
1168 |
|
@see |
1169 |
|
|
1170 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1171 |
0 |
@Override... |
1172 |
|
public void mouseOverStructure(final String pdbResNum, final String chain, |
1173 |
|
final String pdbfile) |
1174 |
|
{ |
1175 |
0 |
final StructureSelectionManagerProvider me = this; |
1176 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
1177 |
|
{ |
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1178 |
0 |
@Override... |
1179 |
|
public void run() |
1180 |
|
{ |
1181 |
0 |
try |
1182 |
|
{ |
1183 |
0 |
StructureSelectionManager.getStructureSelectionManager(me) |
1184 |
|
.mouseOverStructure(Integer.valueOf(pdbResNum).intValue(), |
1185 |
|
chain, pdbfile); |
1186 |
0 |
if (debug) |
1187 |
|
{ |
1188 |
0 |
System.err |
1189 |
|
.println("mouseOver for '" + pdbResNum + "' in chain '" |
1190 |
|
+ chain + "' in structure '" + pdbfile + "'"); |
1191 |
|
} |
1192 |
|
} catch (NumberFormatException e) |
1193 |
|
{ |
1194 |
0 |
jalview.bin.Console |
1195 |
|
.errPrintln("Ignoring invalid residue number string '" |
1196 |
|
+ pdbResNum + "'"); |
1197 |
|
} |
1198 |
|
|
1199 |
|
} |
1200 |
|
}); |
1201 |
|
} |
1202 |
|
|
1203 |
|
|
1204 |
|
|
1205 |
|
|
1206 |
|
@see |
1207 |
|
|
1208 |
|
|
1209 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1210 |
0 |
@Override... |
1211 |
|
public void scrollViewToIn(final AlignFrame alf, final String topRow, |
1212 |
|
final String leftHandColumn) |
1213 |
|
{ |
1214 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
1215 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1216 |
0 |
@Override... |
1217 |
|
public void run() |
1218 |
|
{ |
1219 |
0 |
try |
1220 |
|
{ |
1221 |
0 |
alf.scrollTo(Integer.valueOf(topRow).intValue(), |
1222 |
|
Integer.valueOf(leftHandColumn).intValue()); |
1223 |
|
|
1224 |
|
} catch (Exception ex) |
1225 |
|
{ |
1226 |
0 |
jalview.bin.Console |
1227 |
|
.errPrintln("Couldn't parse integer arguments (topRow='" |
1228 |
|
+ topRow + "' and leftHandColumn='" |
1229 |
|
+ leftHandColumn + "')"); |
1230 |
0 |
ex.printStackTrace(); |
1231 |
|
} |
1232 |
|
} |
1233 |
|
}); |
1234 |
|
} |
1235 |
|
|
1236 |
|
|
1237 |
|
|
1238 |
|
|
1239 |
|
@see |
1240 |
|
|
1241 |
|
|
1242 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1243 |
0 |
@Override... |
1244 |
|
public void scrollViewToRowIn(final AlignFrame alf, final String topRow) |
1245 |
|
{ |
1246 |
|
|
1247 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
1248 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1249 |
0 |
@Override... |
1250 |
|
public void run() |
1251 |
|
{ |
1252 |
0 |
try |
1253 |
|
{ |
1254 |
0 |
alf.scrollToRow(Integer.valueOf(topRow).intValue()); |
1255 |
|
|
1256 |
|
} catch (Exception ex) |
1257 |
|
{ |
1258 |
0 |
jalview.bin.Console |
1259 |
|
.errPrintln("Couldn't parse integer arguments (topRow='" |
1260 |
|
+ topRow + "')"); |
1261 |
0 |
ex.printStackTrace(); |
1262 |
|
} |
1263 |
|
|
1264 |
|
} |
1265 |
|
}); |
1266 |
|
} |
1267 |
|
|
1268 |
|
|
1269 |
|
|
1270 |
|
|
1271 |
|
@see |
1272 |
|
|
1273 |
|
|
1274 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1275 |
0 |
@Override... |
1276 |
|
public void scrollViewToColumnIn(final AlignFrame alf, |
1277 |
|
final String leftHandColumn) |
1278 |
|
{ |
1279 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
1280 |
|
{ |
1281 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1282 |
0 |
@Override... |
1283 |
|
public void run() |
1284 |
|
{ |
1285 |
0 |
try |
1286 |
|
{ |
1287 |
0 |
alf.scrollToColumn(Integer.valueOf(leftHandColumn).intValue()); |
1288 |
|
|
1289 |
|
} catch (Exception ex) |
1290 |
|
{ |
1291 |
0 |
jalview.bin.Console.errPrintln( |
1292 |
|
"Couldn't parse integer arguments (leftHandColumn='" |
1293 |
|
+ leftHandColumn + "')"); |
1294 |
0 |
ex.printStackTrace(); |
1295 |
|
} |
1296 |
|
} |
1297 |
|
}); |
1298 |
|
|
1299 |
|
} |
1300 |
|
|
1301 |
|
|
1302 |
|
|
1303 |
|
|
1304 |
|
public static int lastFrameX = 200; |
1305 |
|
|
1306 |
|
public static int lastFrameY = 200; |
1307 |
|
|
1308 |
|
boolean fileFound = true; |
1309 |
|
|
1310 |
|
String file = "No file"; |
1311 |
|
|
1312 |
|
String file2 = null; |
1313 |
|
|
1314 |
|
Button launcher = new Button( |
1315 |
|
MessageManager.getString("label.start_jalview")); |
1316 |
|
|
1317 |
|
|
1318 |
|
|
1319 |
|
|
1320 |
|
|
1321 |
|
|
1322 |
|
|
1323 |
|
public AlignFrame currentAlignFrame = null; |
1324 |
|
|
1325 |
|
|
1326 |
|
|
1327 |
|
|
1328 |
|
|
1329 |
|
AlignFrame initialAlignFrame = null; |
1330 |
|
|
1331 |
|
boolean embedded = false; |
1332 |
|
|
1333 |
|
private boolean checkForJmol = true; |
1334 |
|
|
1335 |
|
private boolean checkedForJmol = false; |
1336 |
|
|
1337 |
|
|
1338 |
|
|
1339 |
|
public boolean jmolAvailable = false; |
1340 |
|
|
1341 |
|
private boolean alignPdbStructures = false; |
1342 |
|
|
1343 |
|
|
1344 |
|
|
1345 |
|
|
1346 |
|
|
1347 |
|
public boolean useXtrnalSviewer = false; |
1348 |
|
|
1349 |
|
public static boolean debug = false; |
1350 |
|
|
1351 |
|
static String builddate = null, version = null, installation = null; |
1352 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 8 |
Complexity Density: 0.47 |
|
1353 |
0 |
private static void initBuildDetails()... |
1354 |
|
{ |
1355 |
0 |
if (builddate == null) |
1356 |
|
{ |
1357 |
0 |
builddate = "unknown"; |
1358 |
0 |
version = "test"; |
1359 |
0 |
installation = "applet"; |
1360 |
0 |
java.net.URL url = JalviewLite.class |
1361 |
|
.getResource("/.build_properties"); |
1362 |
0 |
if (url != null) |
1363 |
|
{ |
1364 |
0 |
try |
1365 |
|
{ |
1366 |
0 |
BufferedReader reader = new BufferedReader( |
1367 |
|
new InputStreamReader(HttpUtils.openStream(url))); |
1368 |
0 |
String line; |
1369 |
0 |
while ((line = reader.readLine()) != null) |
1370 |
|
{ |
1371 |
0 |
if (line.indexOf("VERSION") > -1) |
1372 |
|
{ |
1373 |
0 |
version = line.substring(line.indexOf("=") + 1); |
1374 |
|
} |
1375 |
0 |
if (line.indexOf("BUILD_DATE") > -1) |
1376 |
|
{ |
1377 |
0 |
builddate = line.substring(line.indexOf("=") + 1); |
1378 |
|
} |
1379 |
0 |
if (line.indexOf("INSTALLATION") > -1) |
1380 |
|
{ |
1381 |
0 |
installation = line.substring(line.indexOf("=") + 1); |
1382 |
|
} |
1383 |
|
} |
1384 |
|
} catch (Exception ex) |
1385 |
|
{ |
1386 |
0 |
ex.printStackTrace(); |
1387 |
|
} |
1388 |
|
} |
1389 |
|
} |
1390 |
|
} |
1391 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1392 |
0 |
public static String getBuildDate()... |
1393 |
|
{ |
1394 |
0 |
initBuildDetails(); |
1395 |
0 |
return builddate; |
1396 |
|
} |
1397 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1398 |
0 |
public static String getInstallation()... |
1399 |
|
{ |
1400 |
0 |
initBuildDetails(); |
1401 |
0 |
return installation; |
1402 |
|
} |
1403 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1404 |
0 |
public static String getVersion()... |
1405 |
|
{ |
1406 |
0 |
initBuildDetails(); |
1407 |
0 |
return version; |
1408 |
|
} |
1409 |
|
|
1410 |
|
|
1411 |
|
|
1412 |
|
|
1413 |
|
|
1414 |
|
|
|
|
| 0% |
Uncovered Elements: 103 (103) |
Complexity: 22 |
Complexity Density: 0.33 |
|
1415 |
0 |
@Override... |
1416 |
|
public void init() |
1417 |
|
{ |
1418 |
0 |
debug = TRUE.equalsIgnoreCase(getParameter("debug")); |
1419 |
0 |
try |
1420 |
|
{ |
1421 |
0 |
if (debug) |
1422 |
|
{ |
1423 |
0 |
jalview.bin.Console.errPrintln("Applet context is '" |
1424 |
|
+ getAppletContext().getClass().toString() + "'"); |
1425 |
|
} |
1426 |
0 |
JSObject scriptObject = JSObject.getWindow(this); |
1427 |
0 |
if (debug && scriptObject != null) |
1428 |
|
{ |
1429 |
0 |
jalview.bin.Console |
1430 |
|
.errPrintln("Applet has Javascript callback support."); |
1431 |
|
} |
1432 |
|
|
1433 |
|
} catch (Exception ex) |
1434 |
|
{ |
1435 |
0 |
jalview.bin.Console.errPrintln( |
1436 |
|
"Warning: No JalviewLite javascript callbacks available."); |
1437 |
0 |
if (debug) |
1438 |
|
{ |
1439 |
0 |
ex.printStackTrace(); |
1440 |
|
} |
1441 |
|
} |
1442 |
|
|
1443 |
0 |
if (debug) |
1444 |
|
{ |
1445 |
0 |
jalview.bin.Console.errPrintln("JalviewLite Version " + getVersion()); |
1446 |
0 |
jalview.bin.Console.errPrintln("Build Date : " + getBuildDate()); |
1447 |
0 |
jalview.bin.Console.errPrintln("Installation : " + getInstallation()); |
1448 |
|
} |
1449 |
0 |
String externalsviewer = getParameter("externalstructureviewer"); |
1450 |
0 |
if (externalsviewer != null) |
1451 |
|
{ |
1452 |
0 |
useXtrnalSviewer = externalsviewer.trim().toLowerCase(Locale.ROOT) |
1453 |
|
.equals(TRUE); |
1454 |
|
} |
1455 |
|
|
1456 |
|
|
1457 |
|
|
1458 |
0 |
String chkforJmol = getParameter("nojmol"); |
1459 |
0 |
if (chkforJmol != null) |
1460 |
|
{ |
1461 |
0 |
checkForJmol = !chkforJmol.equals(TRUE); |
1462 |
|
} |
1463 |
|
|
1464 |
|
|
1465 |
|
|
1466 |
0 |
String sep = getParameter("separator"); |
1467 |
0 |
if (sep != null) |
1468 |
|
{ |
1469 |
0 |
if (sep.length() > 0) |
1470 |
|
{ |
1471 |
0 |
separator = sep; |
1472 |
0 |
if (debug) |
1473 |
|
{ |
1474 |
0 |
jalview.bin.Console |
1475 |
|
.errPrintln("Separator set to '" + separator + "'"); |
1476 |
|
} |
1477 |
|
} |
1478 |
|
else |
1479 |
|
{ |
1480 |
0 |
throw new Error(MessageManager |
1481 |
|
.getString("error.invalid_separator_parameter")); |
1482 |
|
} |
1483 |
|
} |
1484 |
0 |
int r = 255; |
1485 |
0 |
int g = 255; |
1486 |
0 |
int b = 255; |
1487 |
0 |
String param = getParameter("RGB"); |
1488 |
|
|
1489 |
0 |
if (param != null) |
1490 |
|
{ |
1491 |
0 |
try |
1492 |
|
{ |
1493 |
0 |
r = Integer.parseInt(param.substring(0, 2), 16); |
1494 |
0 |
g = Integer.parseInt(param.substring(2, 4), 16); |
1495 |
0 |
b = Integer.parseInt(param.substring(4, 6), 16); |
1496 |
|
} catch (Exception ex) |
1497 |
|
{ |
1498 |
0 |
r = 255; |
1499 |
0 |
g = 255; |
1500 |
0 |
b = 255; |
1501 |
|
} |
1502 |
|
} |
1503 |
0 |
param = getParameter("label"); |
1504 |
0 |
if (param != null) |
1505 |
|
{ |
1506 |
0 |
launcher.setLabel(param); |
1507 |
|
} |
1508 |
|
|
1509 |
0 |
setBackground(new Color(r, g, b)); |
1510 |
|
|
1511 |
0 |
file = getParameter("file"); |
1512 |
|
|
1513 |
0 |
if (file == null) |
1514 |
|
{ |
1515 |
|
|
1516 |
0 |
StringBuffer data = new StringBuffer("PASTE"); |
1517 |
0 |
int i = 1; |
1518 |
0 |
while ((file = getParameter("sequence" + i)) != null) |
1519 |
|
{ |
1520 |
0 |
data.append(file.toString() + "\n"); |
1521 |
0 |
i++; |
1522 |
|
} |
1523 |
0 |
if (data.length() > 5) |
1524 |
|
{ |
1525 |
0 |
file = data.toString(); |
1526 |
|
} |
1527 |
|
} |
1528 |
0 |
if (getDefaultParameter("enableSplitFrame", true)) |
1529 |
|
{ |
1530 |
0 |
file2 = getParameter("file2"); |
1531 |
|
} |
1532 |
|
|
1533 |
0 |
embedded = TRUE.equalsIgnoreCase(getParameter("embedded")); |
1534 |
0 |
if (embedded) |
1535 |
|
{ |
1536 |
0 |
LoadingThread loader = new LoadingThread(file, file2, this); |
1537 |
0 |
loader.start(); |
1538 |
|
} |
1539 |
0 |
else if (file != null) |
1540 |
|
{ |
1541 |
|
|
1542 |
|
|
1543 |
|
|
1544 |
0 |
if (FALSE.equalsIgnoreCase(getParameter("showbutton"))) |
1545 |
|
{ |
1546 |
0 |
LoadingThread loader = new LoadingThread(file, file2, this); |
1547 |
0 |
loader.start(); |
1548 |
|
} |
1549 |
|
else |
1550 |
|
{ |
1551 |
0 |
add(launcher); |
1552 |
0 |
launcher.addActionListener(new java.awt.event.ActionListener() |
1553 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1554 |
0 |
@Override... |
1555 |
|
public void actionPerformed(ActionEvent e) |
1556 |
|
{ |
1557 |
0 |
LoadingThread loader = new LoadingThread(file, file2, |
1558 |
|
JalviewLite.this); |
1559 |
0 |
loader.start(); |
1560 |
|
} |
1561 |
|
}); |
1562 |
|
} |
1563 |
|
} |
1564 |
|
else |
1565 |
|
{ |
1566 |
|
|
1567 |
|
|
1568 |
0 |
file = "NO FILE"; |
1569 |
0 |
fileFound = false; |
1570 |
0 |
callInitCallback(); |
1571 |
|
} |
1572 |
|
} |
1573 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 8 |
Complexity Density: 0.53 |
|
1574 |
0 |
private void initLiveConnect()... |
1575 |
|
{ |
1576 |
|
|
1577 |
0 |
boolean notFailed = false; |
1578 |
0 |
int tries = 0; |
1579 |
0 |
while (!notFailed && tries < 10) |
1580 |
|
{ |
1581 |
0 |
if (tries > 0) |
1582 |
|
{ |
1583 |
0 |
jalview.bin.Console |
1584 |
|
.errPrintln("LiveConnect request thread going to sleep."); |
1585 |
|
} |
1586 |
0 |
try |
1587 |
|
{ |
1588 |
0 |
Thread.sleep(700 * (1 + tries)); |
1589 |
|
} catch (InterruptedException q) |
1590 |
|
{ |
1591 |
|
} |
1592 |
0 |
; |
1593 |
0 |
if (tries++ > 0) |
1594 |
|
{ |
1595 |
0 |
jalview.bin.Console |
1596 |
|
.errPrintln("LiveConnect request thread woken up."); |
1597 |
|
} |
1598 |
0 |
try |
1599 |
|
{ |
1600 |
0 |
JSObject scriptObject = JSObject.getWindow(this); |
1601 |
0 |
if (scriptObject.eval("navigator") != null) |
1602 |
|
{ |
1603 |
0 |
notFailed = true; |
1604 |
|
} |
1605 |
|
} catch (Exception jsex) |
1606 |
|
{ |
1607 |
0 |
jalview.bin.Console.errPrintln("Attempt " + tries |
1608 |
|
+ " to access LiveConnect javascript failed."); |
1609 |
|
} |
1610 |
|
} |
1611 |
|
} |
1612 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 6 |
Complexity Density: 0.38 |
|
1613 |
0 |
private void callInitCallback()... |
1614 |
|
{ |
1615 |
0 |
String initjscallback = getParameter("oninit"); |
1616 |
0 |
if (initjscallback == null) |
1617 |
|
{ |
1618 |
0 |
return; |
1619 |
|
} |
1620 |
0 |
initjscallback = initjscallback.trim(); |
1621 |
0 |
if (initjscallback.length() > 0) |
1622 |
|
{ |
1623 |
0 |
JSObject scriptObject = null; |
1624 |
0 |
try |
1625 |
|
{ |
1626 |
0 |
scriptObject = JSObject.getWindow(this); |
1627 |
|
} catch (Exception ex) |
1628 |
|
{ |
1629 |
|
} |
1630 |
0 |
; |
1631 |
|
|
1632 |
0 |
initLiveConnect(); |
1633 |
|
|
1634 |
0 |
if (scriptObject != null) |
1635 |
|
{ |
1636 |
0 |
try |
1637 |
|
{ |
1638 |
|
|
1639 |
0 |
new JSFunctionExec(this).executeJavascriptFunction(true, |
1640 |
|
initjscallback, null, |
1641 |
|
"Calling oninit callback '" + initjscallback + "'."); |
1642 |
|
} catch (Exception e) |
1643 |
|
{ |
1644 |
0 |
jalview.bin.Console |
1645 |
|
.errPrintln("Exception when executing _oninit callback '" |
1646 |
|
+ initjscallback + "'."); |
1647 |
0 |
e.printStackTrace(); |
1648 |
|
} |
1649 |
|
} |
1650 |
|
else |
1651 |
|
{ |
1652 |
0 |
jalview.bin.Console.errPrintln("Not executing _oninit callback '" |
1653 |
|
+ initjscallback + "' - no scripting allowed."); |
1654 |
|
} |
1655 |
|
} |
1656 |
|
} |
1657 |
|
|
1658 |
|
|
1659 |
|
|
1660 |
|
|
1661 |
|
@param |
1662 |
|
|
1663 |
|
@param |
1664 |
|
|
1665 |
|
@param |
1666 |
|
|
1667 |
|
@param |
1668 |
|
|
1669 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
1670 |
0 |
public static void addFrame(final Frame frame, String title, int width,... |
1671 |
|
int height) |
1672 |
|
{ |
1673 |
0 |
frame.setLocation(lastFrameX, lastFrameY); |
1674 |
0 |
lastFrameX += 40; |
1675 |
0 |
lastFrameY += 40; |
1676 |
0 |
frame.setSize(width, height); |
1677 |
0 |
frame.setTitle(title); |
1678 |
0 |
frame.addWindowListener(new WindowAdapter() |
1679 |
|
{ |
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
1680 |
0 |
@Override... |
1681 |
|
public void windowClosing(WindowEvent e) |
1682 |
|
{ |
1683 |
0 |
if (frame instanceof AlignFrame) |
1684 |
|
{ |
1685 |
0 |
AlignViewport vp = ((AlignFrame) frame).viewport; |
1686 |
0 |
((AlignFrame) frame).closeMenuItem_actionPerformed(); |
1687 |
0 |
if (vp.applet.currentAlignFrame == frame) |
1688 |
|
{ |
1689 |
0 |
vp.applet.currentAlignFrame = null; |
1690 |
|
} |
1691 |
0 |
vp.applet = null; |
1692 |
0 |
vp = null; |
1693 |
|
|
1694 |
|
} |
1695 |
0 |
lastFrameX -= 40; |
1696 |
0 |
lastFrameY -= 40; |
1697 |
0 |
if (frame instanceof EmbmenuFrame) |
1698 |
|
{ |
1699 |
0 |
((EmbmenuFrame) frame).destroyMenus(); |
1700 |
|
} |
1701 |
0 |
frame.setMenuBar(null); |
1702 |
0 |
frame.dispose(); |
1703 |
|
} |
1704 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
1705 |
0 |
@Override... |
1706 |
|
public void windowActivated(WindowEvent e) |
1707 |
|
{ |
1708 |
0 |
if (frame instanceof AlignFrame) |
1709 |
|
{ |
1710 |
0 |
((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame; |
1711 |
0 |
if (debug) |
1712 |
|
{ |
1713 |
0 |
jalview.bin.Console.errPrintln("Activated window " + frame); |
1714 |
|
} |
1715 |
|
} |
1716 |
|
|
1717 |
0 |
super.windowActivated(e); |
1718 |
|
} |
1719 |
|
|
1720 |
|
|
1721 |
|
|
1722 |
|
@see |
1723 |
|
|
1724 |
|
|
1725 |
|
|
1726 |
|
|
1727 |
|
|
1728 |
|
|
1729 |
|
|
1730 |
|
|
1731 |
|
}); |
1732 |
0 |
frame.setVisible(true); |
1733 |
|
} |
1734 |
|
|
1735 |
|
|
1736 |
|
|
1737 |
|
|
1738 |
|
|
1739 |
|
|
1740 |
|
@param |
1741 |
|
|
1742 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
1743 |
0 |
@Override... |
1744 |
|
public void paint(Graphics g) |
1745 |
|
{ |
1746 |
0 |
if (!fileFound) |
1747 |
|
{ |
1748 |
0 |
g.setColor(new Color(200, 200, 200)); |
1749 |
0 |
g.setColor(Color.cyan); |
1750 |
0 |
g.fillRect(0, 0, getSize().width, getSize().height); |
1751 |
0 |
g.setColor(Color.red); |
1752 |
0 |
g.drawString( |
1753 |
|
MessageManager.getString("label.jalview_cannot_open_file"), 5, |
1754 |
|
15); |
1755 |
0 |
g.drawString("\"" + file + "\"", 5, 30); |
1756 |
|
} |
1757 |
0 |
else if (embedded) |
1758 |
|
{ |
1759 |
0 |
g.setColor(Color.black); |
1760 |
0 |
g.setFont(new Font("Arial", Font.BOLD, 24)); |
1761 |
0 |
g.drawString(MessageManager.getString("label.jalview_applet"), 50, |
1762 |
|
getSize().height / 2 - 30); |
1763 |
0 |
g.drawString(MessageManager.getString("label.loading_data") + "...", |
1764 |
|
50, getSize().height / 2); |
1765 |
|
} |
1766 |
|
} |
1767 |
|
|
1768 |
|
|
1769 |
|
|
1770 |
|
|
1771 |
|
@param |
1772 |
|
@return |
1773 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1774 |
0 |
public Vector getAppletWindow(Class class1)... |
1775 |
|
{ |
1776 |
0 |
Vector wnds = new Vector(); |
1777 |
0 |
Component[] cmp = getComponents(); |
1778 |
0 |
if (cmp != null) |
1779 |
|
{ |
1780 |
0 |
for (int i = 0; i < cmp.length; i++) |
1781 |
|
{ |
1782 |
0 |
if (class1.isAssignableFrom(cmp[i].getClass())) |
1783 |
|
{ |
1784 |
0 |
wnds.addElement(cmp); |
1785 |
|
} |
1786 |
|
} |
1787 |
|
} |
1788 |
0 |
return wnds; |
1789 |
|
} |
1790 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 9 |
Complexity Density: 0.56 |
|
1791 |
|
class LoadJmolThread extends Thread |
1792 |
|
{ |
1793 |
|
private boolean running = false; |
1794 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 8 |
Complexity Density: 0.53 |
|
1795 |
0 |
@Override... |
1796 |
|
public void run() |
1797 |
|
{ |
1798 |
0 |
if (running || checkedForJmol) |
1799 |
|
{ |
1800 |
0 |
return; |
1801 |
|
} |
1802 |
0 |
running = true; |
1803 |
0 |
if (checkForJmol) |
1804 |
|
{ |
1805 |
0 |
try |
1806 |
|
{ |
1807 |
0 |
if (!System.getProperty("java.version").startsWith("1.1")) |
1808 |
|
{ |
1809 |
0 |
Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter"); |
1810 |
0 |
jmolAvailable = true; |
1811 |
|
} |
1812 |
0 |
if (!jmolAvailable) |
1813 |
|
{ |
1814 |
0 |
jalview.bin.Console.outPrintln( |
1815 |
|
"Jmol not available - Using mc_view for structures"); |
1816 |
|
} |
1817 |
|
} catch (java.lang.ClassNotFoundException ex) |
1818 |
|
{ |
1819 |
|
} |
1820 |
|
} |
1821 |
|
else |
1822 |
|
{ |
1823 |
0 |
jmolAvailable = false; |
1824 |
0 |
if (debug) |
1825 |
|
{ |
1826 |
0 |
jalview.bin.Console.errPrintln( |
1827 |
|
"Skipping Jmol check. Will use mc_view (probably)"); |
1828 |
|
} |
1829 |
|
} |
1830 |
0 |
checkedForJmol = true; |
1831 |
0 |
running = false; |
1832 |
|
} |
1833 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1834 |
0 |
public boolean notFinished()... |
1835 |
|
{ |
1836 |
0 |
return running || !checkedForJmol; |
1837 |
|
} |
1838 |
|
} |
1839 |
|
|
|
|
| 0% |
Uncovered Elements: 355 (355) |
Complexity: 81 |
Complexity Density: 0.35 |
|
1840 |
|
class LoadingThread extends Thread |
1841 |
|
{ |
1842 |
|
|
1843 |
|
|
1844 |
|
|
1845 |
|
DataSourceType protocol; |
1846 |
|
|
1847 |
|
String _file; |
1848 |
|
|
1849 |
|
String _file2; |
1850 |
|
|
1851 |
|
JalviewLite applet; |
1852 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1853 |
0 |
private void dbgMsg(String msg)... |
1854 |
|
{ |
1855 |
0 |
if (JalviewLite.debug) |
1856 |
|
{ |
1857 |
0 |
jalview.bin.Console.errPrintln(msg); |
1858 |
|
} |
1859 |
|
} |
1860 |
|
|
1861 |
|
|
1862 |
|
|
1863 |
|
|
1864 |
|
|
1865 |
|
@param |
1866 |
|
@return |
1867 |
|
|
|
|
| 0% |
Uncovered Elements: 37 (37) |
Complexity: 9 |
Complexity Density: 0.39 |
|
1868 |
0 |
public String resolveFileProtocol(String path)... |
1869 |
|
{ |
1870 |
|
|
1871 |
|
|
1872 |
|
|
1873 |
0 |
if (path.startsWith("PASTE")) |
1874 |
|
{ |
1875 |
0 |
protocol = DataSourceType.PASTE; |
1876 |
0 |
return path.substring(5); |
1877 |
|
} |
1878 |
|
|
1879 |
|
|
1880 |
|
|
1881 |
|
|
1882 |
0 |
if (path.indexOf("://") != -1) |
1883 |
|
{ |
1884 |
0 |
protocol = DataSourceType.URL; |
1885 |
0 |
return path; |
1886 |
|
} |
1887 |
|
|
1888 |
|
|
1889 |
|
|
1890 |
|
|
1891 |
0 |
URL documentBase = getDocumentBase(); |
1892 |
0 |
String withDocBase = resolveUrlForLocalOrAbsolute(path, documentBase); |
1893 |
0 |
if (HttpUtils.isValidUrl(withDocBase)) |
1894 |
|
{ |
1895 |
0 |
if (debug) |
1896 |
|
{ |
1897 |
0 |
jalview.bin.Console.errPrintln("Prepended document base '" |
1898 |
|
+ documentBase + "' to make: '" + withDocBase + "'"); |
1899 |
|
} |
1900 |
0 |
protocol = DataSourceType.URL; |
1901 |
0 |
return withDocBase; |
1902 |
|
} |
1903 |
|
|
1904 |
|
|
1905 |
|
|
1906 |
|
|
1907 |
0 |
URL codeBase = getCodeBase(); |
1908 |
0 |
String withCodeBase = applet.resolveUrlForLocalOrAbsolute(path, |
1909 |
|
codeBase); |
1910 |
0 |
if (!withCodeBase.equals(withDocBase) |
1911 |
|
&& HttpUtils.isValidUrl(withCodeBase)) |
1912 |
|
{ |
1913 |
0 |
protocol = DataSourceType.URL; |
1914 |
0 |
if (debug) |
1915 |
|
{ |
1916 |
0 |
jalview.bin.Console.errPrintln("Prepended codebase '" + codeBase |
1917 |
|
+ "' to make: '" + withCodeBase + "'"); |
1918 |
|
} |
1919 |
0 |
return withCodeBase; |
1920 |
|
} |
1921 |
|
|
1922 |
|
|
1923 |
|
|
1924 |
|
|
1925 |
|
|
1926 |
0 |
if (inArchive(path)) |
1927 |
|
{ |
1928 |
0 |
protocol = DataSourceType.CLASSLOADER; |
1929 |
|
} |
1930 |
0 |
return path; |
1931 |
|
} |
1932 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1933 |
0 |
public LoadingThread(String file, String file2, JalviewLite _applet)... |
1934 |
|
{ |
1935 |
0 |
this._file = file; |
1936 |
0 |
this._file2 = file2; |
1937 |
0 |
applet = _applet; |
1938 |
|
} |
1939 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1940 |
0 |
@Override... |
1941 |
|
public void run() |
1942 |
|
{ |
1943 |
0 |
LoadJmolThread jmolchecker = new LoadJmolThread(); |
1944 |
0 |
jmolchecker.start(); |
1945 |
0 |
while (jmolchecker.notFinished()) |
1946 |
|
{ |
1947 |
|
|
1948 |
0 |
try |
1949 |
|
{ |
1950 |
0 |
Thread.sleep(2); |
1951 |
|
} catch (Exception e) |
1952 |
|
{ |
1953 |
|
} |
1954 |
|
} |
1955 |
0 |
startLoading(); |
1956 |
|
|
1957 |
|
} |
1958 |
|
|
1959 |
|
|
1960 |
|
|
1961 |
|
|
1962 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 2 |
Complexity Density: 0.12 |
|
1963 |
0 |
private void startLoading()... |
1964 |
|
{ |
1965 |
0 |
dbgMsg("Loading thread started with:\n>>file\n" + _file |
1966 |
|
+ ">>endfile"); |
1967 |
|
|
1968 |
0 |
dbgMsg("Loading started."); |
1969 |
|
|
1970 |
0 |
AlignFrame newAlignFrame = readAlignment(_file); |
1971 |
0 |
AlignFrame newAlignFrame2 = readAlignment(_file2); |
1972 |
0 |
if (newAlignFrame != null) |
1973 |
|
{ |
1974 |
0 |
addToDisplay(newAlignFrame, newAlignFrame2); |
1975 |
0 |
loadTree(newAlignFrame); |
1976 |
|
|
1977 |
0 |
loadScoreFile(newAlignFrame); |
1978 |
|
|
1979 |
0 |
loadFeatures(newAlignFrame); |
1980 |
|
|
1981 |
0 |
loadAnnotations(newAlignFrame); |
1982 |
|
|
1983 |
0 |
loadJnetFile(newAlignFrame); |
1984 |
|
|
1985 |
0 |
loadPdbFiles(newAlignFrame); |
1986 |
|
} |
1987 |
|
else |
1988 |
|
{ |
1989 |
0 |
fileFound = false; |
1990 |
0 |
applet.remove(launcher); |
1991 |
0 |
applet.repaint(); |
1992 |
|
} |
1993 |
0 |
callInitCallback(); |
1994 |
|
} |
1995 |
|
|
1996 |
|
|
1997 |
|
|
1998 |
|
|
1999 |
|
@param |
2000 |
|
@param |
2001 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0.46 |
|
2002 |
0 |
public void addToDisplay(AlignFrame af, AlignFrame af2)... |
2003 |
|
{ |
2004 |
0 |
if (af2 != null) |
2005 |
|
{ |
2006 |
0 |
AlignmentI al1 = af.viewport.getAlignment(); |
2007 |
0 |
AlignmentI al2 = af2.viewport.getAlignment(); |
2008 |
0 |
AlignmentI cdna = al1.isNucleotide() ? al1 : al2; |
2009 |
0 |
AlignmentI prot = al1.isNucleotide() ? al2 : al1; |
2010 |
0 |
if (AlignmentUtils.mapProteinAlignmentToCdna(prot, cdna)) |
2011 |
|
{ |
2012 |
0 |
al2.alignAs(al1); |
2013 |
0 |
SplitFrame sf = new SplitFrame(af, af2); |
2014 |
0 |
sf.addToDisplay(embedded, JalviewLite.this); |
2015 |
0 |
return; |
2016 |
|
} |
2017 |
|
else |
2018 |
|
{ |
2019 |
0 |
String msg = "Could not map any sequence in " + af2.getTitle() |
2020 |
|
+ " as " |
2021 |
0 |
+ (al1.isNucleotide() ? "protein product" : "cDNA") |
2022 |
|
+ " for " + af.getTitle(); |
2023 |
0 |
jalview.bin.Console.errPrintln(msg); |
2024 |
|
} |
2025 |
|
} |
2026 |
|
|
2027 |
0 |
af.addToDisplay(embedded); |
2028 |
|
} |
2029 |
|
|
2030 |
|
|
2031 |
|
|
2032 |
|
|
2033 |
|
|
2034 |
|
@return |
2035 |
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 10 |
Complexity Density: 0.3 |
|
2036 |
0 |
protected AlignFrame readAlignment(String fileParam)... |
2037 |
|
{ |
2038 |
0 |
if (fileParam == null) |
2039 |
|
{ |
2040 |
0 |
return null; |
2041 |
|
} |
2042 |
0 |
String resolvedFile = resolveFileProtocol(fileParam); |
2043 |
0 |
AlignmentI al = null; |
2044 |
0 |
try |
2045 |
|
{ |
2046 |
0 |
FileFormatI format = new IdentifyFile().identify(resolvedFile, |
2047 |
|
protocol); |
2048 |
0 |
dbgMsg("File identified as '" + format + "'"); |
2049 |
0 |
al = new AppletFormatAdapter().readFile(resolvedFile, protocol, |
2050 |
|
format); |
2051 |
0 |
if ((al != null) && (al.getHeight() > 0)) |
2052 |
|
{ |
2053 |
0 |
dbgMsg("Successfully loaded file."); |
2054 |
0 |
al.setDataset(null); |
2055 |
0 |
AlignFrame newAlignFrame = new AlignFrame(al, applet, |
2056 |
|
resolvedFile, embedded, false); |
2057 |
0 |
newAlignFrame.setTitle(resolvedFile); |
2058 |
0 |
if (initialAlignFrame == null) |
2059 |
|
{ |
2060 |
0 |
initialAlignFrame = newAlignFrame; |
2061 |
|
} |
2062 |
|
|
2063 |
0 |
currentAlignFrame = newAlignFrame; |
2064 |
|
|
2065 |
0 |
if (protocol == DataSourceType.PASTE) |
2066 |
|
{ |
2067 |
0 |
newAlignFrame.setTitle(MessageManager |
2068 |
|
.formatMessage("label.sequences_from", new Object[] |
2069 |
|
{ applet.getDocumentBase().toString() })); |
2070 |
|
} |
2071 |
|
|
2072 |
0 |
newAlignFrame.statusBar.setText(MessageManager.formatMessage( |
2073 |
|
"label.successfully_loaded_file", new Object[] |
2074 |
|
{ resolvedFile })); |
2075 |
|
|
2076 |
0 |
return newAlignFrame; |
2077 |
|
} |
2078 |
|
} catch (java.io.IOException ex) |
2079 |
|
{ |
2080 |
0 |
dbgMsg("File load exception."); |
2081 |
0 |
ex.printStackTrace(); |
2082 |
0 |
if (debug) |
2083 |
|
{ |
2084 |
0 |
try |
2085 |
|
{ |
2086 |
0 |
FileParse fp = new FileParse(resolvedFile, protocol); |
2087 |
0 |
String ln = null; |
2088 |
0 |
dbgMsg(">>>Dumping contents of '" + resolvedFile + "' " + "(" |
2089 |
|
+ protocol + ")"); |
2090 |
0 |
while ((ln = fp.nextLine()) != null) |
2091 |
|
{ |
2092 |
0 |
dbgMsg(ln); |
2093 |
|
} |
2094 |
0 |
dbgMsg(">>>Dump finished."); |
2095 |
|
} catch (Exception e) |
2096 |
|
{ |
2097 |
0 |
jalview.bin.Console.errPrintln( |
2098 |
|
"Exception when trying to dump the content of the file parameter."); |
2099 |
0 |
e.printStackTrace(); |
2100 |
|
} |
2101 |
|
} |
2102 |
|
} |
2103 |
0 |
return null; |
2104 |
|
} |
2105 |
|
|
2106 |
|
|
2107 |
|
|
2108 |
|
|
2109 |
|
|
2110 |
|
@param |
2111 |
|
@return |
2112 |
|
|
|
|
| 0% |
Uncovered Elements: 96 (96) |
Complexity: 20 |
Complexity Density: 0.33 |
|
2113 |
0 |
protected boolean loadPdbFiles(AlignFrame alignFrame)... |
2114 |
|
{ |
2115 |
0 |
boolean result = false; |
2116 |
|
|
2117 |
|
|
2118 |
|
|
2119 |
|
|
2120 |
|
|
2121 |
0 |
applet.setAlignPdbStructures( |
2122 |
|
getDefaultParameter("alignpdbfiles", false)); |
2123 |
|
|
2124 |
|
|
2125 |
|
|
2126 |
|
|
2127 |
|
|
2128 |
|
|
2129 |
|
|
2130 |
|
|
2131 |
|
|
2132 |
0 |
int pdbFileCount = 0; |
2133 |
|
|
2134 |
|
|
2135 |
0 |
Vector pdbs = new Vector(); |
2136 |
|
|
2137 |
0 |
jalview.analysis.SequenceIdMatcher matcher = (applet |
2138 |
|
.getDefaultParameter("relaxedidmatch", false)) |
2139 |
|
? new jalview.analysis.SequenceIdMatcher( |
2140 |
|
alignFrame.getAlignViewport().getAlignment() |
2141 |
|
.getSequencesArray()) |
2142 |
|
: null; |
2143 |
|
|
2144 |
0 |
String param; |
2145 |
0 |
do |
2146 |
|
{ |
2147 |
0 |
if (pdbFileCount > 0) |
2148 |
|
{ |
2149 |
0 |
param = applet.getParameter("PDBFILE" + pdbFileCount); |
2150 |
|
} |
2151 |
|
else |
2152 |
|
{ |
2153 |
0 |
param = applet.getParameter("PDBFILE"); |
2154 |
|
} |
2155 |
|
|
2156 |
0 |
if (param != null) |
2157 |
|
{ |
2158 |
0 |
PDBEntry pdb = new PDBEntry(); |
2159 |
|
|
2160 |
0 |
String seqstring; |
2161 |
0 |
SequenceI[] seqs = null; |
2162 |
0 |
String[] chains = null; |
2163 |
|
|
2164 |
0 |
StringTokenizer st = new StringTokenizer(param, " "); |
2165 |
|
|
2166 |
0 |
if (st.countTokens() < 2) |
2167 |
|
{ |
2168 |
0 |
String sequence = applet.getParameter("PDBSEQ"); |
2169 |
0 |
if (sequence != null) |
2170 |
|
{ |
2171 |
0 |
seqs = new SequenceI[] { matcher == null |
2172 |
|
? (Sequence) alignFrame.getAlignViewport() |
2173 |
|
.getAlignment().findName(sequence) |
2174 |
|
: matcher.findIdMatch(sequence) }; |
2175 |
|
} |
2176 |
|
|
2177 |
|
} |
2178 |
|
else |
2179 |
|
{ |
2180 |
0 |
param = st.nextToken(); |
2181 |
0 |
List<SequenceI> tmp = new ArrayList<>(); |
2182 |
0 |
List<String> tmp2 = new ArrayList<>(); |
2183 |
|
|
2184 |
0 |
while (st.hasMoreTokens()) |
2185 |
|
{ |
2186 |
0 |
seqstring = st.nextToken(); |
2187 |
0 |
StringTokenizer st2 = new StringTokenizer(seqstring, "="); |
2188 |
0 |
if (st2.countTokens() > 1) |
2189 |
|
{ |
2190 |
|
|
2191 |
0 |
tmp2.add(st2.nextToken()); |
2192 |
0 |
seqstring = st2.nextToken(); |
2193 |
|
} |
2194 |
0 |
tmp.add(matcher == null |
2195 |
|
? (Sequence) alignFrame.getAlignViewport() |
2196 |
|
.getAlignment().findName(seqstring) |
2197 |
|
: matcher.findIdMatch(seqstring)); |
2198 |
|
} |
2199 |
|
|
2200 |
0 |
seqs = tmp.toArray(new SequenceI[tmp.size()]); |
2201 |
0 |
if (tmp2.size() == tmp.size()) |
2202 |
|
{ |
2203 |
0 |
chains = tmp2.toArray(new String[tmp2.size()]); |
2204 |
|
} |
2205 |
|
} |
2206 |
0 |
param = resolveFileProtocol(param); |
2207 |
|
|
2208 |
0 |
pdb.setFile(param); |
2209 |
|
|
2210 |
0 |
if (seqs != null) |
2211 |
|
{ |
2212 |
0 |
for (int i = 0; i < seqs.length; i++) |
2213 |
|
{ |
2214 |
0 |
if (seqs[i] != null) |
2215 |
|
{ |
2216 |
0 |
((Sequence) seqs[i]).addPDBId(pdb); |
2217 |
0 |
StructureSelectionManager |
2218 |
|
.getStructureSelectionManager(applet) |
2219 |
|
.registerPDBEntry(pdb); |
2220 |
|
} |
2221 |
|
else |
2222 |
|
{ |
2223 |
0 |
if (JalviewLite.debug) |
2224 |
|
{ |
2225 |
|
|
2226 |
|
|
2227 |
0 |
jalview.bin.Console.errPrintln( |
2228 |
|
"Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence " |
2229 |
|
+ i + ")"); |
2230 |
|
} |
2231 |
|
} |
2232 |
|
} |
2233 |
|
|
2234 |
0 |
if (!alignPdbStructures) |
2235 |
|
{ |
2236 |
0 |
alignFrame.newStructureView(applet, pdb, seqs, chains, |
2237 |
|
protocol); |
2238 |
|
} |
2239 |
|
else |
2240 |
|
{ |
2241 |
0 |
pdbs.addElement(new Object[] { pdb, seqs, chains, protocol }); |
2242 |
|
} |
2243 |
|
} |
2244 |
|
} |
2245 |
|
|
2246 |
0 |
pdbFileCount++; |
2247 |
0 |
} while (param != null || pdbFileCount < 10); |
2248 |
0 |
if (pdbs.size() > 0) |
2249 |
|
{ |
2250 |
0 |
SequenceI[][] seqs = new SequenceI[pdbs.size()][]; |
2251 |
0 |
PDBEntry[] pdb = new PDBEntry[pdbs.size()]; |
2252 |
0 |
String[][] chains = new String[pdbs.size()][]; |
2253 |
0 |
String[] protocols = new String[pdbs.size()]; |
2254 |
0 |
for (int pdbsi = 0, pdbsiSize = pdbs |
2255 |
0 |
.size(); pdbsi < pdbsiSize; pdbsi++) |
2256 |
|
{ |
2257 |
0 |
Object[] o = (Object[]) pdbs.elementAt(pdbsi); |
2258 |
0 |
pdb[pdbsi] = (PDBEntry) o[0]; |
2259 |
0 |
seqs[pdbsi] = (SequenceI[]) o[1]; |
2260 |
0 |
chains[pdbsi] = (String[]) o[2]; |
2261 |
0 |
protocols[pdbsi] = (String) o[3]; |
2262 |
|
} |
2263 |
0 |
alignFrame.alignedStructureView(applet, pdb, seqs, chains, |
2264 |
|
protocols); |
2265 |
0 |
result = true; |
2266 |
|
} |
2267 |
0 |
return result; |
2268 |
|
} |
2269 |
|
|
2270 |
|
|
2271 |
|
|
2272 |
|
|
2273 |
|
|
2274 |
|
@param |
2275 |
|
@return |
2276 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.27 |
|
2277 |
0 |
protected boolean loadJnetFile(AlignFrame alignFrame)... |
2278 |
|
{ |
2279 |
0 |
boolean result = false; |
2280 |
0 |
String param = applet.getParameter("jnetfile"); |
2281 |
0 |
if (param == null) |
2282 |
|
{ |
2283 |
|
|
2284 |
0 |
param = applet.getParameter("jpredfile"); |
2285 |
|
} |
2286 |
0 |
if (param != null) |
2287 |
|
{ |
2288 |
0 |
try |
2289 |
|
{ |
2290 |
0 |
param = resolveFileProtocol(param); |
2291 |
0 |
JPredFile predictions = new JPredFile(param, protocol); |
2292 |
0 |
JnetAnnotationMaker.add_annotation(predictions, |
2293 |
|
alignFrame.viewport.getAlignment(), 0, false); |
2294 |
|
|
2295 |
|
|
2296 |
0 |
alignFrame.viewport.getAlignment().setupJPredAlignment(); |
2297 |
|
|
2298 |
0 |
alignFrame.alignPanel.fontChanged(); |
2299 |
0 |
alignFrame.alignPanel.setScrollValues(0, 0); |
2300 |
0 |
result = true; |
2301 |
|
} catch (Exception ex) |
2302 |
|
{ |
2303 |
0 |
ex.printStackTrace(); |
2304 |
|
} |
2305 |
|
} |
2306 |
0 |
return result; |
2307 |
|
} |
2308 |
|
|
2309 |
|
|
2310 |
|
|
2311 |
|
|
2312 |
|
|
2313 |
|
@param |
2314 |
|
@return |
2315 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
2316 |
0 |
protected boolean loadAnnotations(AlignFrame alignFrame)... |
2317 |
|
{ |
2318 |
0 |
boolean result = false; |
2319 |
0 |
String param = applet.getParameter("annotations"); |
2320 |
0 |
if (param != null) |
2321 |
|
{ |
2322 |
0 |
param = resolveFileProtocol(param); |
2323 |
|
|
2324 |
0 |
if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport, |
2325 |
|
param, protocol)) |
2326 |
|
{ |
2327 |
0 |
alignFrame.alignPanel.fontChanged(); |
2328 |
0 |
alignFrame.alignPanel.setScrollValues(0, 0); |
2329 |
0 |
result = true; |
2330 |
|
} |
2331 |
|
else |
2332 |
|
{ |
2333 |
0 |
jalview.bin.Console.errPrintln( |
2334 |
|
"Annotations were not added from annotation file '" |
2335 |
|
+ param + "'"); |
2336 |
|
} |
2337 |
|
} |
2338 |
0 |
return result; |
2339 |
|
} |
2340 |
|
|
2341 |
|
|
2342 |
|
|
2343 |
|
|
2344 |
|
|
2345 |
|
@param |
2346 |
|
@return |
2347 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 6 |
Complexity Density: 0.38 |
|
2348 |
0 |
protected boolean loadFeatures(AlignFrame alignFrame)... |
2349 |
|
{ |
2350 |
0 |
boolean result = false; |
2351 |
|
|
2352 |
|
|
2353 |
|
|
2354 |
|
|
2355 |
|
|
2356 |
|
|
2357 |
|
|
2358 |
0 |
String param = applet.getParameter("hidefeaturegroups"); |
2359 |
0 |
if (param != null) |
2360 |
|
{ |
2361 |
0 |
alignFrame.setFeatureGroupState(separatorListToArray(param), false); |
2362 |
|
|
2363 |
|
} |
2364 |
|
|
2365 |
0 |
param = applet.getParameter("showfeaturegroups"); |
2366 |
0 |
if (param != null) |
2367 |
|
{ |
2368 |
0 |
alignFrame.setFeatureGroupState(separatorListToArray(param), true); |
2369 |
|
|
2370 |
|
} |
2371 |
|
|
2372 |
0 |
param = applet.getParameter("features"); |
2373 |
0 |
if (param != null) |
2374 |
|
{ |
2375 |
0 |
param = resolveFileProtocol(param); |
2376 |
|
|
2377 |
0 |
result = alignFrame.parseFeaturesFile(param, protocol); |
2378 |
|
} |
2379 |
|
|
2380 |
0 |
param = applet.getParameter("showFeatureSettings"); |
2381 |
0 |
if (param != null && param.equalsIgnoreCase(TRUE)) |
2382 |
|
{ |
2383 |
0 |
alignFrame.viewport.setShowSequenceFeatures(true); |
2384 |
0 |
new FeatureSettings(alignFrame.alignPanel); |
2385 |
|
} |
2386 |
0 |
return result; |
2387 |
|
} |
2388 |
|
|
2389 |
|
|
2390 |
|
|
2391 |
|
|
2392 |
|
|
2393 |
|
@param |
2394 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 6 |
Complexity Density: 0.55 |
|
2395 |
0 |
protected boolean loadScoreFile(AlignFrame alignFrame)... |
2396 |
|
{ |
2397 |
0 |
boolean result = false; |
2398 |
0 |
String sScoreFile = applet.getParameter("scoreFile"); |
2399 |
0 |
if (sScoreFile != null && !"".equals(sScoreFile)) |
2400 |
|
{ |
2401 |
0 |
try |
2402 |
|
{ |
2403 |
0 |
if (debug) |
2404 |
|
{ |
2405 |
0 |
jalview.bin.Console.errPrintln( |
2406 |
|
"Attempting to load T-COFFEE score file from the scoreFile parameter"); |
2407 |
|
} |
2408 |
0 |
result = alignFrame.loadScoreFile(sScoreFile); |
2409 |
0 |
if (!result) |
2410 |
|
{ |
2411 |
0 |
jalview.bin.Console.errPrintln( |
2412 |
|
"Failed to parse T-COFFEE parameter as a valid score file ('" |
2413 |
|
+ sScoreFile + "')"); |
2414 |
|
} |
2415 |
|
} catch (Exception e) |
2416 |
|
{ |
2417 |
0 |
System.err.printf("Cannot read score file: '%s'. Cause: %s \n", |
2418 |
|
sScoreFile, e.getMessage()); |
2419 |
|
} |
2420 |
|
} |
2421 |
0 |
return result; |
2422 |
|
} |
2423 |
|
|
2424 |
|
|
2425 |
|
|
2426 |
|
|
2427 |
|
|
2428 |
|
@param |
2429 |
|
@return |
2430 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 5 |
Complexity Density: 0.31 |
|
2431 |
0 |
protected boolean loadTree(AlignFrame alignFrame)... |
2432 |
|
{ |
2433 |
0 |
boolean result = false; |
2434 |
0 |
String treeFile = applet.getParameter("tree"); |
2435 |
0 |
if (treeFile == null) |
2436 |
|
{ |
2437 |
0 |
treeFile = applet.getParameter("treeFile"); |
2438 |
|
} |
2439 |
|
|
2440 |
0 |
if (treeFile != null) |
2441 |
|
{ |
2442 |
0 |
try |
2443 |
|
{ |
2444 |
0 |
treeFile = resolveFileProtocol(treeFile); |
2445 |
0 |
NewickFile fin = new NewickFile(treeFile, protocol); |
2446 |
0 |
fin.parse(); |
2447 |
|
|
2448 |
0 |
if (fin.getTree() != null) |
2449 |
|
{ |
2450 |
0 |
alignFrame.loadTree(fin, treeFile); |
2451 |
0 |
result = true; |
2452 |
0 |
dbgMsg("Successfully imported tree."); |
2453 |
|
} |
2454 |
|
else |
2455 |
|
{ |
2456 |
0 |
dbgMsg("Tree parameter did not resolve to a valid tree."); |
2457 |
|
} |
2458 |
|
} catch (Exception ex) |
2459 |
|
{ |
2460 |
0 |
ex.printStackTrace(); |
2461 |
|
} |
2462 |
|
} |
2463 |
0 |
return result; |
2464 |
|
} |
2465 |
|
|
2466 |
|
|
2467 |
|
|
2468 |
|
|
2469 |
|
@param |
2470 |
|
|
2471 |
|
@return |
2472 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
2473 |
0 |
boolean inArchive(String f)... |
2474 |
|
{ |
2475 |
|
|
2476 |
|
|
2477 |
0 |
try |
2478 |
|
{ |
2479 |
0 |
boolean rtn = (getClass().getResourceAsStream("/" + f) != null); |
2480 |
0 |
if (debug) |
2481 |
|
{ |
2482 |
0 |
jalview.bin.Console.errPrintln("Resource '" + f + "' was " |
2483 |
0 |
+ (rtn ? "" : "not ") + "located by classloader."); |
2484 |
|
} |
2485 |
0 |
return rtn; |
2486 |
|
} catch (Exception ex) |
2487 |
|
{ |
2488 |
0 |
jalview.bin.Console.outPrintln( |
2489 |
|
"Exception checking resources: " + f + " " + ex); |
2490 |
0 |
return false; |
2491 |
|
} |
2492 |
|
} |
2493 |
|
} |
2494 |
|
|
2495 |
|
|
2496 |
|
@return |
2497 |
|
|
2498 |
|
|
2499 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
2500 |
0 |
public AlignFrame getDefaultTargetFrame()... |
2501 |
|
{ |
2502 |
0 |
if (currentAlignFrame != null) |
2503 |
|
{ |
2504 |
0 |
return currentAlignFrame; |
2505 |
|
} |
2506 |
0 |
if (initialAlignFrame != null) |
2507 |
|
{ |
2508 |
0 |
return initialAlignFrame; |
2509 |
|
} |
2510 |
0 |
jalview.bin.Console.errPrintln( |
2511 |
|
"Implementation error: Jalview Applet API cannot work out which AlignFrame to use."); |
2512 |
0 |
return null; |
2513 |
|
} |
2514 |
|
|
2515 |
|
|
2516 |
|
|
2517 |
|
|
2518 |
|
protected String separator = "" + ((char) 0x00AC); |
2519 |
|
|
2520 |
|
|
2521 |
|
|
2522 |
|
|
2523 |
|
|
2524 |
|
|
2525 |
|
public boolean jsfallbackEnabled = false; |
2526 |
|
|
2527 |
|
|
2528 |
|
|
2529 |
|
|
2530 |
|
@param |
2531 |
|
@return |
2532 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2533 |
0 |
public String[] separatorListToArray(String list)... |
2534 |
|
{ |
2535 |
0 |
return separatorListToArray(list, separator); |
2536 |
|
} |
2537 |
|
|
2538 |
|
|
2539 |
|
|
2540 |
|
|
2541 |
|
@param |
2542 |
|
@param |
2543 |
|
@return |
2544 |
|
|
|
|
| 0% |
Uncovered Elements: 43 (43) |
Complexity: 12 |
Complexity Density: 0.48 |
|
2545 |
0 |
public static String[] separatorListToArray(String list, String separator)... |
2546 |
|
{ |
2547 |
|
|
2548 |
0 |
int seplen = separator.length(); |
2549 |
0 |
if (list == null || list.equals("") || list.equals(separator)) |
2550 |
|
{ |
2551 |
0 |
return null; |
2552 |
|
} |
2553 |
0 |
java.util.Vector jv = new Vector(); |
2554 |
0 |
int cp = 0, pos; |
2555 |
0 |
while ((pos = list.indexOf(separator, cp)) > cp) |
2556 |
|
{ |
2557 |
0 |
jv.addElement(list.substring(cp, pos)); |
2558 |
0 |
cp = pos + seplen; |
2559 |
|
} |
2560 |
0 |
if (cp < list.length()) |
2561 |
|
{ |
2562 |
0 |
String c = list.substring(cp); |
2563 |
0 |
if (!c.equals(separator)) |
2564 |
|
{ |
2565 |
0 |
jv.addElement(c); |
2566 |
|
} |
2567 |
|
} |
2568 |
0 |
if (jv.size() > 0) |
2569 |
|
{ |
2570 |
0 |
String[] v = new String[jv.size()]; |
2571 |
0 |
for (int i = 0; i < v.length; i++) |
2572 |
|
{ |
2573 |
0 |
v[i] = (String) jv.elementAt(i); |
2574 |
|
} |
2575 |
0 |
jv.removeAllElements(); |
2576 |
0 |
if (debug) |
2577 |
|
{ |
2578 |
0 |
jalview.bin.Console.errPrintln("Array from '" + separator |
2579 |
|
+ "' separated List:\n" + v.length); |
2580 |
0 |
for (int i = 0; i < v.length; i++) |
2581 |
|
{ |
2582 |
0 |
jalview.bin.Console.errPrintln("item " + i + " '" + v[i] + "'"); |
2583 |
|
} |
2584 |
|
} |
2585 |
0 |
return v; |
2586 |
|
} |
2587 |
0 |
if (debug) |
2588 |
|
{ |
2589 |
0 |
jalview.bin.Console.errPrintln( |
2590 |
|
"Empty Array from '" + separator + "' separated List"); |
2591 |
|
} |
2592 |
0 |
return null; |
2593 |
|
} |
2594 |
|
|
2595 |
|
|
2596 |
|
|
2597 |
|
|
2598 |
|
@param |
2599 |
|
@return |
2600 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2601 |
0 |
public String arrayToSeparatorList(String[] list)... |
2602 |
|
{ |
2603 |
0 |
return arrayToSeparatorList(list, separator); |
2604 |
|
} |
2605 |
|
|
2606 |
|
|
2607 |
|
|
2608 |
|
|
2609 |
|
@param |
2610 |
|
@param |
2611 |
|
@return |
2612 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 8 |
Complexity Density: 0.57 |
|
2613 |
0 |
public static String arrayToSeparatorList(String[] list, String separator)... |
2614 |
|
{ |
2615 |
|
|
2616 |
0 |
StringBuffer v = new StringBuffer(); |
2617 |
0 |
if (list != null && list.length > 0) |
2618 |
|
{ |
2619 |
0 |
for (int i = 0, iSize = list.length; i < iSize; i++) |
2620 |
|
{ |
2621 |
0 |
if (list[i] != null) |
2622 |
|
{ |
2623 |
0 |
if (i > 0) |
2624 |
|
{ |
2625 |
0 |
v.append(separator); |
2626 |
|
} |
2627 |
0 |
v.append(list[i]); |
2628 |
|
} |
2629 |
|
} |
2630 |
0 |
if (debug) |
2631 |
|
{ |
2632 |
0 |
System.err |
2633 |
|
.println("Returning '" + separator + "' separated List:\n"); |
2634 |
0 |
jalview.bin.Console.errPrintln(v); |
2635 |
|
} |
2636 |
0 |
return v.toString(); |
2637 |
|
} |
2638 |
0 |
if (debug) |
2639 |
|
{ |
2640 |
0 |
jalview.bin.Console.errPrintln( |
2641 |
|
"Returning empty '" + separator + "' separated List\n"); |
2642 |
|
} |
2643 |
0 |
return "" + separator; |
2644 |
|
} |
2645 |
|
|
2646 |
|
|
2647 |
|
|
2648 |
|
|
2649 |
|
@see |
2650 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2651 |
0 |
@Override... |
2652 |
|
public String getFeatureGroups() |
2653 |
|
{ |
2654 |
0 |
String lst = arrayToSeparatorList( |
2655 |
|
getDefaultTargetFrame().getFeatureGroups()); |
2656 |
0 |
return lst; |
2657 |
|
} |
2658 |
|
|
2659 |
|
|
2660 |
|
|
2661 |
|
|
2662 |
|
@see |
2663 |
|
|
2664 |
|
|
2665 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2666 |
0 |
@Override... |
2667 |
|
public String getFeatureGroupsOn(AlignFrame alf) |
2668 |
|
{ |
2669 |
0 |
String lst = arrayToSeparatorList(alf.getFeatureGroups()); |
2670 |
0 |
return lst; |
2671 |
|
} |
2672 |
|
|
2673 |
|
|
2674 |
|
|
2675 |
|
|
2676 |
|
@see |
2677 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2678 |
0 |
@Override... |
2679 |
|
public String getFeatureGroupsOfState(boolean visible) |
2680 |
|
{ |
2681 |
0 |
return arrayToSeparatorList( |
2682 |
|
getDefaultTargetFrame().getFeatureGroupsOfState(visible)); |
2683 |
|
} |
2684 |
|
|
2685 |
|
|
2686 |
|
|
2687 |
|
|
2688 |
|
@see |
2689 |
|
|
2690 |
|
|
2691 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2692 |
0 |
@Override... |
2693 |
|
public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible) |
2694 |
|
{ |
2695 |
0 |
return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible)); |
2696 |
|
} |
2697 |
|
|
2698 |
|
|
2699 |
|
|
2700 |
|
|
2701 |
|
@see |
2702 |
|
|
2703 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2704 |
0 |
@Override... |
2705 |
|
public void setFeatureGroupStateOn(final AlignFrame alf, |
2706 |
|
final String groups, boolean state) |
2707 |
|
{ |
2708 |
0 |
final boolean st = state; |
2709 |
|
|
2710 |
0 |
java.awt.EventQueue.invokeLater(new Runnable() |
2711 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2712 |
0 |
@Override... |
2713 |
|
public void run() |
2714 |
|
{ |
2715 |
0 |
alf.setFeatureGroupState(separatorListToArray(groups), st); |
2716 |
|
} |
2717 |
|
}); |
2718 |
|
} |
2719 |
|
|
2720 |
|
|
2721 |
|
|
2722 |
|
|
2723 |
|
@see |
2724 |
|
|
2725 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2726 |
0 |
@Override... |
2727 |
|
public void setFeatureGroupState(String groups, boolean state) |
2728 |
|
{ |
2729 |
0 |
setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state); |
2730 |
|
} |
2731 |
|
|
2732 |
|
|
2733 |
|
|
2734 |
|
|
2735 |
|
@see |
2736 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2737 |
0 |
@Override... |
2738 |
|
public String getSeparator() |
2739 |
|
{ |
2740 |
0 |
return separator; |
2741 |
|
} |
2742 |
|
|
2743 |
|
|
2744 |
|
|
2745 |
|
|
2746 |
|
@see |
2747 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
2748 |
0 |
@Override... |
2749 |
|
public void setSeparator(String separator) |
2750 |
|
{ |
2751 |
0 |
if (separator == null || separator.length() < 1) |
2752 |
|
{ |
2753 |
|
|
2754 |
0 |
separator = "" + ((char) 0x00AC); |
2755 |
|
} |
2756 |
0 |
this.separator = separator; |
2757 |
0 |
if (debug) |
2758 |
|
{ |
2759 |
0 |
jalview.bin.Console |
2760 |
|
.errPrintln("Default Separator now: '" + separator + "'"); |
2761 |
|
} |
2762 |
|
} |
2763 |
|
|
2764 |
|
|
2765 |
|
|
2766 |
|
|
2767 |
|
|
2768 |
|
@param |
2769 |
|
|
2770 |
|
@param |
2771 |
|
|
2772 |
|
@return |
2773 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
2774 |
0 |
public boolean getDefaultParameter(String name, boolean def)... |
2775 |
|
{ |
2776 |
0 |
String stn; |
2777 |
0 |
if ((stn = getParameter(name)) == null) |
2778 |
|
{ |
2779 |
0 |
return def; |
2780 |
|
} |
2781 |
0 |
if (TRUE.equalsIgnoreCase(stn)) |
2782 |
|
{ |
2783 |
0 |
return true; |
2784 |
|
} |
2785 |
0 |
return false; |
2786 |
|
} |
2787 |
|
|
2788 |
|
|
2789 |
|
|
2790 |
|
|
2791 |
|
@see |
2792 |
|
|
2793 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2794 |
0 |
@Override... |
2795 |
|
public boolean addPdbFile(AlignFrame alFrame, String sequenceId, |
2796 |
|
String pdbEntryString, String pdbFile) |
2797 |
|
{ |
2798 |
0 |
return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile); |
2799 |
|
} |
2800 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2801 |
0 |
protected void setAlignPdbStructures(boolean alignPdbStructures)... |
2802 |
|
{ |
2803 |
0 |
this.alignPdbStructures = alignPdbStructures; |
2804 |
|
} |
2805 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2806 |
0 |
public boolean isAlignPdbStructures()... |
2807 |
|
{ |
2808 |
0 |
return alignPdbStructures; |
2809 |
|
} |
2810 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
2811 |
0 |
@Override... |
2812 |
|
public void start() |
2813 |
|
{ |
2814 |
|
|
2815 |
|
} |
2816 |
|
|
2817 |
|
private Hashtable<String, long[]> jshashes = new Hashtable<>(); |
2818 |
|
|
2819 |
|
private Hashtable<String, Hashtable<String, String[]>> jsmessages = new Hashtable<>(); |
2820 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
2821 |
0 |
public void setJsMessageSet(String messageclass, String viewId,... |
2822 |
|
String[] colcommands) |
2823 |
|
{ |
2824 |
0 |
Hashtable<String, String[]> msgset = jsmessages.get(messageclass); |
2825 |
0 |
if (msgset == null) |
2826 |
|
{ |
2827 |
0 |
msgset = new Hashtable<>(); |
2828 |
0 |
jsmessages.put(messageclass, msgset); |
2829 |
|
} |
2830 |
0 |
msgset.put(viewId, colcommands); |
2831 |
0 |
long[] l = new long[colcommands.length]; |
2832 |
0 |
for (int i = 0; i < colcommands.length; i++) |
2833 |
|
{ |
2834 |
0 |
l[i] = colcommands[i].hashCode(); |
2835 |
|
} |
2836 |
0 |
jshashes.put(messageclass + "|" + viewId, l); |
2837 |
|
} |
2838 |
|
|
2839 |
|
|
2840 |
|
|
2841 |
|
|
2842 |
|
@see |
2843 |
|
|
2844 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 5 |
Complexity Density: 0.5 |
|
2845 |
0 |
@Override... |
2846 |
|
public String getJsMessage(String messageclass, String viewId) |
2847 |
|
{ |
2848 |
0 |
Hashtable<String, String[]> msgset = jsmessages.get(messageclass); |
2849 |
0 |
if (msgset != null) |
2850 |
|
{ |
2851 |
0 |
String[] msgs = msgset.get(viewId); |
2852 |
0 |
if (msgs != null) |
2853 |
|
{ |
2854 |
0 |
for (int i = 0; i < msgs.length; i++) |
2855 |
|
{ |
2856 |
0 |
if (msgs[i] != null) |
2857 |
|
{ |
2858 |
0 |
String m = msgs[i]; |
2859 |
0 |
msgs[i] = null; |
2860 |
0 |
return m; |
2861 |
|
} |
2862 |
|
} |
2863 |
|
} |
2864 |
|
} |
2865 |
0 |
return ""; |
2866 |
|
} |
2867 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
2868 |
0 |
public boolean isJsMessageSetChanged(String string, String string2,... |
2869 |
|
String[] colcommands) |
2870 |
|
{ |
2871 |
0 |
long[] l = jshashes.get(string + "|" + string2); |
2872 |
0 |
if (l == null && colcommands != null) |
2873 |
|
{ |
2874 |
0 |
return true; |
2875 |
|
} |
2876 |
0 |
for (int i = 0; i < colcommands.length; i++) |
2877 |
|
{ |
2878 |
0 |
if (l[i] != colcommands[i].hashCode()) |
2879 |
|
{ |
2880 |
0 |
return true; |
2881 |
|
} |
2882 |
|
} |
2883 |
0 |
return false; |
2884 |
|
} |
2885 |
|
|
2886 |
|
private Vector jsExecQueue = new Vector(); |
2887 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2888 |
0 |
public Vector getJsExecQueue()... |
2889 |
|
{ |
2890 |
0 |
return jsExecQueue; |
2891 |
|
} |
2892 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2893 |
0 |
public void setExecutor(JSFunctionExec jsFunctionExec2)... |
2894 |
|
{ |
2895 |
0 |
jsFunctionExec = jsFunctionExec2; |
2896 |
|
} |
2897 |
|
|
2898 |
|
|
2899 |
|
|
2900 |
|
|
2901 |
|
|
2902 |
|
@param |
2903 |
|
@param |
2904 |
|
@return |
2905 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
2906 |
0 |
public Color getDefaultColourParameter(String colparam, Color defcolour)... |
2907 |
|
{ |
2908 |
0 |
String colprop = getParameter(colparam); |
2909 |
0 |
if (colprop == null || colprop.trim().length() == 0) |
2910 |
|
{ |
2911 |
0 |
return defcolour; |
2912 |
|
} |
2913 |
0 |
Color col = ColorUtils.parseColourString(colprop); |
2914 |
0 |
if (col == null) |
2915 |
|
{ |
2916 |
0 |
jalview.bin.Console.errPrintln("Couldn't parse '" + colprop |
2917 |
|
+ "' as a colour for " + colparam); |
2918 |
|
} |
2919 |
0 |
return (col == null) ? defcolour : col; |
2920 |
|
} |
2921 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
2922 |
0 |
public void openJalviewHelpUrl()... |
2923 |
|
{ |
2924 |
0 |
String helpUrl = getParameter("jalviewhelpurl"); |
2925 |
0 |
if (helpUrl == null || helpUrl.trim().length() < 5) |
2926 |
|
{ |
2927 |
0 |
helpUrl = "http://www.jalview.org/help.html"; |
2928 |
|
} |
2929 |
0 |
showURL(helpUrl, "HELP"); |
2930 |
|
} |
2931 |
|
|
2932 |
|
|
2933 |
|
|
2934 |
|
|
2935 |
|
|
2936 |
|
@param |
2937 |
|
|
2938 |
|
|
2939 |
|
@param |
2940 |
|
|
2941 |
|
@return |
2942 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 5 |
Complexity Density: 0.29 |
|
2943 |
0 |
private String resolveUrlForLocalOrAbsolute(String targetPath,... |
2944 |
|
URL localref) |
2945 |
|
{ |
2946 |
0 |
String resolvedPath = ""; |
2947 |
0 |
if (targetPath.startsWith("/")) |
2948 |
|
{ |
2949 |
0 |
String codebase = localref.toString(); |
2950 |
0 |
String localfile = localref.getFile(); |
2951 |
0 |
resolvedPath = codebase.substring(0, |
2952 |
|
codebase.length() - localfile.length()) + targetPath; |
2953 |
0 |
return resolvedPath; |
2954 |
|
} |
2955 |
|
|
2956 |
|
|
2957 |
|
|
2958 |
|
|
2959 |
|
|
2960 |
|
|
2961 |
0 |
String urlPath = localref.toString(); |
2962 |
0 |
String directoryPath = urlPath; |
2963 |
0 |
int lastSeparator = directoryPath.lastIndexOf("/"); |
2964 |
0 |
if (lastSeparator > 0) |
2965 |
|
{ |
2966 |
0 |
directoryPath = directoryPath.substring(0, lastSeparator + 1); |
2967 |
|
} |
2968 |
|
|
2969 |
0 |
if (targetPath.startsWith("/")) |
2970 |
|
{ |
2971 |
|
|
2972 |
|
|
2973 |
|
|
2974 |
|
|
2975 |
|
|
2976 |
|
|
2977 |
|
|
2978 |
0 |
resolvedPath = directoryPath + targetPath.substring(1); |
2979 |
|
} |
2980 |
|
else |
2981 |
|
{ |
2982 |
0 |
resolvedPath = directoryPath + targetPath; |
2983 |
|
} |
2984 |
0 |
if (debug) |
2985 |
|
{ |
2986 |
0 |
jalview.bin.Console.errPrintln( |
2987 |
|
"resolveUrlForLocalOrAbsolute returning " + resolvedPath); |
2988 |
|
} |
2989 |
0 |
return resolvedPath; |
2990 |
|
} |
2991 |
|
|
2992 |
|
|
2993 |
|
|
2994 |
|
|
2995 |
|
|
2996 |
|
@param |
2997 |
|
@param |
2998 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 7 |
Complexity Density: 0.58 |
|
2999 |
0 |
public void showURL(String url, String target)... |
3000 |
|
{ |
3001 |
0 |
try |
3002 |
|
{ |
3003 |
0 |
if (url.indexOf(":") == -1) |
3004 |
|
{ |
3005 |
|
|
3006 |
|
|
3007 |
|
|
3008 |
0 |
URL prepend; |
3009 |
0 |
url = resolveUrlForLocalOrAbsolute(url, |
3010 |
0 |
prepend = getDefaultParameter("resolvetocodebase", false) |
3011 |
|
? getCodeBase() |
3012 |
|
: getDocumentBase()); |
3013 |
0 |
if (debug) |
3014 |
|
{ |
3015 |
0 |
jalview.bin.Console.errPrintln("Show url (prepended " + prepend |
3016 |
|
+ " - toggle resolvetocodebase if code/docbase resolution is wrong): " |
3017 |
|
+ url); |
3018 |
|
} |
3019 |
|
} |
3020 |
|
else |
3021 |
|
{ |
3022 |
0 |
if (debug) |
3023 |
|
{ |
3024 |
0 |
jalview.bin.Console.errPrintln("Show url: " + url); |
3025 |
|
} |
3026 |
|
} |
3027 |
0 |
if (url.indexOf("javascript:") == 0) |
3028 |
|
{ |
3029 |
|
|
3030 |
0 |
getAppletContext().showDocument(new java.net.URL(url)); |
3031 |
|
} |
3032 |
|
else |
3033 |
|
{ |
3034 |
0 |
getAppletContext().showDocument(new java.net.URL(url), target); |
3035 |
|
} |
3036 |
|
} catch (Exception ex) |
3037 |
|
{ |
3038 |
0 |
ex.printStackTrace(); |
3039 |
|
} |
3040 |
|
} |
3041 |
|
|
3042 |
|
|
3043 |
|
|
3044 |
|
|
3045 |
|
|
3046 |
|
@param |
3047 |
|
@param |
3048 |
|
@param |
3049 |
|
@return |
3050 |
|
|
3051 |
|
|
3052 |
|
|
3053 |
|
|
3054 |
|
|
3055 |
|
|
3056 |
|
|
3057 |
|
|
3058 |
|
|
3059 |
|
} |