1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import java.awt.BorderLayout; |
24 |
|
import java.awt.Color; |
25 |
|
import java.awt.Container; |
26 |
|
import java.awt.Dimension; |
27 |
|
import java.awt.Font; |
28 |
|
import java.awt.FontMetrics; |
29 |
|
import java.awt.Graphics; |
30 |
|
import java.awt.Graphics2D; |
31 |
|
import java.awt.event.AdjustmentEvent; |
32 |
|
import java.awt.event.AdjustmentListener; |
33 |
|
import java.awt.event.ComponentAdapter; |
34 |
|
import java.awt.event.ComponentEvent; |
35 |
|
import java.awt.print.PageFormat; |
36 |
|
import java.awt.print.Printable; |
37 |
|
import java.awt.print.PrinterException; |
38 |
|
import java.beans.PropertyChangeEvent; |
39 |
|
import java.beans.PropertyChangeListener; |
40 |
|
import java.io.File; |
41 |
|
import java.io.FileWriter; |
42 |
|
import java.io.PrintWriter; |
43 |
|
import java.util.List; |
44 |
|
|
45 |
|
import javax.swing.BoundedRangeModel; |
46 |
|
import javax.swing.SwingUtilities; |
47 |
|
|
48 |
|
import jalview.analysis.AnnotationSorter; |
49 |
|
import jalview.api.AlignViewportI; |
50 |
|
import jalview.api.AlignmentViewPanel; |
51 |
|
import jalview.bin.Cache; |
52 |
|
import jalview.bin.Console; |
53 |
|
import jalview.bin.Jalview; |
54 |
|
import jalview.datamodel.AlignmentAnnotation; |
55 |
|
import jalview.datamodel.AlignmentI; |
56 |
|
import jalview.datamodel.HiddenColumns; |
57 |
|
import jalview.datamodel.SearchResultsI; |
58 |
|
import jalview.datamodel.SequenceFeature; |
59 |
|
import jalview.datamodel.SequenceGroup; |
60 |
|
import jalview.datamodel.SequenceI; |
61 |
|
import jalview.gui.ImageExporter.ImageWriterI; |
62 |
|
import jalview.io.HTMLOutput; |
63 |
|
import jalview.io.exceptions.ImageOutputException; |
64 |
|
import jalview.jbgui.GAlignmentPanel; |
65 |
|
import jalview.math.AlignmentDimension; |
66 |
|
import jalview.schemes.ResidueProperties; |
67 |
|
import jalview.structure.StructureSelectionManager; |
68 |
|
import jalview.util.Comparison; |
69 |
|
import jalview.util.ImageMaker; |
70 |
|
import jalview.util.MessageManager; |
71 |
|
import jalview.util.imagemaker.BitmapImageSizing; |
72 |
|
import jalview.viewmodel.ViewportListenerI; |
73 |
|
import jalview.viewmodel.ViewportRanges; |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
@author |
79 |
|
@version |
80 |
|
|
81 |
|
@SuppressWarnings("serial") |
|
|
| 64.7% |
Uncovered Elements: 300 (849) |
Complexity: 200 |
Complexity Density: 0.36 |
|
82 |
|
public class AlignmentPanel extends GAlignmentPanel implements |
83 |
|
AdjustmentListener, Printable, AlignmentViewPanel, ViewportListenerI |
84 |
|
{ |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
private static final int ID_WIDTH_PADDING = 4; |
89 |
|
|
90 |
|
public AlignViewport av; |
91 |
|
|
92 |
|
OverviewPanel overviewPanel; |
93 |
|
|
94 |
|
private SeqPanel seqPanel; |
95 |
|
|
96 |
|
private IdPanel idPanel; |
97 |
|
|
98 |
|
IdwidthAdjuster idwidthAdjuster; |
99 |
|
|
100 |
|
public AlignFrame alignFrame; |
101 |
|
|
102 |
|
private ScalePanel scalePanel; |
103 |
|
|
104 |
|
private AnnotationPanel annotationPanel; |
105 |
|
|
106 |
|
private AnnotationLabels alabels; |
107 |
|
|
108 |
|
private int hextent = 0; |
109 |
|
|
110 |
|
private int vextent = 0; |
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
private boolean scrollComplementaryPanel = true; |
117 |
|
|
118 |
|
private PropertyChangeListener propertyChangeListener; |
119 |
|
|
120 |
|
private CalculationChooser calculationDialog; |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
@param |
126 |
|
@param |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 1 |
Complexity Density: 0.04 |
|
128 |
478 |
public AlignmentPanel(AlignFrame af, final AlignViewport av)... |
129 |
|
{ |
130 |
|
|
131 |
478 |
alignFrame = af; |
132 |
478 |
this.av = av; |
133 |
478 |
setSeqPanel(new SeqPanel(av, this)); |
134 |
478 |
setIdPanel(new IdPanel(av, this)); |
135 |
|
|
136 |
478 |
setScalePanel(new ScalePanel(av, this)); |
137 |
|
|
138 |
478 |
idPanelHolder.add(getIdPanel(), BorderLayout.CENTER); |
139 |
478 |
idwidthAdjuster = new IdwidthAdjuster(this); |
140 |
478 |
idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER); |
141 |
|
|
142 |
478 |
setAnnotationPanel(new AnnotationPanel(this)); |
143 |
478 |
setAlabels(new AnnotationLabels(this)); |
144 |
|
|
145 |
478 |
annotationScroller.setViewportView(getAnnotationPanel()); |
146 |
478 |
annotationSpaceFillerHolder.add(getAlabels(), BorderLayout.CENTER); |
147 |
|
|
148 |
478 |
scalePanelHolder.add(getScalePanel(), BorderLayout.CENTER); |
149 |
478 |
seqPanelHolder.add(getSeqPanel(), BorderLayout.CENTER); |
150 |
|
|
151 |
478 |
setScrollValues(0, 0); |
152 |
|
|
153 |
478 |
hscroll.addAdjustmentListener(this); |
154 |
478 |
vscroll.addAdjustmentListener(this); |
155 |
|
|
156 |
478 |
addComponentListener(new ComponentAdapter() |
157 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
158 |
498 |
@Override... |
159 |
|
public void componentResized(ComponentEvent evt) |
160 |
|
{ |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
498 |
ViewportRanges ranges = av.getRanges(); |
165 |
498 |
if (av.getWrapAlignment()) |
166 |
|
{ |
167 |
11 |
int widthInRes = getSeqPanel().seqCanvas.getWrappedCanvasWidth( |
168 |
|
getSeqPanel().seqCanvas.getWidth()); |
169 |
11 |
ranges.setViewportWidth(widthInRes); |
170 |
|
} |
171 |
|
else |
172 |
|
{ |
173 |
487 |
int widthInRes = getSeqPanel().seqCanvas.getWidth() |
174 |
|
/ av.getCharWidth(); |
175 |
487 |
int heightInSeq = getSeqPanel().seqCanvas.getHeight() |
176 |
|
/ av.getCharHeight(); |
177 |
|
|
178 |
487 |
ranges.setViewportWidth(widthInRes); |
179 |
487 |
ranges.setViewportHeight(heightInSeq); |
180 |
|
} |
181 |
|
} |
182 |
|
|
183 |
|
}); |
184 |
|
|
185 |
478 |
final AlignmentPanel ap = this; |
186 |
478 |
propertyChangeListener = new PropertyChangeListener() |
187 |
|
{ |
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
188 |
67 |
@Override... |
189 |
|
public void propertyChange(PropertyChangeEvent evt) |
190 |
|
{ |
191 |
67 |
if (evt.getPropertyName().equals("alignment")) |
192 |
|
{ |
193 |
67 |
PaintRefresher.Refresh(ap, av.getSequenceSetId(), true, true); |
194 |
67 |
alignmentChanged(); |
195 |
|
} |
196 |
|
} |
197 |
|
}; |
198 |
478 |
av.addPropertyChangeListener(propertyChangeListener); |
199 |
|
|
200 |
478 |
av.getRanges().addPropertyChangeListener(this); |
201 |
478 |
fontChanged(); |
202 |
478 |
adjustAnnotationHeight(); |
203 |
478 |
updateLayout(); |
204 |
|
} |
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
584 |
@Override... |
207 |
|
public AlignViewportI getAlignViewport() |
208 |
|
{ |
209 |
584 |
return av; |
210 |
|
} |
211 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
212 |
549 |
public void alignmentChanged()... |
213 |
|
{ |
214 |
549 |
av.alignmentChanged(this); |
215 |
|
|
216 |
549 |
if (getCalculationDialog() != null) |
217 |
|
{ |
218 |
0 |
getCalculationDialog().validateCalcTypes(); |
219 |
|
} |
220 |
|
|
221 |
549 |
alignFrame.updateEditMenuBar(); |
222 |
|
|
223 |
|
|
224 |
549 |
paintAlignment(true, true); |
225 |
|
|
226 |
|
} |
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
231 |
1491 |
public void fontChanged()... |
232 |
|
{ |
233 |
|
|
234 |
|
|
235 |
1491 |
FontMetrics fm = getFontMetrics(av.getFont()); |
236 |
|
|
237 |
|
|
238 |
|
|
239 |
1491 |
av.validCharWidth = fm.charWidth('M') <= av.getCharWidth(); |
240 |
|
|
241 |
1491 |
scalePanelHolder.setPreferredSize( |
242 |
|
new Dimension(10, av.getCharHeight() + fm.getDescent())); |
243 |
1491 |
idSpaceFillerPanel1.setPreferredSize( |
244 |
|
new Dimension(10, av.getCharHeight() + fm.getDescent())); |
245 |
1491 |
idwidthAdjuster.invalidate(); |
246 |
1491 |
scalePanelHolder.invalidate(); |
247 |
|
|
248 |
1491 |
getSeqPanel().seqCanvas.img = null; |
249 |
1491 |
getAnnotationPanel().adjustPanelHeight(); |
250 |
|
|
251 |
1491 |
Dimension d = calculateIdWidth(); |
252 |
1491 |
getIdPanel().getIdCanvas().setPreferredSize(d); |
253 |
1491 |
hscrollFillerPanel.setPreferredSize(d); |
254 |
|
|
255 |
1491 |
repaint(); |
256 |
|
} |
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
@return |
266 |
|
|
267 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
268 |
1494 |
public Dimension calculateIdWidth()... |
269 |
|
{ |
270 |
1494 |
int oldWidth = av.getIdWidth(); |
271 |
|
|
272 |
|
|
273 |
1494 |
Dimension r = null; |
274 |
1494 |
if (av.getIdWidth() < 0) |
275 |
|
{ |
276 |
449 |
r = calculateDefaultAlignmentIdWidth(); |
277 |
449 |
av.setIdWidth(r.width); |
278 |
|
} |
279 |
|
else |
280 |
|
{ |
281 |
1045 |
r = new Dimension(); |
282 |
1045 |
r.width = av.getIdWidth(); |
283 |
1045 |
r.height = 0; |
284 |
|
} |
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
|
290 |
1494 |
if (r.width != oldWidth) |
291 |
|
{ |
292 |
449 |
idPanelHolder.setPreferredSize(r); |
293 |
449 |
validate(); |
294 |
|
} |
295 |
1494 |
return r; |
296 |
|
} |
297 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
298 |
2733 |
public Dimension calculateDefaultAlignmentIdWidth()... |
299 |
|
{ |
300 |
2733 |
return calculateIdWidth(-1, false, false); |
301 |
|
} |
302 |
|
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
@return |
307 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
308 |
43 |
public int getLegacyIdWidth()... |
309 |
|
{ |
310 |
43 |
int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300); |
311 |
43 |
int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3); |
312 |
43 |
int maxwidth = Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth); |
313 |
43 |
Dimension w = calculateIdWidthOrLegacy(true, maxwidth, false, false); |
314 |
43 |
return w.width; |
315 |
|
} |
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
|
324 |
|
|
325 |
|
@param |
326 |
|
|
327 |
|
@return |
328 |
|
|
329 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
330 |
0 |
protected Dimension calculateIdWidth(int maxwidth)... |
331 |
|
{ |
332 |
0 |
return calculateIdWidth(maxwidth, true, false); |
333 |
|
} |
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
@param |
340 |
|
|
341 |
|
@param |
342 |
|
|
343 |
|
|
344 |
|
@param |
345 |
|
|
346 |
|
@return |
347 |
|
|
348 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
349 |
2809 |
public Dimension calculateIdWidth(int maxwidth,... |
350 |
|
boolean includeAnnotations, boolean visibleOnly) |
351 |
|
{ |
352 |
2809 |
return calculateIdWidthOrLegacy(false, maxwidth, includeAnnotations, |
353 |
|
visibleOnly); |
354 |
|
} |
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
|
@param |
360 |
|
|
361 |
|
|
362 |
|
@param |
363 |
|
@param |
364 |
|
@param |
365 |
|
@return |
366 |
|
|
|
|
| 66.7% |
Uncovered Elements: 14 (42) |
Complexity: 12 |
Complexity Density: 0.43 |
|
367 |
2852 |
private Dimension calculateIdWidthOrLegacy(boolean legacy, int maxwidth,... |
368 |
|
boolean includeAnnotations, boolean visibleOnly) |
369 |
|
{ |
370 |
2852 |
Container c = new Container(); |
371 |
|
|
372 |
2852 |
FontMetrics fm = c.getFontMetrics( |
373 |
|
new Font(av.font.getName(), Font.ITALIC, av.font.getSize())); |
374 |
|
|
375 |
2852 |
AlignmentI al = av.getAlignment(); |
376 |
2852 |
int i = 0; |
377 |
2852 |
int idWidth = 0; |
378 |
|
|
379 |
32808 |
while ((i < al.getHeight()) && (al.getSequenceAt(i) != null)) |
380 |
|
{ |
381 |
29956 |
SequenceI s = al.getSequenceAt(i); |
382 |
29956 |
String id = s.getDisplayId(av.getShowJVSuffix()); |
383 |
29956 |
int stringWidth = fm.stringWidth(id); |
384 |
29956 |
idWidth = Math.max(idWidth, stringWidth); |
385 |
29956 |
i++; |
386 |
|
} |
387 |
|
|
388 |
|
|
389 |
2852 |
if (includeAnnotations && al.getAlignmentAnnotation() != null) |
390 |
|
{ |
391 |
76 |
if (legacy) |
392 |
|
{ |
393 |
0 |
fm = c.getFontMetrics(getAlabels().getFont()); |
394 |
|
} |
395 |
|
|
396 |
76 |
if (!legacy || Jalview.isHeadlessMode()) |
397 |
|
{ |
398 |
76 |
AnnotationLabels aal = getAlabels(); |
399 |
76 |
int stringWidth = aal.drawLabels(null, false, idWidth, false, false, |
400 |
|
fm, !visibleOnly); |
401 |
76 |
idWidth = Math.max(idWidth, stringWidth); |
402 |
|
} |
403 |
|
else |
404 |
|
{ |
405 |
0 |
for (i = 0; i < al.getAlignmentAnnotation().length; i++) |
406 |
|
{ |
407 |
0 |
AlignmentAnnotation aa = al.getAlignmentAnnotation()[i]; |
408 |
0 |
if (visibleOnly && !aa.isForDisplay()) |
409 |
|
{ |
410 |
0 |
continue; |
411 |
|
} |
412 |
0 |
String label = aa.label; |
413 |
0 |
int stringWidth = fm.stringWidth(label); |
414 |
0 |
idWidth = Math.max(idWidth, stringWidth); |
415 |
|
} |
416 |
|
} |
417 |
|
} |
418 |
|
|
419 |
2852 |
int w = maxwidth < 0 ? idWidth : Math.min(maxwidth, idWidth); |
420 |
2852 |
w += ID_WIDTH_PADDING; |
421 |
|
|
422 |
2852 |
return new Dimension(w, 12); |
423 |
|
} |
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
|
428 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
429 |
1 |
public void highlightSearchResults(SearchResultsI results)... |
430 |
|
{ |
431 |
1 |
boolean scrolled = scrollToPosition(results, 0, false); |
432 |
|
|
433 |
1 |
boolean fastPaint = !(scrolled && av.getWrapAlignment()); |
434 |
|
|
435 |
1 |
getSeqPanel().seqCanvas.highlightSearchResults(results, fastPaint); |
436 |
|
} |
437 |
|
|
438 |
|
|
439 |
|
|
440 |
|
|
441 |
|
|
442 |
|
@param |
443 |
|
@return |
444 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
445 |
2 |
public boolean scrollToPosition(SearchResultsI searchResults)... |
446 |
|
{ |
447 |
2 |
return scrollToPosition(searchResults, 0, false); |
448 |
|
} |
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
@param |
457 |
|
@param |
458 |
|
|
459 |
|
|
460 |
|
@param |
461 |
|
|
462 |
|
@return |
463 |
|
|
|
|
| 56.3% |
Uncovered Elements: 31 (71) |
Complexity: 18 |
Complexity Density: 0.42 |
|
464 |
7 |
protected boolean scrollToPosition(SearchResultsI results,... |
465 |
|
int verticalOffset, boolean centre) |
466 |
|
{ |
467 |
7 |
int startv, endv, starts, ends; |
468 |
7 |
ViewportRanges ranges = av.getRanges(); |
469 |
|
|
470 |
7 |
if (results == null || results.isEmpty() || av == null |
471 |
|
|| av.getAlignment() == null) |
472 |
|
{ |
473 |
0 |
return false; |
474 |
|
} |
475 |
7 |
int seqIndex = av.getAlignment().findIndex(results); |
476 |
7 |
if (seqIndex == -1) |
477 |
|
{ |
478 |
0 |
return false; |
479 |
|
} |
480 |
7 |
SequenceI seq = av.getAlignment().getSequenceAt(seqIndex); |
481 |
|
|
482 |
7 |
int[] r = results.getResults(seq, 0, av.getAlignment().getWidth()); |
483 |
7 |
if (r == null) |
484 |
|
{ |
485 |
0 |
return false; |
486 |
|
} |
487 |
7 |
int start = r[0]; |
488 |
7 |
int end = r[1]; |
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
|
494 |
7 |
if (centre) |
495 |
|
{ |
496 |
4 |
int offset = (ranges.getEndRes() - ranges.getStartRes() + 1) / 2 - 1; |
497 |
4 |
start = Math.max(start - offset, 0); |
498 |
4 |
end = end + offset - 1; |
499 |
|
} |
500 |
7 |
if (start < 0) |
501 |
|
{ |
502 |
0 |
return false; |
503 |
|
} |
504 |
7 |
if (end == seq.getEnd()) |
505 |
|
{ |
506 |
0 |
return false; |
507 |
|
} |
508 |
|
|
509 |
7 |
if (av.hasHiddenColumns()) |
510 |
|
{ |
511 |
0 |
HiddenColumns hidden = av.getAlignment().getHiddenColumns(); |
512 |
0 |
start = hidden.absoluteToVisibleColumn(start); |
513 |
0 |
end = hidden.absoluteToVisibleColumn(end); |
514 |
0 |
if (start == end) |
515 |
|
{ |
516 |
0 |
if (!hidden.isVisible(r[0])) |
517 |
|
{ |
518 |
|
|
519 |
0 |
return false; |
520 |
|
} |
521 |
|
} |
522 |
|
} |
523 |
|
|
524 |
|
|
525 |
|
|
526 |
|
|
527 |
7 |
seqIndex = Math.max(0, seqIndex - verticalOffset); |
528 |
7 |
boolean scrollNeeded = true; |
529 |
|
|
530 |
7 |
if (!av.getWrapAlignment()) |
531 |
|
{ |
532 |
? |
if ((startv = ranges.getStartRes()) >= start) |
533 |
|
{ |
534 |
|
|
535 |
|
|
536 |
|
|
537 |
4 |
setScrollValues(start, seqIndex); |
538 |
|
} |
539 |
? |
else if ((endv = ranges.getEndRes()) <= end) |
540 |
|
{ |
541 |
|
|
542 |
|
|
543 |
|
|
544 |
1 |
setScrollValues(startv + end - endv, seqIndex); |
545 |
|
} |
546 |
? |
else if ((starts = ranges.getStartSeq()) > seqIndex) |
547 |
|
{ |
548 |
|
|
549 |
|
|
550 |
|
|
551 |
0 |
setScrollValues(ranges.getStartRes(), seqIndex); |
552 |
|
} |
553 |
? |
else if ((ends = ranges.getEndSeq()) <= seqIndex) |
554 |
|
{ |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
0 |
setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1); |
559 |
|
} |
560 |
|
|
561 |
|
|
562 |
|
|
563 |
6 |
scrollNeeded = false; |
564 |
|
} |
565 |
|
else |
566 |
|
{ |
567 |
1 |
scrollNeeded = ranges.scrollToWrappedVisible(start); |
568 |
|
} |
569 |
|
|
570 |
7 |
paintAlignment(false, false); |
571 |
|
|
572 |
7 |
return scrollNeeded; |
573 |
|
} |
574 |
|
|
575 |
|
|
576 |
|
|
577 |
|
|
578 |
|
@return |
579 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
580 |
54 |
public OverviewPanel getOverviewPanel()... |
581 |
|
{ |
582 |
54 |
return overviewPanel; |
583 |
|
} |
584 |
|
|
585 |
|
|
586 |
|
|
587 |
|
|
588 |
|
@param |
589 |
|
|
590 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
591 |
82 |
public void setOverviewPanel(OverviewPanel op)... |
592 |
|
{ |
593 |
82 |
overviewPanel = op; |
594 |
|
} |
595 |
|
|
596 |
|
|
597 |
|
|
598 |
|
@param |
599 |
|
|
600 |
|
|
601 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
602 |
626 |
public void setAnnotationVisible(boolean b)... |
603 |
|
{ |
604 |
626 |
if (!av.getWrapAlignment()) |
605 |
|
{ |
606 |
596 |
annotationSpaceFillerHolder.setVisible(b); |
607 |
596 |
annotationScroller.setVisible(b); |
608 |
|
} |
609 |
626 |
repaint(); |
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
616 |
741 |
@Override... |
617 |
|
public void adjustAnnotationHeight() |
618 |
|
{ |
619 |
|
|
620 |
|
|
621 |
741 |
if (alignFrame.getHeight() == 0) |
622 |
|
{ |
623 |
5 |
jalview.bin.Console.error( |
624 |
|
"adjustAnnotationHeight called with zero height alignment window"); |
625 |
|
} |
626 |
741 |
validateAnnotationDimensions(true); |
627 |
741 |
addNotify(); |
628 |
|
|
629 |
|
|
630 |
741 |
paintAlignment(true, av.needToUpdateStructureViews()); |
631 |
|
} |
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
637 |
1631 |
protected void validateAnnotationDimensions(boolean adjustPanelHeight)... |
638 |
|
{ |
639 |
|
|
640 |
|
|
641 |
|
|
642 |
|
|
643 |
|
|
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
1631 |
AnnotationPanel ap = getAnnotationPanel(); |
649 |
1631 |
int annotationHeight = ap.adjustPanelHeight(); |
650 |
1631 |
annotationHeight = ap.adjustForAlignFrame(adjustPanelHeight, |
651 |
|
annotationHeight); |
652 |
|
|
653 |
1631 |
hscroll.addNotify(); |
654 |
1631 |
Dimension e = idPanel.getSize(); |
655 |
1631 |
int idWidth = e.width; |
656 |
1631 |
boolean manuallyAdjusted = this.getIdPanel().getIdCanvas() |
657 |
|
.isManuallyAdjusted(); |
658 |
1631 |
annotationScroller.setPreferredSize(new Dimension( |
659 |
1631 |
manuallyAdjusted ? idWidth : annotationScroller.getWidth(), |
660 |
|
annotationHeight)); |
661 |
|
|
662 |
1631 |
alabels.setPreferredSize(new Dimension(idWidth, annotationHeight)); |
663 |
|
|
664 |
1631 |
annotationSpaceFillerHolder.setPreferredSize(new Dimension( |
665 |
1631 |
manuallyAdjusted ? idWidth |
666 |
|
: annotationSpaceFillerHolder.getWidth(), |
667 |
|
annotationHeight)); |
668 |
1631 |
annotationScroller.validate(); |
669 |
1631 |
annotationScroller.addNotify(); |
670 |
1631 |
ap.validate(); |
671 |
|
} |
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
|
676 |
|
@param |
677 |
|
|
678 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (32) |
Complexity: 5 |
Complexity Density: 0.21 |
|
679 |
626 |
public void updateLayout()... |
680 |
|
{ |
681 |
626 |
fontChanged(); |
682 |
626 |
setAnnotationVisible(av.isShowAnnotation()); |
683 |
626 |
boolean wrap = av.getWrapAlignment(); |
684 |
626 |
ViewportRanges ranges = av.getRanges(); |
685 |
626 |
ranges.setStartSeq(0); |
686 |
|
|
687 |
626 |
hscroll.setVisible(!wrap); |
688 |
|
|
689 |
626 |
idwidthAdjuster.setVisible(true); |
690 |
|
|
691 |
626 |
if (wrap) |
692 |
|
{ |
693 |
30 |
annotationScroller.setVisible(false); |
694 |
30 |
annotationSpaceFillerHolder.setVisible(false); |
695 |
|
} |
696 |
596 |
else if (av.isShowAnnotation()) |
697 |
|
{ |
698 |
586 |
annotationScroller.setVisible(true); |
699 |
586 |
annotationSpaceFillerHolder.setVisible(true); |
700 |
586 |
validateAnnotationDimensions(false); |
701 |
|
} |
702 |
|
|
703 |
626 |
int canvasWidth = getSeqPanel().seqCanvas.getWidth(); |
704 |
626 |
if (canvasWidth > 0) |
705 |
|
{ |
706 |
31 |
if (wrap) |
707 |
|
{ |
708 |
10 |
int widthInRes = getSeqPanel().seqCanvas |
709 |
|
.getWrappedCanvasWidth(canvasWidth); |
710 |
10 |
ranges.setViewportWidth(widthInRes); |
711 |
|
} |
712 |
|
else |
713 |
|
{ |
714 |
21 |
int widthInRes = (canvasWidth / av.getCharWidth()); |
715 |
21 |
int heightInSeq = (getSeqPanel().seqCanvas.getHeight() |
716 |
|
/ av.getCharHeight()); |
717 |
|
|
718 |
21 |
ranges.setViewportWidth(widthInRes); |
719 |
21 |
ranges.setViewportHeight(heightInSeq); |
720 |
|
} |
721 |
|
} |
722 |
|
|
723 |
|
|
724 |
|
|
725 |
626 |
repaint(); |
726 |
|
} |
727 |
|
|
728 |
|
|
729 |
|
|
730 |
|
|
731 |
|
@param |
732 |
|
|
733 |
|
@param |
734 |
|
|
735 |
|
|
736 |
|
|
|
|
| 90% |
Uncovered Elements: 4 (40) |
Complexity: 10 |
Complexity Density: 0.42 |
|
737 |
3936 |
public void setScrollValues(int xpos, int ypos)... |
738 |
|
{ |
739 |
3936 |
int x = xpos; |
740 |
3936 |
int y = ypos; |
741 |
|
|
742 |
3936 |
if (av == null || av.getAlignment() == null) |
743 |
|
{ |
744 |
0 |
return; |
745 |
|
} |
746 |
|
|
747 |
3936 |
if (av.getWrapAlignment()) |
748 |
|
{ |
749 |
265 |
setScrollingForWrappedPanel(x); |
750 |
|
} |
751 |
|
else |
752 |
|
{ |
753 |
3671 |
int width = av.getAlignment().getVisibleWidth(); |
754 |
3671 |
int height = av.getAlignment().getHeight(); |
755 |
|
|
756 |
3671 |
hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(); |
757 |
3671 |
vextent = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(); |
758 |
|
|
759 |
3671 |
if (hextent > width) |
760 |
|
{ |
761 |
810 |
hextent = width; |
762 |
|
} |
763 |
|
|
764 |
3671 |
if (vextent > height) |
765 |
|
{ |
766 |
951 |
vextent = height; |
767 |
|
} |
768 |
|
|
769 |
3671 |
if ((hextent + x) > width) |
770 |
|
{ |
771 |
2 |
x = width - hextent; |
772 |
|
} |
773 |
|
|
774 |
3671 |
if ((vextent + y) > height) |
775 |
|
{ |
776 |
32 |
y = height - vextent; |
777 |
|
} |
778 |
|
|
779 |
3671 |
if (y < 0) |
780 |
|
{ |
781 |
0 |
y = 0; |
782 |
|
} |
783 |
|
|
784 |
3671 |
if (x < 0) |
785 |
|
{ |
786 |
1 |
x = 0; |
787 |
|
} |
788 |
|
|
789 |
|
|
790 |
3671 |
hscroll.setValues(x, hextent, 0, width); |
791 |
3671 |
vscroll.setValues(y, vextent, 0, height); |
792 |
|
} |
793 |
|
} |
794 |
|
|
795 |
|
|
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
@return |
800 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
801 |
0 |
boolean isScrolledFullyRight()... |
802 |
|
{ |
803 |
0 |
if (hscroll == null) |
804 |
|
{ |
805 |
0 |
return true; |
806 |
|
} |
807 |
0 |
BoundedRangeModel model = hscroll.getModel(); |
808 |
0 |
return (model.getExtent() + model.getValue() >= model.getMaximum()); |
809 |
|
} |
810 |
|
|
811 |
|
|
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
@param |
816 |
|
|
817 |
|
|
|
|
| 96.8% |
Uncovered Elements: 1 (31) |
Complexity: 8 |
Complexity Density: 0.38 |
|
818 |
725 |
@Override... |
819 |
|
public void adjustmentValueChanged(AdjustmentEvent evt) |
820 |
|
{ |
821 |
725 |
if (av.getWrapAlignment()) |
822 |
|
{ |
823 |
26 |
adjustScrollingWrapped(evt); |
824 |
26 |
return; |
825 |
|
} |
826 |
|
|
827 |
699 |
ViewportRanges ranges = av.getRanges(); |
828 |
|
|
829 |
699 |
if (evt.getSource() == hscroll) |
830 |
|
{ |
831 |
304 |
int oldX = ranges.getStartRes(); |
832 |
304 |
int oldwidth = ranges.getViewportWidth(); |
833 |
304 |
int x = hscroll.getValue(); |
834 |
304 |
int width = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(); |
835 |
|
|
836 |
|
|
837 |
|
|
838 |
|
|
839 |
304 |
if ((x == oldX) && (width == oldwidth)) |
840 |
|
{ |
841 |
50 |
return; |
842 |
|
} |
843 |
254 |
ranges.setViewportStartAndWidth(x, width); |
844 |
|
} |
845 |
395 |
else if (evt.getSource() == vscroll) |
846 |
|
{ |
847 |
395 |
int oldY = ranges.getStartSeq(); |
848 |
395 |
int oldheight = ranges.getViewportHeight(); |
849 |
395 |
int y = vscroll.getValue(); |
850 |
395 |
int height = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(); |
851 |
|
|
852 |
|
|
853 |
|
|
854 |
|
|
855 |
395 |
if ((y == oldY) && (height == oldheight)) |
856 |
|
{ |
857 |
26 |
return; |
858 |
|
} |
859 |
369 |
ranges.setViewportStartAndHeight(y, height); |
860 |
|
} |
861 |
623 |
repaint(); |
862 |
|
} |
863 |
|
|
864 |
|
|
865 |
|
|
866 |
|
|
867 |
|
|
868 |
|
@param |
869 |
|
|
|
|
| 44% |
Uncovered Elements: 14 (25) |
Complexity: 6 |
Complexity Density: 0.4 |
|
870 |
26 |
protected void adjustScrollingWrapped(AdjustmentEvent evt)... |
871 |
|
{ |
872 |
26 |
if (evt.getSource() == hscroll) |
873 |
|
{ |
874 |
0 |
return; |
875 |
|
} |
876 |
26 |
final ViewportRanges ranges = av.getRanges(); |
877 |
|
|
878 |
26 |
if (evt.getSource() == vscroll) |
879 |
|
{ |
880 |
26 |
int newY = vscroll.getValue(); |
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
|
885 |
|
|
886 |
|
|
887 |
26 |
int oldX = ranges.getStartRes(); |
888 |
26 |
int oldY = ranges.getWrappedScrollPosition(oldX); |
889 |
26 |
if (oldY == newY) |
890 |
|
{ |
891 |
26 |
return; |
892 |
|
} |
893 |
0 |
if (newY > -1) |
894 |
|
{ |
895 |
|
|
896 |
|
|
897 |
|
|
898 |
0 |
int rowSize = ranges.getViewportWidth(); |
899 |
0 |
int newX = newY > oldY ? oldX + rowSize : oldX - rowSize; |
900 |
0 |
ranges.setViewportStartAndWidth(Math.max(0, newX), rowSize); |
901 |
|
} |
902 |
|
} |
903 |
|
else |
904 |
|
{ |
905 |
|
|
906 |
|
|
907 |
|
|
908 |
0 |
SwingUtilities.invokeLater(new Runnable() |
909 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
910 |
0 |
@Override... |
911 |
|
public void run() |
912 |
|
{ |
913 |
|
|
914 |
|
|
915 |
|
|
916 |
|
|
917 |
0 |
Console.warn( |
918 |
|
"Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences"); |
919 |
|
|
920 |
|
|
921 |
0 |
ranges.setStartRes(0); |
922 |
0 |
ranges.setStartSeq(0); |
923 |
|
} |
924 |
|
}); |
925 |
|
} |
926 |
0 |
repaint(); |
927 |
|
} |
928 |
|
|
929 |
|
|
930 |
|
@see |
931 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
932 |
3634 |
@Override... |
933 |
|
public void paintAlignment(boolean updateOverview, |
934 |
|
boolean updateStructures) |
935 |
|
{ |
936 |
3634 |
final AnnotationSorter sorter = new AnnotationSorter(getAlignment(), |
937 |
|
av.isShowAutocalculatedAbove()); |
938 |
3633 |
sorter.sort(getAlignment().getAlignmentAnnotation(), |
939 |
|
av.getSortAnnotationsBy()); |
940 |
3633 |
repaint(); |
941 |
|
|
942 |
3633 |
if (updateStructures) |
943 |
|
{ |
944 |
2750 |
av.getStructureSelectionManager().sequenceColoursChanged(this); |
945 |
|
} |
946 |
3633 |
if (updateOverview) |
947 |
|
{ |
948 |
|
|
949 |
3595 |
if (overviewPanel != null) |
950 |
|
{ |
951 |
376 |
overviewPanel.updateOverviewImage(); |
952 |
|
} |
953 |
|
} |
954 |
|
} |
955 |
|
|
|
|
| 75% |
Uncovered Elements: 5 (20) |
Complexity: 4 |
Complexity Density: 0.25 |
|
956 |
2825 |
@Override... |
957 |
|
public void paintComponent(Graphics g) |
958 |
|
{ |
959 |
2825 |
invalidate(); |
960 |
2825 |
Dimension d = getIdPanel().getIdCanvas().getPreferredSize(); |
961 |
2825 |
int idWidth = d.width; |
962 |
|
|
963 |
|
|
964 |
2825 |
if (av.getWrapAlignment()) |
965 |
|
{ |
966 |
239 |
SeqCanvas sc = this.getSeqPanel().seqCanvas; |
967 |
239 |
if (sc != null && sc.getWidth() < sc.getMinimumWrappedCanvasWidth()) |
968 |
|
{ |
969 |
|
|
970 |
0 |
idWidth -= (sc.getMinimumWrappedCanvasWidth() - sc.getWidth()); |
971 |
0 |
av.setIdWidth(idWidth); |
972 |
0 |
av.getAlignPanel().getIdPanel().getIdCanvas() |
973 |
|
.setManuallyAdjusted(true); |
974 |
|
|
975 |
0 |
validateAnnotationDimensions(false); |
976 |
|
} |
977 |
|
} |
978 |
|
|
979 |
2825 |
idPanelHolder.setPreferredSize(new Dimension(idWidth, d.height)); |
980 |
2825 |
hscrollFillerPanel.setPreferredSize(new Dimension(idWidth, 12)); |
981 |
|
|
982 |
2825 |
validate(); |
983 |
|
|
984 |
|
|
985 |
|
|
986 |
|
|
987 |
|
|
988 |
2825 |
ViewportRanges ranges = av.getRanges(); |
989 |
2825 |
setScrollValues(ranges.getStartRes(), ranges.getStartSeq()); |
990 |
2825 |
super.paintComponent(g); |
991 |
|
} |
992 |
|
|
993 |
|
|
994 |
|
|
995 |
|
|
996 |
|
|
997 |
|
@param |
998 |
|
|
999 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
1000 |
265 |
private void setScrollingForWrappedPanel(int topLeftColumn)... |
1001 |
|
{ |
1002 |
265 |
ViewportRanges ranges = av.getRanges(); |
1003 |
265 |
int scrollPosition = ranges.getWrappedScrollPosition(topLeftColumn); |
1004 |
265 |
int maxScroll = ranges.getWrappedMaxScroll(topLeftColumn); |
1005 |
|
|
1006 |
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
|
1010 |
265 |
vscroll.setUnitIncrement(1); |
1011 |
265 |
vscroll.setValues(scrollPosition, 1, 0, maxScroll + 1); |
1012 |
|
} |
1013 |
|
|
1014 |
|
|
1015 |
|
|
1016 |
|
|
1017 |
|
@param |
1018 |
|
|
1019 |
|
@param |
1020 |
|
|
1021 |
|
@param |
1022 |
|
|
1023 |
|
|
1024 |
|
@return |
1025 |
|
|
1026 |
|
@throws |
1027 |
|
|
1028 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
1029 |
0 |
@Override... |
1030 |
|
public int print(Graphics pg, PageFormat pf, int pi) |
1031 |
|
throws PrinterException |
1032 |
|
{ |
1033 |
0 |
pg.translate((int) pf.getImageableX(), (int) pf.getImageableY()); |
1034 |
|
|
1035 |
0 |
int pwidth = (int) pf.getImageableWidth(); |
1036 |
0 |
int pheight = (int) pf.getImageableHeight(); |
1037 |
|
|
1038 |
0 |
if (av.getWrapAlignment()) |
1039 |
|
{ |
1040 |
0 |
return printWrappedAlignment(pwidth, pheight, pi, pg); |
1041 |
|
} |
1042 |
|
else |
1043 |
|
{ |
1044 |
0 |
return printUnwrapped(pwidth, pheight, pi, pg, pg); |
1045 |
|
} |
1046 |
|
} |
1047 |
|
|
1048 |
|
|
1049 |
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
1053 |
|
@param |
1054 |
|
|
1055 |
|
@param |
1056 |
|
|
1057 |
|
@param |
1058 |
|
|
1059 |
|
@param |
1060 |
|
|
1061 |
|
@param |
1062 |
|
|
1063 |
|
|
1064 |
|
@return |
1065 |
|
@throws |
1066 |
|
|
|
|
| 91.5% |
Uncovered Elements: 5 (59) |
Complexity: 7 |
Complexity Density: 0.14 |
|
1067 |
38 |
public int printUnwrapped(int pageWidth, int pageHeight, int pageIndex,... |
1068 |
|
Graphics idGraphics, Graphics alignmentGraphics) |
1069 |
|
throws PrinterException |
1070 |
|
{ |
1071 |
38 |
final int idWidth, idWidthForGui; |
1072 |
|
|
1073 |
38 |
idWidth = getVisibleIdWidth(false); |
1074 |
|
|
1075 |
|
|
1076 |
|
|
1077 |
|
|
1078 |
|
|
1079 |
|
|
1080 |
|
|
1081 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
|
|
1085 |
38 |
final int alignmentGraphicsOffset = idGraphics != alignmentGraphics ? 0 |
1086 |
|
: idWidth; |
1087 |
|
|
1088 |
38 |
FontMetrics fm = getFontMetrics(av.getFont()); |
1089 |
38 |
final int charHeight = av.getCharHeight(); |
1090 |
38 |
final int scaleHeight = charHeight + fm.getDescent(); |
1091 |
|
|
1092 |
38 |
idGraphics.setColor(Color.white); |
1093 |
38 |
idGraphics.fillRect(0, 0, pageWidth, pageHeight); |
1094 |
38 |
idGraphics.setFont(av.getFont()); |
1095 |
|
|
1096 |
|
|
1097 |
|
|
1098 |
|
|
1099 |
38 |
final int totalRes = (pageWidth - idWidth) / av.getCharWidth(); |
1100 |
|
|
1101 |
38 |
final int totalSeq = (pageHeight - scaleHeight) / charHeight - 1; |
1102 |
|
|
1103 |
38 |
final int alignmentWidth = av.getAlignment().getVisibleWidth(); |
1104 |
38 |
int pagesWide = (alignmentWidth / totalRes) + 1; |
1105 |
|
|
1106 |
38 |
final int startRes = (pageIndex % pagesWide) * totalRes; |
1107 |
38 |
final int endRes = Math.min(startRes + totalRes - 1, |
1108 |
|
alignmentWidth - 1); |
1109 |
|
|
1110 |
38 |
final int startSeq = (pageIndex / pagesWide) * totalSeq; |
1111 |
38 |
final int alignmentHeight = av.getAlignment().getHeight(); |
1112 |
38 |
final int endSeq = Math.min(startSeq + totalSeq, alignmentHeight); |
1113 |
|
|
1114 |
38 |
int pagesHigh = ((alignmentHeight / totalSeq) + 1) * pageHeight; |
1115 |
|
|
1116 |
38 |
if (av.isShowAnnotation()) |
1117 |
|
{ |
1118 |
38 |
pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3; |
1119 |
|
} |
1120 |
|
|
1121 |
38 |
pagesHigh /= pageHeight; |
1122 |
|
|
1123 |
38 |
if (pageIndex >= (pagesWide * pagesHigh)) |
1124 |
|
{ |
1125 |
0 |
return Printable.NO_SUCH_PAGE; |
1126 |
|
} |
1127 |
38 |
final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3; |
1128 |
|
|
1129 |
38 |
alignmentGraphics.setColor(Color.white); |
1130 |
38 |
alignmentGraphics.fillRect(0, 0, pageWidth, pageHeight + scaleHeight); |
1131 |
|
|
1132 |
|
|
1133 |
|
|
1134 |
|
|
1135 |
38 |
alignmentGraphics.translate(alignmentGraphicsOffset, 0); |
1136 |
38 |
getScalePanel().drawScale(alignmentGraphics, startRes, endRes, |
1137 |
|
pageWidth - idWidth, scaleHeight); |
1138 |
38 |
alignmentGraphics.translate(-alignmentGraphicsOffset, 0); |
1139 |
|
|
1140 |
|
|
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
38 |
idGraphics.translate(0, scaleHeight); |
1145 |
38 |
IdCanvas idCanvas = getIdPanel().getIdCanvas(); |
1146 |
38 |
List<SequenceI> selection = av.getSelectionGroup() == null ? null |
1147 |
|
: av.getSelectionGroup().getSequences(null); |
1148 |
|
|
1149 |
38 |
idCanvas.drawIds((Graphics2D) idGraphics, av, startSeq, endSeq - 1, |
1150 |
|
selection, false, idWidth); |
1151 |
|
|
1152 |
38 |
idGraphics.setFont(av.getFont()); |
1153 |
38 |
idGraphics.translate(0, -scaleHeight); |
1154 |
|
|
1155 |
|
|
1156 |
|
|
1157 |
|
|
1158 |
|
|
1159 |
38 |
alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight); |
1160 |
38 |
getSeqPanel().seqCanvas.drawPanelForPrinting(alignmentGraphics, |
1161 |
|
startRes, endRes, startSeq, endSeq - 1); |
1162 |
38 |
alignmentGraphics.translate(-alignmentGraphicsOffset, 0); |
1163 |
|
|
1164 |
38 |
if (av.isShowAnnotation() && (endSeq == alignmentHeight)) |
1165 |
|
{ |
1166 |
|
|
1167 |
|
|
1168 |
|
|
1169 |
|
|
1170 |
|
|
1171 |
38 |
int offset = getAlabels().getScrollOffset(); |
1172 |
38 |
idGraphics.translate(0, -offset); |
1173 |
38 |
idGraphics.translate(0, alignmentDrawnHeight); |
1174 |
38 |
getAlabels().drawComponentNotGUI(idGraphics, idWidth); |
1175 |
38 |
idGraphics.translate(0, -alignmentDrawnHeight); |
1176 |
|
|
1177 |
|
|
1178 |
|
|
1179 |
|
|
1180 |
|
|
1181 |
38 |
alignmentGraphics.translate(alignmentGraphicsOffset, |
1182 |
|
alignmentDrawnHeight); |
1183 |
38 |
updateLayout(); |
1184 |
38 |
getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av, |
1185 |
|
alignmentGraphics, -1, startRes, endRes + 1); |
1186 |
|
} |
1187 |
|
|
1188 |
38 |
return Printable.PAGE_EXISTS; |
1189 |
|
} |
1190 |
|
|
1191 |
|
|
1192 |
|
|
1193 |
|
|
1194 |
|
|
1195 |
|
|
1196 |
|
@param |
1197 |
|
@param |
1198 |
|
@param |
1199 |
|
|
1200 |
|
@param |
1201 |
|
|
1202 |
|
@return |
1203 |
|
|
1204 |
|
@throws |
1205 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 4 |
Complexity Density: 0.15 |
|
1206 |
0 |
public int printWrappedAlignment(int pageWidth, int pageHeight,... |
1207 |
|
int pageNumber, Graphics g) throws PrinterException |
1208 |
|
{ |
1209 |
0 |
getSeqPanel().seqCanvas.calculateWrappedGeometry(getWidth(), |
1210 |
|
getHeight()); |
1211 |
0 |
int annotationHeight = 0; |
1212 |
0 |
if (av.isShowAnnotation()) |
1213 |
|
{ |
1214 |
0 |
annotationHeight = getAnnotationPanel().adjustPanelHeight(); |
1215 |
|
} |
1216 |
|
|
1217 |
0 |
int hgap = av.getCharHeight(); |
1218 |
0 |
if (av.getScaleAboveWrapped()) |
1219 |
|
{ |
1220 |
0 |
hgap += av.getCharHeight(); |
1221 |
|
} |
1222 |
|
|
1223 |
0 |
int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap |
1224 |
|
+ annotationHeight; |
1225 |
|
|
1226 |
0 |
int idWidth = getVisibleIdWidth(false); |
1227 |
|
|
1228 |
0 |
int maxwidth = av.getAlignment().getVisibleWidth(); |
1229 |
|
|
1230 |
0 |
int resWidth = getSeqPanel().seqCanvas |
1231 |
|
.getWrappedCanvasWidth(pageWidth - idWidth); |
1232 |
0 |
av.getRanges().setViewportStartAndWidth(0, resWidth); |
1233 |
|
|
1234 |
0 |
int totalHeight = cHeight * (maxwidth / resWidth + 1); |
1235 |
|
|
1236 |
0 |
g.setColor(Color.white); |
1237 |
0 |
g.fillRect(0, 0, pageWidth, pageHeight); |
1238 |
0 |
g.setFont(av.getFont()); |
1239 |
0 |
g.setColor(Color.black); |
1240 |
|
|
1241 |
|
|
1242 |
|
|
1243 |
|
|
1244 |
|
|
1245 |
|
|
1246 |
|
|
1247 |
0 |
g.translate(0, -pageNumber * pageHeight); |
1248 |
|
|
1249 |
0 |
g.setClip(0, pageNumber * pageHeight, pageWidth, pageHeight); |
1250 |
|
|
1251 |
|
|
1252 |
|
|
1253 |
|
|
1254 |
0 |
IdCanvas idCanvas = getIdPanel().getIdCanvas(); |
1255 |
0 |
idCanvas.drawIdsWrappedNoGUI((Graphics2D) g, av, 0, totalHeight); |
1256 |
|
|
1257 |
0 |
g.translate(idWidth, 0); |
1258 |
|
|
1259 |
0 |
getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g, |
1260 |
|
pageWidth - idWidth, totalHeight, 0); |
1261 |
|
|
1262 |
0 |
if ((pageNumber * pageHeight) < totalHeight) |
1263 |
|
{ |
1264 |
0 |
return Printable.PAGE_EXISTS; |
1265 |
|
} |
1266 |
|
else |
1267 |
|
{ |
1268 |
0 |
return Printable.NO_SUCH_PAGE; |
1269 |
|
} |
1270 |
|
} |
1271 |
|
|
1272 |
|
|
1273 |
|
|
1274 |
|
|
1275 |
|
|
1276 |
|
@return |
1277 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1278 |
0 |
public int getVisibleIdWidth()... |
1279 |
|
{ |
1280 |
0 |
return getVisibleIdWidth(true); |
1281 |
|
} |
1282 |
|
|
1283 |
|
|
1284 |
|
|
1285 |
|
|
1286 |
|
|
1287 |
|
@param |
1288 |
|
|
1289 |
|
|
1290 |
|
@return |
1291 |
|
|
|
|
| 60% |
Uncovered Elements: 6 (15) |
Complexity: 6 |
Complexity Density: 0.86 |
|
1292 |
76 |
protected int getVisibleIdWidth(boolean onscreen)... |
1293 |
|
{ |
1294 |
|
|
1295 |
76 |
if (!onscreen && Cache.getDefault("FIGURE_AUTOIDWIDTH", false)) |
1296 |
|
{ |
1297 |
0 |
return calculateIdWidth(-1, true, true).width; |
1298 |
|
} |
1299 |
76 |
Integer idwidth = onscreen ? null |
1300 |
|
: Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH"); |
1301 |
76 |
if (idwidth != null) |
1302 |
|
{ |
1303 |
0 |
return idwidth.intValue() + ID_WIDTH_PADDING; |
1304 |
|
} |
1305 |
|
|
1306 |
|
|
1307 |
|
|
1308 |
76 |
int w = calculateIdWidth(-1, true, true).width; |
1309 |
76 |
return (w > 0 ? w : calculateIdWidth().width); |
1310 |
|
} |
1311 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1312 |
12 |
void makeAlignmentImage(ImageMaker.TYPE type, File file, String renderer)... |
1313 |
|
throws ImageOutputException |
1314 |
|
{ |
1315 |
12 |
makeAlignmentImage(type, file, renderer, |
1316 |
|
BitmapImageSizing.defaultBitmapImageSizing()); |
1317 |
|
} |
1318 |
|
|
1319 |
|
|
1320 |
|
|
1321 |
|
|
1322 |
|
|
1323 |
|
@param |
1324 |
|
@param |
1325 |
|
@param |
1326 |
|
@param |
1327 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
1328 |
36 |
void makeAlignmentImage(ImageMaker.TYPE type, File file, String renderer,... |
1329 |
|
BitmapImageSizing userBis) throws ImageOutputException |
1330 |
|
{ |
1331 |
36 |
final int borderBottomOffset = 5; |
1332 |
|
|
1333 |
36 |
AlignmentDimension aDimension = getAlignmentDimension(); |
1334 |
|
|
1335 |
|
|
1336 |
36 |
ImageWriterI writer = new ImageWriterI() |
1337 |
|
{ |
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1338 |
36 |
@Override... |
1339 |
|
public void exportImage(Graphics graphics) throws Exception |
1340 |
|
{ |
1341 |
36 |
if (av.getWrapAlignment()) |
1342 |
|
{ |
1343 |
0 |
printWrappedAlignment(aDimension.getWidth(), |
1344 |
|
aDimension.getHeight() + borderBottomOffset, 0, graphics); |
1345 |
|
} |
1346 |
|
else |
1347 |
|
{ |
1348 |
36 |
printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, |
1349 |
|
graphics, graphics); |
1350 |
|
} |
1351 |
|
} |
1352 |
|
}; |
1353 |
|
|
1354 |
36 |
String fileTitle = alignFrame.getTitle(); |
1355 |
36 |
ImageExporter exporter = new ImageExporter(writer, alignFrame, type, |
1356 |
|
fileTitle); |
1357 |
36 |
int imageWidth = aDimension.getWidth(); |
1358 |
36 |
int imageHeight = aDimension.getHeight() + borderBottomOffset; |
1359 |
36 |
String of = MessageManager.getString("label.alignment"); |
1360 |
36 |
exporter.doExport(file, this, imageWidth, imageHeight, of, renderer, |
1361 |
|
userBis); |
1362 |
|
} |
1363 |
|
|
1364 |
|
|
1365 |
|
|
1366 |
|
|
1367 |
|
|
1368 |
|
@return |
1369 |
|
|
|
|
| 52.9% |
Uncovered Elements: 8 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
1370 |
38 |
public AlignmentDimension getAlignmentDimension()... |
1371 |
|
{ |
1372 |
38 |
int maxwidth = av.getAlignment().getVisibleWidth(); |
1373 |
|
|
1374 |
38 |
int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight()) |
1375 |
|
+ getScalePanel().getHeight(); |
1376 |
38 |
int width = getVisibleIdWidth(false) + (maxwidth * av.getCharWidth()); |
1377 |
|
|
1378 |
38 |
if (av.getWrapAlignment()) |
1379 |
|
{ |
1380 |
0 |
height = getWrappedHeight(); |
1381 |
0 |
if (Jalview.isHeadlessMode()) |
1382 |
|
{ |
1383 |
|
|
1384 |
|
|
1385 |
|
|
1386 |
|
|
1387 |
0 |
width = alignFrame.getWidth() - vscroll.getPreferredSize().width |
1388 |
|
- alignFrame.getInsets().left - alignFrame.getInsets().right |
1389 |
|
- getVisibleIdWidth() + getVisibleIdWidth(false); |
1390 |
|
} |
1391 |
|
else |
1392 |
|
{ |
1393 |
0 |
width = getSeqPanel().getWidth() + getVisibleIdWidth(false); |
1394 |
|
} |
1395 |
|
|
1396 |
|
} |
1397 |
38 |
else if (av.isShowAnnotation()) |
1398 |
|
{ |
1399 |
38 |
height += getAnnotationPanel().adjustPanelHeight() + 3; |
1400 |
|
} |
1401 |
38 |
return new AlignmentDimension(width, height); |
1402 |
|
|
1403 |
|
} |
1404 |
|
|
|
|
| 0% |
Uncovered Elements: 79 (79) |
Complexity: 19 |
Complexity Density: 0.37 |
|
1405 |
0 |
public void makePNGImageMap(File imgMapFile, String imageName)... |
1406 |
|
throws ImageOutputException |
1407 |
|
{ |
1408 |
|
|
1409 |
|
|
1410 |
0 |
int idWidth = getVisibleIdWidth(false); |
1411 |
0 |
FontMetrics fm = getFontMetrics(av.getFont()); |
1412 |
0 |
int scaleHeight = av.getCharHeight() + fm.getDescent(); |
1413 |
|
|
1414 |
|
|
1415 |
|
|
1416 |
0 |
if (imgMapFile != null) |
1417 |
|
{ |
1418 |
0 |
try |
1419 |
|
{ |
1420 |
0 |
int sSize = av.getAlignment().getHeight(); |
1421 |
0 |
int alwidth = av.getAlignment().getWidth(); |
1422 |
0 |
PrintWriter out = new PrintWriter(new FileWriter(imgMapFile)); |
1423 |
0 |
out.println(HTMLOutput.getImageMapHTML()); |
1424 |
0 |
out.println("<img src=\"" + imageName |
1425 |
|
+ "\" border=\"0\" usemap=\"#Map\" >" |
1426 |
|
+ "<map name=\"Map\">"); |
1427 |
|
|
1428 |
0 |
for (int s = 0; s < sSize; s++) |
1429 |
|
{ |
1430 |
0 |
int sy = s * av.getCharHeight() + scaleHeight; |
1431 |
|
|
1432 |
0 |
SequenceI seq = av.getAlignment().getSequenceAt(s); |
1433 |
0 |
SequenceGroup[] groups = av.getAlignment().findAllGroups(seq); |
1434 |
0 |
for (int column = 0; column < alwidth; column++) |
1435 |
|
{ |
1436 |
0 |
StringBuilder text = new StringBuilder(512); |
1437 |
0 |
String triplet = null; |
1438 |
0 |
if (av.getAlignment().isNucleotide()) |
1439 |
|
{ |
1440 |
0 |
triplet = ResidueProperties.nucleotideName |
1441 |
|
.get(seq.getCharAt(column) + ""); |
1442 |
|
} |
1443 |
|
else |
1444 |
|
{ |
1445 |
0 |
triplet = ResidueProperties.aa2Triplet |
1446 |
|
.get(seq.getCharAt(column) + ""); |
1447 |
|
} |
1448 |
|
|
1449 |
0 |
if (triplet == null) |
1450 |
|
{ |
1451 |
0 |
continue; |
1452 |
|
} |
1453 |
|
|
1454 |
0 |
int seqPos = seq.findPosition(column); |
1455 |
0 |
int gSize = groups.length; |
1456 |
0 |
for (int g = 0; g < gSize; g++) |
1457 |
|
{ |
1458 |
0 |
if (text.length() < 1) |
1459 |
|
{ |
1460 |
0 |
text.append("<area shape=\"rect\" coords=\"") |
1461 |
|
.append((idWidth + column * av.getCharWidth())) |
1462 |
|
.append(",").append(sy).append(",") |
1463 |
|
.append((idWidth |
1464 |
|
+ (column + 1) * av.getCharWidth())) |
1465 |
|
.append(",").append((av.getCharHeight() + sy)) |
1466 |
|
.append("\"").append(" onMouseOver=\"toolTip('") |
1467 |
|
.append(seqPos).append(" ").append(triplet); |
1468 |
|
} |
1469 |
|
|
1470 |
0 |
if (groups[g].getStartRes() < column |
1471 |
|
&& groups[g].getEndRes() > column) |
1472 |
|
{ |
1473 |
0 |
text.append("<br><em>").append(groups[g].getName()) |
1474 |
|
.append("</em>"); |
1475 |
|
} |
1476 |
|
} |
1477 |
|
|
1478 |
0 |
if (text.length() < 1) |
1479 |
|
{ |
1480 |
0 |
text.append("<area shape=\"rect\" coords=\"") |
1481 |
|
.append((idWidth + column * av.getCharWidth())) |
1482 |
|
.append(",").append(sy).append(",") |
1483 |
|
.append((idWidth + (column + 1) * av.getCharWidth())) |
1484 |
|
.append(",").append((av.getCharHeight() + sy)) |
1485 |
|
.append("\"").append(" onMouseOver=\"toolTip('") |
1486 |
|
.append(seqPos).append(" ").append(triplet); |
1487 |
|
} |
1488 |
0 |
if (!Comparison.isGap(seq.getCharAt(column))) |
1489 |
|
{ |
1490 |
0 |
List<SequenceFeature> features = seq.findFeatures(column, |
1491 |
|
column); |
1492 |
0 |
for (SequenceFeature sf : features) |
1493 |
|
{ |
1494 |
0 |
if (sf.isContactFeature()) |
1495 |
|
{ |
1496 |
0 |
text.append("<br>").append(sf.getType()).append(" ") |
1497 |
|
.append(sf.getBegin()).append(":") |
1498 |
|
.append(sf.getEnd()); |
1499 |
|
} |
1500 |
|
else |
1501 |
|
{ |
1502 |
0 |
text.append("<br>"); |
1503 |
0 |
text.append(sf.getType()); |
1504 |
0 |
String description = sf.getDescription(); |
1505 |
0 |
if (description != null |
1506 |
|
&& !sf.getType().equals(description)) |
1507 |
|
{ |
1508 |
0 |
description = description.replace("\"", """); |
1509 |
0 |
text.append(" ").append(description); |
1510 |
|
} |
1511 |
|
} |
1512 |
0 |
String status = sf.getStatus(); |
1513 |
0 |
if (status != null && !"".equals(status)) |
1514 |
|
{ |
1515 |
0 |
text.append(" (").append(status).append(")"); |
1516 |
|
} |
1517 |
|
} |
1518 |
0 |
if (text.length() > 1) |
1519 |
|
{ |
1520 |
0 |
text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">"); |
1521 |
0 |
out.println(text.toString()); |
1522 |
|
} |
1523 |
|
} |
1524 |
|
} |
1525 |
|
} |
1526 |
0 |
out.println("</map></body></html>"); |
1527 |
0 |
out.close(); |
1528 |
|
|
1529 |
|
} catch (Exception ex) |
1530 |
|
{ |
1531 |
0 |
throw new ImageOutputException( |
1532 |
|
"couldn't write ImageMap due to unexpected error", ex); |
1533 |
|
} |
1534 |
|
} |
1535 |
|
|
1536 |
|
} |
1537 |
|
|
1538 |
|
|
1539 |
|
|
1540 |
|
|
1541 |
|
|
1542 |
|
@return |
1543 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 5 |
Complexity Density: 0.29 |
|
1544 |
0 |
int getWrappedHeight()... |
1545 |
|
{ |
1546 |
0 |
int seqPanelWidth = getSeqPanel().seqCanvas.getWidth(); |
1547 |
|
|
1548 |
0 |
if (Jalview.isHeadlessMode()) |
1549 |
|
{ |
1550 |
0 |
seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth() |
1551 |
|
- vscroll.getPreferredSize().width |
1552 |
|
- alignFrame.getInsets().left - alignFrame.getInsets().right; |
1553 |
|
} |
1554 |
|
|
1555 |
0 |
int chunkWidth = getSeqPanel().seqCanvas |
1556 |
|
.getWrappedCanvasWidth(seqPanelWidth); |
1557 |
|
|
1558 |
0 |
int hgap = av.getCharHeight(); |
1559 |
0 |
if (av.getScaleAboveWrapped()) |
1560 |
|
{ |
1561 |
0 |
hgap += av.getCharHeight(); |
1562 |
|
} |
1563 |
|
|
1564 |
0 |
int annotationHeight = 0; |
1565 |
0 |
if (av.isShowAnnotation()) |
1566 |
|
{ |
1567 |
0 |
hgap += SeqCanvas.SEQS_ANNOTATION_GAP; |
1568 |
0 |
annotationHeight = getAnnotationPanel().adjustPanelHeight(); |
1569 |
|
} |
1570 |
|
|
1571 |
0 |
int cHeight = av.getAlignment().getHeight() * av.getCharHeight() + hgap |
1572 |
|
+ annotationHeight; |
1573 |
|
|
1574 |
0 |
int maxwidth = av.getAlignment().getWidth(); |
1575 |
0 |
if (av.hasHiddenColumns()) |
1576 |
|
{ |
1577 |
0 |
maxwidth = av.getAlignment().getHiddenColumns() |
1578 |
|
.absoluteToVisibleColumn(maxwidth) - 1; |
1579 |
|
} |
1580 |
|
|
1581 |
0 |
int height = ((maxwidth / chunkWidth) + 1) * cHeight; |
1582 |
|
|
1583 |
0 |
return height; |
1584 |
|
} |
1585 |
|
|
1586 |
|
|
1587 |
|
|
1588 |
|
|
1589 |
|
|
|
|
| 76.9% |
Uncovered Elements: 6 (26) |
Complexity: 4 |
Complexity Density: 0.2 |
|
1590 |
253 |
public void closePanel()... |
1591 |
|
{ |
1592 |
253 |
PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas); |
1593 |
253 |
PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas()); |
1594 |
253 |
PaintRefresher.RemoveComponent(this); |
1595 |
|
|
1596 |
253 |
closeChildFrames(); |
1597 |
|
|
1598 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
253 |
if (annotationPanel != null) |
1602 |
|
{ |
1603 |
253 |
annotationPanel.dispose(); |
1604 |
253 |
annotationPanel = null; |
1605 |
|
} |
1606 |
|
|
1607 |
253 |
if (av != null) |
1608 |
|
{ |
1609 |
253 |
av.removePropertyChangeListener(propertyChangeListener); |
1610 |
253 |
propertyChangeListener = null; |
1611 |
253 |
StructureSelectionManager ssm = av.getStructureSelectionManager(); |
1612 |
253 |
ssm.removeStructureViewerListener(getSeqPanel(), null); |
1613 |
253 |
ssm.removeSelectionListener(getSeqPanel()); |
1614 |
253 |
ssm.removeCommandListener(av); |
1615 |
253 |
ssm.removeStructureViewerListener(getSeqPanel(), null); |
1616 |
253 |
ssm.removeSelectionListener(getSeqPanel()); |
1617 |
253 |
av.dispose(); |
1618 |
253 |
av = null; |
1619 |
|
} |
1620 |
|
else |
1621 |
|
{ |
1622 |
0 |
if (Console.isDebugEnabled()) |
1623 |
|
{ |
1624 |
0 |
Console.warn("Closing alignment panel which is already closed."); |
1625 |
|
} |
1626 |
|
} |
1627 |
|
} |
1628 |
|
|
1629 |
|
|
1630 |
|
|
1631 |
|
|
|
|
| 70% |
Uncovered Elements: 3 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
1632 |
253 |
protected void closeChildFrames()... |
1633 |
|
{ |
1634 |
253 |
if (overviewPanel != null) |
1635 |
|
{ |
1636 |
1 |
overviewPanel.dispose(); |
1637 |
1 |
overviewPanel = null; |
1638 |
|
} |
1639 |
253 |
if (calculationDialog != null) |
1640 |
|
{ |
1641 |
0 |
calculationDialog.closeFrame(); |
1642 |
0 |
calculationDialog = null; |
1643 |
|
} |
1644 |
|
} |
1645 |
|
|
1646 |
|
|
1647 |
|
|
1648 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1649 |
45 |
public void updateAnnotation()... |
1650 |
|
{ |
1651 |
45 |
updateAnnotation(false, false); |
1652 |
|
} |
1653 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1654 |
0 |
public void updateAnnotation(boolean applyGlobalSettings)... |
1655 |
|
{ |
1656 |
0 |
updateAnnotation(applyGlobalSettings, false); |
1657 |
|
} |
1658 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1659 |
130 |
public void updateAnnotation(boolean applyGlobalSettings,... |
1660 |
|
boolean preserveNewGroupSettings) |
1661 |
|
{ |
1662 |
130 |
av.updateGroupAnnotationSettings(applyGlobalSettings, |
1663 |
|
preserveNewGroupSettings); |
1664 |
130 |
adjustAnnotationHeight(); |
1665 |
|
} |
1666 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1667 |
8393 |
@Override... |
1668 |
|
public AlignmentI getAlignment() |
1669 |
|
{ |
1670 |
8393 |
return av == null ? null : av.getAlignment(); |
1671 |
|
} |
1672 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1673 |
1786 |
@Override... |
1674 |
|
public String getViewName() |
1675 |
|
{ |
1676 |
1786 |
return av.getViewName(); |
1677 |
|
} |
1678 |
|
|
1679 |
|
|
1680 |
|
|
1681 |
|
|
1682 |
|
@param |
1683 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1684 |
0 |
public void setSelected(boolean b)... |
1685 |
|
{ |
1686 |
0 |
try |
1687 |
|
{ |
1688 |
0 |
if (alignFrame.getSplitViewContainer() != null) |
1689 |
|
{ |
1690 |
|
|
1691 |
|
|
1692 |
|
|
1693 |
0 |
((SplitFrame) alignFrame.getSplitViewContainer()).setSelected(b); |
1694 |
|
} |
1695 |
0 |
alignFrame.setSelected(b); |
1696 |
|
} catch (Exception ex) |
1697 |
|
{ |
1698 |
|
} |
1699 |
0 |
if (b) |
1700 |
|
{ |
1701 |
0 |
setAlignFrameView(); |
1702 |
|
} |
1703 |
|
} |
1704 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1705 |
0 |
public void setAlignFrameView()... |
1706 |
|
{ |
1707 |
0 |
alignFrame.setDisplayedView(this); |
1708 |
|
} |
1709 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1710 |
106 |
@Override... |
1711 |
|
public StructureSelectionManager getStructureSelectionManager() |
1712 |
|
{ |
1713 |
106 |
return av.getStructureSelectionManager(); |
1714 |
|
} |
1715 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1716 |
0 |
@Override... |
1717 |
|
public void raiseOOMWarning(String string, OutOfMemoryError error) |
1718 |
|
{ |
1719 |
0 |
new OOMWarning(string, error, this); |
1720 |
|
} |
1721 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1722 |
15 |
@Override... |
1723 |
|
public jalview.api.FeatureRenderer cloneFeatureRenderer() |
1724 |
|
{ |
1725 |
|
|
1726 |
15 |
return new FeatureRenderer(this); |
1727 |
|
} |
1728 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1729 |
354 |
@Override... |
1730 |
|
public jalview.api.FeatureRenderer getFeatureRenderer() |
1731 |
|
{ |
1732 |
354 |
return seqPanel.seqCanvas.getFeatureRenderer(); |
1733 |
|
} |
1734 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1735 |
0 |
public void updateFeatureRenderer(... |
1736 |
|
jalview.renderer.seqfeatures.FeatureRenderer fr) |
1737 |
|
{ |
1738 |
0 |
fr.transferSettings(getSeqPanel().seqCanvas.getFeatureRenderer()); |
1739 |
|
} |
1740 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1741 |
0 |
public void updateFeatureRendererFrom(jalview.api.FeatureRenderer fr)... |
1742 |
|
{ |
1743 |
0 |
if (getSeqPanel().seqCanvas.getFeatureRenderer() != null) |
1744 |
|
{ |
1745 |
0 |
getSeqPanel().seqCanvas.getFeatureRenderer().transferSettings(fr); |
1746 |
|
} |
1747 |
|
} |
1748 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1749 |
558 |
public ScalePanel getScalePanel()... |
1750 |
|
{ |
1751 |
558 |
return scalePanel; |
1752 |
|
} |
1753 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1754 |
478 |
public void setScalePanel(ScalePanel scalePanel)... |
1755 |
|
{ |
1756 |
478 |
this.scalePanel = scalePanel; |
1757 |
|
} |
1758 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1759 |
15174 |
public SeqPanel getSeqPanel()... |
1760 |
|
{ |
1761 |
15174 |
return seqPanel; |
1762 |
|
} |
1763 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1764 |
478 |
public void setSeqPanel(SeqPanel seqPanel)... |
1765 |
|
{ |
1766 |
478 |
this.seqPanel = seqPanel; |
1767 |
|
} |
1768 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1769 |
13718 |
public AnnotationPanel getAnnotationPanel()... |
1770 |
|
{ |
1771 |
13718 |
return annotationPanel; |
1772 |
|
} |
1773 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1774 |
478 |
public void setAnnotationPanel(AnnotationPanel annotationPanel)... |
1775 |
|
{ |
1776 |
478 |
this.annotationPanel = annotationPanel; |
1777 |
|
} |
1778 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1779 |
15243 |
public AnnotationLabels getAlabels()... |
1780 |
|
{ |
1781 |
15243 |
return alabels; |
1782 |
|
} |
1783 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1784 |
478 |
public void setAlabels(AnnotationLabels alabels)... |
1785 |
|
{ |
1786 |
478 |
this.alabels = alabels; |
1787 |
|
} |
1788 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1789 |
10269 |
public IdPanel getIdPanel()... |
1790 |
|
{ |
1791 |
10269 |
return idPanel; |
1792 |
|
} |
1793 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1794 |
478 |
public void setIdPanel(IdPanel idPanel)... |
1795 |
|
{ |
1796 |
478 |
this.idPanel = idPanel; |
1797 |
|
} |
1798 |
|
|
1799 |
|
|
1800 |
|
|
1801 |
|
|
1802 |
|
|
1803 |
|
@param |
1804 |
|
|
1805 |
|
|
1806 |
|
@param |
1807 |
|
|
1808 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1809 |
4 |
protected void scrollToCentre(SearchResultsI sr, int verticalOffset)... |
1810 |
|
{ |
1811 |
4 |
scrollToPosition(sr, verticalOffset, true); |
1812 |
|
} |
1813 |
|
|
1814 |
|
|
1815 |
|
|
1816 |
|
|
1817 |
|
@param |
1818 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1819 |
1236 |
protected void setToScrollComplementPanel(boolean b)... |
1820 |
|
{ |
1821 |
1236 |
this.scrollComplementaryPanel = b; |
1822 |
|
} |
1823 |
|
|
1824 |
|
|
1825 |
|
|
1826 |
|
|
1827 |
|
@return |
1828 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1829 |
620 |
protected boolean isSetToScrollComplementPanel()... |
1830 |
|
{ |
1831 |
620 |
return this.scrollComplementaryPanel; |
1832 |
|
} |
1833 |
|
|
1834 |
|
|
1835 |
|
|
1836 |
|
|
1837 |
|
|
1838 |
|
|
1839 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
1840 |
0 |
protected void refresh(boolean adjustHeight)... |
1841 |
|
{ |
1842 |
0 |
validateAnnotationDimensions(adjustHeight); |
1843 |
0 |
addNotify(); |
1844 |
0 |
if (adjustHeight) |
1845 |
|
{ |
1846 |
|
|
1847 |
0 |
paintAlignment(true, false); |
1848 |
|
} |
1849 |
|
else |
1850 |
|
{ |
1851 |
|
|
1852 |
0 |
repaint(); |
1853 |
|
} |
1854 |
|
} |
1855 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
1856 |
620 |
@Override... |
1857 |
|
|
1858 |
|
|
1859 |
|
|
1860 |
|
|
1861 |
|
public void propertyChange(PropertyChangeEvent evt) |
1862 |
|
{ |
1863 |
|
|
1864 |
620 |
ViewportRanges ranges = av.getRanges(); |
1865 |
620 |
int x = ranges.getStartRes(); |
1866 |
620 |
int y = ranges.getStartSeq(); |
1867 |
620 |
setScrollValues(x, y); |
1868 |
|
|
1869 |
|
|
1870 |
|
|
1871 |
620 |
if (isSetToScrollComplementPanel()) |
1872 |
|
{ |
1873 |
613 |
setToScrollComplementPanel(false); |
1874 |
613 |
av.scrollComplementaryAlignment(); |
1875 |
613 |
setToScrollComplementPanel(true); |
1876 |
|
} |
1877 |
|
} |
1878 |
|
|
1879 |
|
|
1880 |
|
|
1881 |
|
|
1882 |
|
|
1883 |
|
@param |
1884 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1885 |
0 |
public void setCalculationDialog(CalculationChooser calculationChooser)... |
1886 |
|
{ |
1887 |
0 |
calculationDialog = calculationChooser; |
1888 |
|
} |
1889 |
|
|
1890 |
|
|
1891 |
|
|
1892 |
|
|
1893 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1894 |
653 |
public CalculationChooser getCalculationDialog()... |
1895 |
|
{ |
1896 |
653 |
return calculationDialog; |
1897 |
|
} |
1898 |
|
|
1899 |
|
|
1900 |
|
|
1901 |
|
|
1902 |
|
|
1903 |
|
|
1904 |
|
@param |
1905 |
|
@return |
1906 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
1907 |
469 |
public String setOverviewTitle(AlignFrame alignFrame)... |
1908 |
|
{ |
1909 |
469 |
if (this.overviewPanel == null) |
1910 |
|
{ |
1911 |
367 |
return null; |
1912 |
|
} |
1913 |
102 |
String overviewTitle = MessageManager |
1914 |
|
.formatMessage("label.overview_params", new Object[] |
1915 |
|
{ alignFrame.getTitle() }); |
1916 |
102 |
String viewName = getViewName(); |
1917 |
102 |
if (viewName != null) |
1918 |
|
{ |
1919 |
65 |
overviewTitle += (" " + viewName); |
1920 |
|
} |
1921 |
102 |
overviewPanel.setTitle(overviewTitle); |
1922 |
102 |
return overviewTitle; |
1923 |
|
} |
1924 |
|
|
1925 |
|
|
1926 |
|
|
1927 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1928 |
32 |
public void closeOverviewPanel()... |
1929 |
|
{ |
1930 |
32 |
if (overviewPanel != null) |
1931 |
|
{ |
1932 |
12 |
overviewPanel.close(); |
1933 |
12 |
overviewPanel = null; |
1934 |
|
} |
1935 |
|
} |
1936 |
|
} |