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