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.4% |
Uncovered Elements: 302 (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 |
475 |
public AlignmentPanel(AlignFrame af, final AlignViewport av)... |
129 |
|
{ |
130 |
|
|
131 |
475 |
alignFrame = af; |
132 |
475 |
this.av = av; |
133 |
475 |
setSeqPanel(new SeqPanel(av, this)); |
134 |
475 |
setIdPanel(new IdPanel(av, this)); |
135 |
|
|
136 |
475 |
setScalePanel(new ScalePanel(av, this)); |
137 |
|
|
138 |
475 |
idPanelHolder.add(getIdPanel(), BorderLayout.CENTER); |
139 |
475 |
idwidthAdjuster = new IdwidthAdjuster(this); |
140 |
475 |
idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER); |
141 |
|
|
142 |
475 |
setAnnotationPanel(new AnnotationPanel(this)); |
143 |
475 |
setAlabels(new AnnotationLabels(this)); |
144 |
|
|
145 |
475 |
annotationScroller.setViewportView(getAnnotationPanel()); |
146 |
475 |
annotationSpaceFillerHolder.add(getAlabels(), BorderLayout.CENTER); |
147 |
|
|
148 |
475 |
scalePanelHolder.add(getScalePanel(), BorderLayout.CENTER); |
149 |
475 |
seqPanelHolder.add(getSeqPanel(), BorderLayout.CENTER); |
150 |
|
|
151 |
475 |
setScrollValues(0, 0); |
152 |
|
|
153 |
475 |
hscroll.addAdjustmentListener(this); |
154 |
475 |
vscroll.addAdjustmentListener(this); |
155 |
|
|
156 |
475 |
addComponentListener(new ComponentAdapter() |
157 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
158 |
510 |
@Override... |
159 |
|
public void componentResized(ComponentEvent evt) |
160 |
|
{ |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
510 |
ViewportRanges ranges = av.getRanges(); |
165 |
510 |
if (av.getWrapAlignment()) |
166 |
|
{ |
167 |
9 |
int widthInRes = getSeqPanel().seqCanvas.getWrappedCanvasWidth( |
168 |
|
getSeqPanel().seqCanvas.getWidth()); |
169 |
9 |
ranges.setViewportWidth(widthInRes); |
170 |
|
} |
171 |
|
else |
172 |
|
{ |
173 |
501 |
int widthInRes = getSeqPanel().seqCanvas.getWidth() |
174 |
|
/ av.getCharWidth(); |
175 |
501 |
int heightInSeq = getSeqPanel().seqCanvas.getHeight() |
176 |
|
/ av.getCharHeight(); |
177 |
|
|
178 |
501 |
ranges.setViewportWidth(widthInRes); |
179 |
501 |
ranges.setViewportHeight(heightInSeq); |
180 |
|
} |
181 |
|
} |
182 |
|
|
183 |
|
}); |
184 |
|
|
185 |
475 |
final AlignmentPanel ap = this; |
186 |
475 |
propertyChangeListener = new PropertyChangeListener() |
187 |
|
{ |
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
188 |
64 |
@Override... |
189 |
|
public void propertyChange(PropertyChangeEvent evt) |
190 |
|
{ |
191 |
64 |
if (evt.getPropertyName().equals("alignment")) |
192 |
|
{ |
193 |
64 |
PaintRefresher.Refresh(ap, av.getSequenceSetId(), true, true); |
194 |
63 |
alignmentChanged(); |
195 |
|
} |
196 |
|
} |
197 |
|
}; |
198 |
475 |
av.addPropertyChangeListener(propertyChangeListener); |
199 |
|
|
200 |
475 |
av.getRanges().addPropertyChangeListener(this); |
201 |
475 |
fontChanged(); |
202 |
475 |
adjustAnnotationHeight(); |
203 |
475 |
updateLayout(); |
204 |
|
} |
205 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
619 |
@Override... |
207 |
|
public AlignViewportI getAlignViewport() |
208 |
|
{ |
209 |
619 |
return av; |
210 |
|
} |
211 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
212 |
528 |
public void alignmentChanged()... |
213 |
|
{ |
214 |
528 |
av.alignmentChanged(this); |
215 |
|
|
216 |
528 |
if (getCalculationDialog() != null) |
217 |
|
{ |
218 |
0 |
getCalculationDialog().validateCalcTypes(); |
219 |
|
} |
220 |
|
|
221 |
528 |
alignFrame.updateEditMenuBar(); |
222 |
|
|
223 |
|
|
224 |
528 |
paintAlignment(true, true); |
225 |
|
|
226 |
|
} |
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
231 |
1477 |
public void fontChanged()... |
232 |
|
{ |
233 |
|
|
234 |
|
|
235 |
1477 |
FontMetrics fm = getFontMetrics(av.getFont()); |
236 |
|
|
237 |
|
|
238 |
|
|
239 |
1477 |
av.validCharWidth = fm.charWidth('M') <= av.getCharWidth(); |
240 |
|
|
241 |
1477 |
scalePanelHolder.setPreferredSize( |
242 |
|
new Dimension(10, av.getCharHeight() + fm.getDescent())); |
243 |
1477 |
idSpaceFillerPanel1.setPreferredSize( |
244 |
|
new Dimension(10, av.getCharHeight() + fm.getDescent())); |
245 |
1477 |
idwidthAdjuster.invalidate(); |
246 |
1477 |
scalePanelHolder.invalidate(); |
247 |
|
|
248 |
1477 |
getSeqPanel().seqCanvas.img = null; |
249 |
1477 |
getAnnotationPanel().adjustPanelHeight(); |
250 |
|
|
251 |
1477 |
Dimension d = calculateIdWidth(); |
252 |
1477 |
getIdPanel().getIdCanvas().setPreferredSize(d); |
253 |
1477 |
hscrollFillerPanel.setPreferredSize(d); |
254 |
|
|
255 |
1477 |
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 |
1480 |
public Dimension calculateIdWidth()... |
269 |
|
{ |
270 |
1480 |
int oldWidth = av.getIdWidth(); |
271 |
|
|
272 |
|
|
273 |
1480 |
Dimension r = null; |
274 |
1480 |
if (av.getIdWidth() < 0) |
275 |
|
{ |
276 |
446 |
r = calculateDefaultAlignmentIdWidth(); |
277 |
446 |
av.setIdWidth(r.width); |
278 |
|
} |
279 |
|
else |
280 |
|
{ |
281 |
1034 |
r = new Dimension(); |
282 |
1034 |
r.width = av.getIdWidth(); |
283 |
1034 |
r.height = 0; |
284 |
|
} |
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
|
290 |
1480 |
if (r.width != oldWidth) |
291 |
|
{ |
292 |
446 |
idPanelHolder.setPreferredSize(r); |
293 |
446 |
validate(); |
294 |
|
} |
295 |
1480 |
return r; |
296 |
|
} |
297 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
298 |
2593 |
public Dimension calculateDefaultAlignmentIdWidth()... |
299 |
|
{ |
300 |
2593 |
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 |
41 |
public int getLegacyIdWidth()... |
309 |
|
{ |
310 |
41 |
int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300); |
311 |
41 |
int idWidth = Math.min(afwidth - 200, 2 * afwidth / 3); |
312 |
41 |
int maxwidth = Math.max(IdwidthAdjuster.MIN_ID_WIDTH, idWidth); |
313 |
41 |
Dimension w = calculateIdWidthOrLegacy(true, maxwidth, false, false); |
314 |
41 |
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 |
2669 |
public Dimension calculateIdWidth(int maxwidth,... |
350 |
|
boolean includeAnnotations, boolean visibleOnly) |
351 |
|
{ |
352 |
2669 |
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 |
2710 |
private Dimension calculateIdWidthOrLegacy(boolean legacy, int maxwidth,... |
368 |
|
boolean includeAnnotations, boolean visibleOnly) |
369 |
|
{ |
370 |
2710 |
Container c = new Container(); |
371 |
|
|
372 |
2710 |
FontMetrics fm = c.getFontMetrics( |
373 |
|
new Font(av.font.getName(), Font.ITALIC, av.font.getSize())); |
374 |
|
|
375 |
2710 |
AlignmentI al = av.getAlignment(); |
376 |
2710 |
int i = 0; |
377 |
2710 |
int idWidth = 0; |
378 |
|
|
379 |
31233 |
while ((i < al.getHeight()) && (al.getSequenceAt(i) != null)) |
380 |
|
{ |
381 |
28523 |
SequenceI s = al.getSequenceAt(i); |
382 |
28523 |
String id = s.getDisplayId(av.getShowJVSuffix()); |
383 |
28523 |
int stringWidth = fm.stringWidth(id); |
384 |
28523 |
idWidth = Math.max(idWidth, stringWidth); |
385 |
28523 |
i++; |
386 |
|
} |
387 |
|
|
388 |
|
|
389 |
2710 |
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 |
2710 |
int w = maxwidth < 0 ? idWidth : Math.min(maxwidth, idWidth); |
420 |
2710 |
w += ID_WIDTH_PADDING; |
421 |
|
|
422 |
2710 |
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 |
|
|
|
|
| 53.5% |
Uncovered Elements: 33 (71) |
Complexity: 18 |
Complexity Density: 0.42 |
|
464 |
5 |
protected boolean scrollToPosition(SearchResultsI results,... |
465 |
|
int verticalOffset, boolean centre) |
466 |
|
{ |
467 |
5 |
int startv, endv, starts, ends; |
468 |
5 |
ViewportRanges ranges = av.getRanges(); |
469 |
|
|
470 |
5 |
if (results == null || results.isEmpty() || av == null |
471 |
|
|| av.getAlignment() == null) |
472 |
|
{ |
473 |
0 |
return false; |
474 |
|
} |
475 |
5 |
int seqIndex = av.getAlignment().findIndex(results); |
476 |
5 |
if (seqIndex == -1) |
477 |
|
{ |
478 |
0 |
return false; |
479 |
|
} |
480 |
5 |
SequenceI seq = av.getAlignment().getSequenceAt(seqIndex); |
481 |
|
|
482 |
5 |
int[] r = results.getResults(seq, 0, av.getAlignment().getWidth()); |
483 |
5 |
if (r == null) |
484 |
|
{ |
485 |
0 |
return false; |
486 |
|
} |
487 |
5 |
int start = r[0]; |
488 |
5 |
int end = r[1]; |
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
|
494 |
5 |
if (centre) |
495 |
|
{ |
496 |
2 |
int offset = (ranges.getEndRes() - ranges.getStartRes() + 1) / 2 - 1; |
497 |
2 |
start = Math.max(start - offset, 0); |
498 |
2 |
end = end + offset - 1; |
499 |
|
} |
500 |
5 |
if (start < 0) |
501 |
|
{ |
502 |
0 |
return false; |
503 |
|
} |
504 |
5 |
if (end == seq.getEnd()) |
505 |
|
{ |
506 |
0 |
return false; |
507 |
|
} |
508 |
|
|
509 |
5 |
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 |
5 |
seqIndex = Math.max(0, seqIndex - verticalOffset); |
528 |
5 |
boolean scrollNeeded = true; |
529 |
|
|
530 |
5 |
if (!av.getWrapAlignment()) |
531 |
|
{ |
532 |
? |
if ((startv = ranges.getStartRes()) >= start) |
533 |
|
{ |
534 |
|
|
535 |
|
|
536 |
|
|
537 |
2 |
setScrollValues(start, seqIndex); |
538 |
|
} |
539 |
? |
else if ((endv = ranges.getEndRes()) <= end) |
540 |
|
{ |
541 |
|
|
542 |
|
|
543 |
|
|
544 |
2 |
setScrollValues(startv + end - endv, seqIndex); |
545 |
|
} |
546 |
0 |
else if ((starts = ranges.getStartSeq()) > seqIndex) |
547 |
|
{ |
548 |
|
|
549 |
|
|
550 |
|
|
551 |
0 |
setScrollValues(ranges.getStartRes(), seqIndex); |
552 |
|
} |
553 |
0 |
else if ((ends = ranges.getEndSeq()) <= seqIndex) |
554 |
|
{ |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
0 |
setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1); |
559 |
|
} |
560 |
|
|
561 |
|
|
562 |
|
|
563 |
4 |
scrollNeeded = false; |
564 |
|
} |
565 |
|
else |
566 |
|
{ |
567 |
1 |
scrollNeeded = ranges.scrollToWrappedVisible(start); |
568 |
|
} |
569 |
|
|
570 |
5 |
paintAlignment(false, false); |
571 |
|
|
572 |
5 |
return scrollNeeded; |
573 |
|
} |
574 |
|
|
575 |
|
|
576 |
|
|
577 |
|
|
578 |
|
@return |
579 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
580 |
52 |
public OverviewPanel getOverviewPanel()... |
581 |
|
{ |
582 |
52 |
return overviewPanel; |
583 |
|
} |
584 |
|
|
585 |
|
|
586 |
|
|
587 |
|
|
588 |
|
@param |
589 |
|
|
590 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
591 |
72 |
public void setOverviewPanel(OverviewPanel op)... |
592 |
|
{ |
593 |
72 |
overviewPanel = op; |
594 |
|
} |
595 |
|
|
596 |
|
|
597 |
|
|
598 |
|
@param |
599 |
|
|
600 |
|
|
601 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
602 |
619 |
public void setAnnotationVisible(boolean b)... |
603 |
|
{ |
604 |
619 |
if (!av.getWrapAlignment()) |
605 |
|
{ |
606 |
589 |
annotationSpaceFillerHolder.setVisible(b); |
607 |
589 |
annotationScroller.setVisible(b); |
608 |
|
} |
609 |
619 |
repaint(); |
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
616 |
1715 |
@Override... |
617 |
|
public void adjustAnnotationHeight() |
618 |
|
{ |
619 |
|
|
620 |
|
|
621 |
1715 |
if (alignFrame.getHeight() == 0) |
622 |
|
{ |
623 |
10 |
jalview.bin.Console.error( |
624 |
|
"adjustAnnotationHeight called with zero height alignment window"); |
625 |
|
} |
626 |
1715 |
validateAnnotationDimensions(true); |
627 |
1715 |
addNotify(); |
628 |
|
|
629 |
|
|
630 |
1715 |
paintAlignment(true, av.needToUpdateStructureViews()); |
631 |
|
} |
632 |
|
|
633 |
|
|
634 |
|
|
635 |
|
|
636 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 3 |
Complexity Density: 0.23 |
|
637 |
2598 |
protected void validateAnnotationDimensions(boolean adjustPanelHeight)... |
638 |
|
{ |
639 |
|
|
640 |
|
|
641 |
|
|
642 |
|
|
643 |
|
|
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
2598 |
AnnotationPanel ap = getAnnotationPanel(); |
649 |
2598 |
int annotationHeight = ap.adjustPanelHeight(); |
650 |
2598 |
annotationHeight = ap.adjustForAlignFrame(adjustPanelHeight, |
651 |
|
annotationHeight); |
652 |
|
|
653 |
2598 |
hscroll.addNotify(); |
654 |
2598 |
Dimension e = idPanel.getSize(); |
655 |
2598 |
int idWidth = e.width; |
656 |
2598 |
boolean manuallyAdjusted = this.getIdPanel().getIdCanvas() |
657 |
|
.isManuallyAdjusted(); |
658 |
2598 |
annotationScroller.setPreferredSize(new Dimension( |
659 |
2598 |
manuallyAdjusted ? idWidth : annotationScroller.getWidth(), |
660 |
|
annotationHeight)); |
661 |
|
|
662 |
2598 |
alabels.setPreferredSize(new Dimension(idWidth, annotationHeight)); |
663 |
|
|
664 |
2598 |
annotationSpaceFillerHolder.setPreferredSize(new Dimension( |
665 |
2598 |
manuallyAdjusted ? idWidth |
666 |
|
: annotationSpaceFillerHolder.getWidth(), |
667 |
|
annotationHeight)); |
668 |
2598 |
annotationScroller.validate(); |
669 |
2598 |
annotationScroller.addNotify(); |
670 |
2598 |
ap.validate(); |
671 |
|
} |
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
|
676 |
|
@param |
677 |
|
|
678 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (32) |
Complexity: 5 |
Complexity Density: 0.21 |
|
679 |
619 |
public void updateLayout()... |
680 |
|
{ |
681 |
619 |
fontChanged(); |
682 |
619 |
setAnnotationVisible(av.isShowAnnotation()); |
683 |
619 |
boolean wrap = av.getWrapAlignment(); |
684 |
619 |
ViewportRanges ranges = av.getRanges(); |
685 |
619 |
ranges.setStartSeq(0); |
686 |
|
|
687 |
619 |
hscroll.setVisible(!wrap); |
688 |
|
|
689 |
619 |
idwidthAdjuster.setVisible(true); |
690 |
|
|
691 |
619 |
if (wrap) |
692 |
|
{ |
693 |
30 |
annotationScroller.setVisible(false); |
694 |
30 |
annotationSpaceFillerHolder.setVisible(false); |
695 |
|
} |
696 |
589 |
else if (av.isShowAnnotation()) |
697 |
|
{ |
698 |
579 |
annotationScroller.setVisible(true); |
699 |
579 |
annotationSpaceFillerHolder.setVisible(true); |
700 |
579 |
validateAnnotationDimensions(false); |
701 |
|
} |
702 |
|
|
703 |
619 |
int canvasWidth = getSeqPanel().seqCanvas.getWidth(); |
704 |
619 |
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 |
619 |
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 |
3678 |
public void setScrollValues(int xpos, int ypos)... |
738 |
|
{ |
739 |
3678 |
int x = xpos; |
740 |
3678 |
int y = ypos; |
741 |
|
|
742 |
3678 |
if (av == null || av.getAlignment() == null) |
743 |
|
{ |
744 |
0 |
return; |
745 |
|
} |
746 |
|
|
747 |
3678 |
if (av.getWrapAlignment()) |
748 |
|
{ |
749 |
268 |
setScrollingForWrappedPanel(x); |
750 |
|
} |
751 |
|
else |
752 |
|
{ |
753 |
3410 |
int width = av.getAlignment().getVisibleWidth(); |
754 |
3410 |
int height = av.getAlignment().getHeight(); |
755 |
|
|
756 |
3410 |
hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(); |
757 |
3410 |
vextent = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(); |
758 |
|
|
759 |
3410 |
if (hextent > width) |
760 |
|
{ |
761 |
748 |
hextent = width; |
762 |
|
} |
763 |
|
|
764 |
3410 |
if (vextent > height) |
765 |
|
{ |
766 |
878 |
vextent = height; |
767 |
|
} |
768 |
|
|
769 |
3410 |
if ((hextent + x) > width) |
770 |
|
{ |
771 |
2 |
x = width - hextent; |
772 |
|
} |
773 |
|
|
774 |
3410 |
if ((vextent + y) > height) |
775 |
|
{ |
776 |
27 |
y = height - vextent; |
777 |
|
} |
778 |
|
|
779 |
3410 |
if (y < 0) |
780 |
|
{ |
781 |
0 |
y = 0; |
782 |
|
} |
783 |
|
|
784 |
3410 |
if (x < 0) |
785 |
|
{ |
786 |
1 |
x = 0; |
787 |
|
} |
788 |
|
|
789 |
|
|
790 |
3410 |
hscroll.setValues(x, hextent, 0, width); |
791 |
3410 |
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 |
713 |
@Override... |
819 |
|
public void adjustmentValueChanged(AdjustmentEvent evt) |
820 |
|
{ |
821 |
713 |
if (av.getWrapAlignment()) |
822 |
|
{ |
823 |
25 |
adjustScrollingWrapped(evt); |
824 |
25 |
return; |
825 |
|
} |
826 |
|
|
827 |
688 |
ViewportRanges ranges = av.getRanges(); |
828 |
|
|
829 |
688 |
if (evt.getSource() == hscroll) |
830 |
|
{ |
831 |
298 |
int oldX = ranges.getStartRes(); |
832 |
298 |
int oldwidth = ranges.getViewportWidth(); |
833 |
298 |
int x = hscroll.getValue(); |
834 |
298 |
int width = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth(); |
835 |
|
|
836 |
|
|
837 |
|
|
838 |
|
|
839 |
298 |
if ((x == oldX) && (width == oldwidth)) |
840 |
|
{ |
841 |
54 |
return; |
842 |
|
} |
843 |
244 |
ranges.setViewportStartAndWidth(x, width); |
844 |
|
} |
845 |
390 |
else if (evt.getSource() == vscroll) |
846 |
|
{ |
847 |
390 |
int oldY = ranges.getStartSeq(); |
848 |
390 |
int oldheight = ranges.getViewportHeight(); |
849 |
390 |
int y = vscroll.getValue(); |
850 |
390 |
int height = getSeqPanel().seqCanvas.getHeight() / av.getCharHeight(); |
851 |
|
|
852 |
|
|
853 |
|
|
854 |
|
|
855 |
390 |
if ((y == oldY) && (height == oldheight)) |
856 |
|
{ |
857 |
31 |
return; |
858 |
|
} |
859 |
359 |
ranges.setViewportStartAndHeight(y, height); |
860 |
|
} |
861 |
603 |
repaint(); |
862 |
|
} |
863 |
|
|
864 |
|
|
865 |
|
|
866 |
|
|
867 |
|
|
868 |
|
@param |
869 |
|
|
|
|
| 44% |
Uncovered Elements: 14 (25) |
Complexity: 6 |
Complexity Density: 0.4 |
|
870 |
25 |
protected void adjustScrollingWrapped(AdjustmentEvent evt)... |
871 |
|
{ |
872 |
25 |
if (evt.getSource() == hscroll) |
873 |
|
{ |
874 |
0 |
return; |
875 |
|
} |
876 |
25 |
final ViewportRanges ranges = av.getRanges(); |
877 |
|
|
878 |
25 |
if (evt.getSource() == vscroll) |
879 |
|
{ |
880 |
25 |
int newY = vscroll.getValue(); |
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
|
885 |
|
|
886 |
|
|
887 |
25 |
int oldX = ranges.getStartRes(); |
888 |
25 |
int oldY = ranges.getWrappedScrollPosition(oldX); |
889 |
25 |
if (oldY == newY) |
890 |
|
{ |
891 |
25 |
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 |
5424 |
@Override... |
933 |
|
public void paintAlignment(boolean updateOverview, |
934 |
|
boolean updateStructures) |
935 |
|
{ |
936 |
5424 |
final AnnotationSorter sorter = new AnnotationSorter(getAlignment(), |
937 |
|
av.isShowAutocalculatedAbove()); |
938 |
5423 |
sorter.sort(getAlignment().getAlignmentAnnotation(), |
939 |
|
av.getSortAnnotationsBy()); |
940 |
5423 |
repaint(); |
941 |
|
|
942 |
5423 |
if (updateStructures) |
943 |
|
{ |
944 |
3565 |
av.getStructureSelectionManager().sequenceColoursChanged(this); |
945 |
|
} |
946 |
5423 |
if (updateOverview) |
947 |
|
{ |
948 |
|
|
949 |
5387 |
if (overviewPanel != null) |
950 |
|
{ |
951 |
363 |
overviewPanel.updateOverviewImage(); |
952 |
|
} |
953 |
|
} |
954 |
|
} |
955 |
|
|
|
|
| 75% |
Uncovered Elements: 5 (20) |
Complexity: 4 |
Complexity Density: 0.25 |
|
956 |
2581 |
@Override... |
957 |
|
public void paintComponent(Graphics g) |
958 |
|
{ |
959 |
2581 |
invalidate(); |
960 |
2581 |
Dimension d = getIdPanel().getIdCanvas().getPreferredSize(); |
961 |
2581 |
int idWidth = d.width; |
962 |
|
|
963 |
|
|
964 |
2581 |
if (av.getWrapAlignment()) |
965 |
|
{ |
966 |
243 |
SeqCanvas sc = this.getSeqPanel().seqCanvas; |
967 |
243 |
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 |
2581 |
idPanelHolder.setPreferredSize(new Dimension(idWidth, d.height)); |
980 |
2581 |
hscrollFillerPanel.setPreferredSize(new Dimension(idWidth, 12)); |
981 |
|
|
982 |
2581 |
validate(); |
983 |
|
|
984 |
|
|
985 |
|
|
986 |
|
|
987 |
|
|
988 |
2581 |
ViewportRanges ranges = av.getRanges(); |
989 |
2581 |
setScrollValues(ranges.getStartRes(), ranges.getStartSeq()); |
990 |
2581 |
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 |
268 |
private void setScrollingForWrappedPanel(int topLeftColumn)... |
1001 |
|
{ |
1002 |
268 |
ViewportRanges ranges = av.getRanges(); |
1003 |
268 |
int scrollPosition = ranges.getWrappedScrollPosition(topLeftColumn); |
1004 |
268 |
int maxScroll = ranges.getWrappedMaxScroll(topLeftColumn); |
1005 |
|
|
1006 |
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
|
1010 |
268 |
vscroll.setUnitIncrement(1); |
1011 |
268 |
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 |
252 |
public void closePanel()... |
1591 |
|
{ |
1592 |
252 |
PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas); |
1593 |
252 |
PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas()); |
1594 |
252 |
PaintRefresher.RemoveComponent(this); |
1595 |
|
|
1596 |
252 |
closeChildFrames(); |
1597 |
|
|
1598 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
252 |
if (annotationPanel != null) |
1602 |
|
{ |
1603 |
252 |
annotationPanel.dispose(); |
1604 |
252 |
annotationPanel = null; |
1605 |
|
} |
1606 |
|
|
1607 |
252 |
if (av != null) |
1608 |
|
{ |
1609 |
252 |
av.removePropertyChangeListener(propertyChangeListener); |
1610 |
252 |
propertyChangeListener = null; |
1611 |
252 |
StructureSelectionManager ssm = av.getStructureSelectionManager(); |
1612 |
252 |
ssm.removeStructureViewerListener(getSeqPanel(), null); |
1613 |
252 |
ssm.removeSelectionListener(getSeqPanel()); |
1614 |
252 |
ssm.removeCommandListener(av); |
1615 |
252 |
ssm.removeStructureViewerListener(getSeqPanel(), null); |
1616 |
252 |
ssm.removeSelectionListener(getSeqPanel()); |
1617 |
252 |
av.dispose(); |
1618 |
252 |
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 |
252 |
protected void closeChildFrames()... |
1633 |
|
{ |
1634 |
252 |
if (overviewPanel != null) |
1635 |
|
{ |
1636 |
1 |
overviewPanel.dispose(); |
1637 |
1 |
overviewPanel = null; |
1638 |
|
} |
1639 |
252 |
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 |
126 |
public void updateAnnotation(boolean applyGlobalSettings,... |
1660 |
|
boolean preserveNewGroupSettings) |
1661 |
|
{ |
1662 |
126 |
av.updateGroupAnnotationSettings(applyGlobalSettings, |
1663 |
|
preserveNewGroupSettings); |
1664 |
126 |
adjustAnnotationHeight(); |
1665 |
|
} |
1666 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1667 |
11973 |
@Override... |
1668 |
|
public AlignmentI getAlignment() |
1669 |
|
{ |
1670 |
11973 |
return av == null ? null : av.getAlignment(); |
1671 |
|
} |
1672 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1673 |
2734 |
@Override... |
1674 |
|
public String getViewName() |
1675 |
|
{ |
1676 |
2734 |
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 |
392 |
@Override... |
1730 |
|
public jalview.api.FeatureRenderer getFeatureRenderer() |
1731 |
|
{ |
1732 |
392 |
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 |
554 |
public ScalePanel getScalePanel()... |
1750 |
|
{ |
1751 |
554 |
return scalePanel; |
1752 |
|
} |
1753 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1754 |
475 |
public void setScalePanel(ScalePanel scalePanel)... |
1755 |
|
{ |
1756 |
475 |
this.scalePanel = scalePanel; |
1757 |
|
} |
1758 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1759 |
14569 |
public SeqPanel getSeqPanel()... |
1760 |
|
{ |
1761 |
14569 |
return seqPanel; |
1762 |
|
} |
1763 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1764 |
475 |
public void setSeqPanel(SeqPanel seqPanel)... |
1765 |
|
{ |
1766 |
475 |
this.seqPanel = seqPanel; |
1767 |
|
} |
1768 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1769 |
14124 |
public AnnotationPanel getAnnotationPanel()... |
1770 |
|
{ |
1771 |
14124 |
return annotationPanel; |
1772 |
|
} |
1773 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1774 |
475 |
public void setAnnotationPanel(AnnotationPanel annotationPanel)... |
1775 |
|
{ |
1776 |
475 |
this.annotationPanel = annotationPanel; |
1777 |
|
} |
1778 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1779 |
14437 |
public AnnotationLabels getAlabels()... |
1780 |
|
{ |
1781 |
14437 |
return alabels; |
1782 |
|
} |
1783 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1784 |
475 |
public void setAlabels(AnnotationLabels alabels)... |
1785 |
|
{ |
1786 |
475 |
this.alabels = alabels; |
1787 |
|
} |
1788 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1789 |
10789 |
public IdPanel getIdPanel()... |
1790 |
|
{ |
1791 |
10789 |
return idPanel; |
1792 |
|
} |
1793 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1794 |
475 |
public void setIdPanel(IdPanel idPanel)... |
1795 |
|
{ |
1796 |
475 |
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 |
2 |
protected void scrollToCentre(SearchResultsI sr, int verticalOffset)... |
1810 |
|
{ |
1811 |
2 |
scrollToPosition(sr, verticalOffset, true); |
1812 |
|
} |
1813 |
|
|
1814 |
|
|
1815 |
|
|
1816 |
|
|
1817 |
|
@param |
1818 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1819 |
1216 |
protected void setToScrollComplementPanel(boolean b)... |
1820 |
|
{ |
1821 |
1216 |
this.scrollComplementaryPanel = b; |
1822 |
|
} |
1823 |
|
|
1824 |
|
|
1825 |
|
|
1826 |
|
|
1827 |
|
@return |
1828 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1829 |
610 |
protected boolean isSetToScrollComplementPanel()... |
1830 |
|
{ |
1831 |
610 |
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 |
610 |
@Override... |
1857 |
|
|
1858 |
|
|
1859 |
|
|
1860 |
|
|
1861 |
|
public void propertyChange(PropertyChangeEvent evt) |
1862 |
|
{ |
1863 |
|
|
1864 |
610 |
ViewportRanges ranges = av.getRanges(); |
1865 |
610 |
int x = ranges.getStartRes(); |
1866 |
610 |
int y = ranges.getStartSeq(); |
1867 |
610 |
setScrollValues(x, y); |
1868 |
|
|
1869 |
|
|
1870 |
|
|
1871 |
610 |
if (isSetToScrollComplementPanel()) |
1872 |
|
{ |
1873 |
605 |
setToScrollComplementPanel(false); |
1874 |
605 |
av.scrollComplementaryAlignment(); |
1875 |
605 |
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 |
632 |
public CalculationChooser getCalculationDialog()... |
1895 |
|
{ |
1896 |
632 |
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 |
454 |
public String setOverviewTitle(AlignFrame alignFrame)... |
1908 |
|
{ |
1909 |
454 |
if (this.overviewPanel == null) |
1910 |
|
{ |
1911 |
367 |
return null; |
1912 |
|
} |
1913 |
87 |
String overviewTitle = MessageManager |
1914 |
|
.formatMessage("label.overview_params", new Object[] |
1915 |
|
{ alignFrame.getTitle() }); |
1916 |
87 |
String viewName = getViewName(); |
1917 |
87 |
if (viewName != null) |
1918 |
|
{ |
1919 |
53 |
overviewTitle += (" " + viewName); |
1920 |
|
} |
1921 |
87 |
overviewPanel.setTitle(overviewTitle); |
1922 |
87 |
return overviewTitle; |
1923 |
|
} |
1924 |
|
|
1925 |
|
|
1926 |
|
|
1927 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1928 |
30 |
public void closeOverviewPanel()... |
1929 |
|
{ |
1930 |
30 |
if (overviewPanel != null) |
1931 |
|
{ |
1932 |
10 |
overviewPanel.close(); |
1933 |
10 |
overviewPanel = null; |
1934 |
|
} |
1935 |
|
} |
1936 |
|
} |