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.Font; |
26 |
|
import java.awt.FontMetrics; |
27 |
|
import java.awt.Point; |
28 |
|
import java.awt.event.ActionEvent; |
29 |
|
import java.awt.event.ActionListener; |
30 |
|
import java.awt.event.MouseEvent; |
31 |
|
import java.awt.event.MouseListener; |
32 |
|
import java.awt.event.MouseMotionListener; |
33 |
|
import java.awt.event.MouseWheelEvent; |
34 |
|
import java.awt.event.MouseWheelListener; |
35 |
|
import java.util.ArrayList; |
36 |
|
import java.util.Collections; |
37 |
|
import java.util.List; |
38 |
|
|
39 |
|
import javax.swing.JLabel; |
40 |
|
import javax.swing.JPanel; |
41 |
|
import javax.swing.JToolTip; |
42 |
|
import javax.swing.SwingUtilities; |
43 |
|
import javax.swing.Timer; |
44 |
|
import javax.swing.ToolTipManager; |
45 |
|
|
46 |
|
import jalview.api.AlignViewportI; |
47 |
|
import jalview.bin.Console; |
48 |
|
import jalview.commands.EditCommand; |
49 |
|
import jalview.commands.EditCommand.Action; |
50 |
|
import jalview.commands.EditCommand.Edit; |
51 |
|
import jalview.datamodel.AlignmentAnnotation; |
52 |
|
import jalview.datamodel.AlignmentI; |
53 |
|
import jalview.datamodel.ColumnSelection; |
54 |
|
import jalview.datamodel.HiddenColumns; |
55 |
|
import jalview.datamodel.MappedFeatures; |
56 |
|
import jalview.datamodel.SearchResultMatchI; |
57 |
|
import jalview.datamodel.SearchResults; |
58 |
|
import jalview.datamodel.SearchResultsI; |
59 |
|
import jalview.datamodel.Sequence; |
60 |
|
import jalview.datamodel.SequenceFeature; |
61 |
|
import jalview.datamodel.SequenceGroup; |
62 |
|
import jalview.datamodel.SequenceI; |
63 |
|
import jalview.io.SequenceAnnotationReport; |
64 |
|
import jalview.renderer.ResidueShaderI; |
65 |
|
import jalview.schemes.ResidueProperties; |
66 |
|
import jalview.structure.SelectionListener; |
67 |
|
import jalview.structure.SelectionSource; |
68 |
|
import jalview.structure.SequenceListener; |
69 |
|
import jalview.structure.StructureSelectionManager; |
70 |
|
import jalview.structure.VamsasSource; |
71 |
|
import jalview.util.Comparison; |
72 |
|
import jalview.util.MappingUtils; |
73 |
|
import jalview.util.MessageManager; |
74 |
|
import jalview.util.Platform; |
75 |
|
import jalview.viewmodel.AlignmentViewport; |
76 |
|
import jalview.viewmodel.ViewportRanges; |
77 |
|
import jalview.viewmodel.seqfeatures.FeatureRendererModel; |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
@author |
83 |
|
@version |
84 |
|
|
|
|
| 16.3% |
Uncovered Elements: 1,272 (1,519) |
Complexity: 413 |
Complexity Density: 0.45 |
|
85 |
|
public class SeqPanel extends JPanel |
86 |
|
implements MouseListener, MouseMotionListener, MouseWheelListener, |
87 |
|
SequenceListener, SelectionListener |
88 |
|
{ |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
|
|
| 22.2% |
Uncovered Elements: 14 (18) |
Complexity: 7 |
Complexity Density: 0.64 |
|
98 |
|
static class MousePos |
99 |
|
{ |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
final int column; |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
final int seqIndex; |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
final int annotationIndex; |
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
118 |
57 |
MousePos(int col, int seq, int ann)... |
119 |
|
{ |
120 |
57 |
column = col; |
121 |
57 |
seqIndex = seq; |
122 |
57 |
annotationIndex = ann; |
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
125 |
0 |
boolean isOverAnnotation()... |
126 |
|
{ |
127 |
0 |
return annotationIndex != -1; |
128 |
|
} |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
130 |
0 |
@Override... |
131 |
|
public boolean equals(Object obj) |
132 |
|
{ |
133 |
0 |
if (obj == null || !(obj instanceof MousePos)) |
134 |
|
{ |
135 |
0 |
return false; |
136 |
|
} |
137 |
0 |
MousePos o = (MousePos) obj; |
138 |
0 |
boolean b = (column == o.column && seqIndex == o.seqIndex |
139 |
|
&& annotationIndex == o.annotationIndex); |
140 |
|
|
141 |
0 |
return b; |
142 |
|
} |
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
0 |
@Override... |
149 |
|
public int hashCode() |
150 |
|
{ |
151 |
0 |
return column + seqIndex + annotationIndex; |
152 |
|
} |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
157 |
0 |
@Override... |
158 |
|
public String toString() |
159 |
|
{ |
160 |
0 |
return String.format("c%d:s%d:a%d", column, seqIndex, |
161 |
|
annotationIndex); |
162 |
|
} |
163 |
|
} |
164 |
|
|
165 |
|
private static final int MAX_TOOLTIP_LENGTH = 300; |
166 |
|
|
167 |
|
public SeqCanvas seqCanvas; |
168 |
|
|
169 |
|
public AlignmentPanel ap; |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
private MousePos lastMousePosition; |
175 |
|
|
176 |
|
protected int editLastRes; |
177 |
|
|
178 |
|
protected int editStartSeq; |
179 |
|
|
180 |
|
protected AlignViewport av; |
181 |
|
|
182 |
|
ScrollThread scrollThread = null; |
183 |
|
|
184 |
|
boolean mouseDragging = false; |
185 |
|
|
186 |
|
boolean editingSeqs = false; |
187 |
|
|
188 |
|
boolean groupEditing = false; |
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
int oldSeq = -1; |
194 |
|
|
195 |
|
boolean changeEndSeq = false; |
196 |
|
|
197 |
|
boolean changeStartSeq = false; |
198 |
|
|
199 |
|
boolean changeEndRes = false; |
200 |
|
|
201 |
|
boolean changeStartRes = false; |
202 |
|
|
203 |
|
SequenceGroup stretchGroup = null; |
204 |
|
|
205 |
|
boolean remove = false; |
206 |
|
|
207 |
|
Point lastMousePress; |
208 |
|
|
209 |
|
boolean mouseWheelPressed = false; |
210 |
|
|
211 |
|
StringBuffer keyboardNo1; |
212 |
|
|
213 |
|
StringBuffer keyboardNo2; |
214 |
|
|
215 |
|
private final SequenceAnnotationReport seqARep; |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
private String lastTooltip; |
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
private String lastFormattedTooltip; |
230 |
|
|
231 |
|
EditCommand editCommand; |
232 |
|
|
233 |
|
StructureSelectionManager ssm; |
234 |
|
|
235 |
|
SearchResultsI lastSearchResults; |
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
@param |
241 |
|
@param |
242 |
|
|
|
|
| 94.7% |
Uncovered Elements: 1 (19) |
Complexity: 2 |
Complexity Density: 0.12 |
|
243 |
478 |
public SeqPanel(AlignViewport viewport, AlignmentPanel alignPanel)... |
244 |
|
{ |
245 |
478 |
seqARep = new SequenceAnnotationReport(true); |
246 |
478 |
ToolTipManager.sharedInstance().registerComponent(this); |
247 |
478 |
ToolTipManager.sharedInstance().setInitialDelay(0); |
248 |
478 |
ToolTipManager.sharedInstance().setDismissDelay(10000); |
249 |
|
|
250 |
478 |
this.av = viewport; |
251 |
478 |
setBackground(Color.white); |
252 |
|
|
253 |
478 |
seqCanvas = new SeqCanvas(alignPanel); |
254 |
478 |
setLayout(new BorderLayout()); |
255 |
478 |
add(seqCanvas, BorderLayout.CENTER); |
256 |
|
|
257 |
478 |
this.ap = alignPanel; |
258 |
|
|
259 |
478 |
if (!viewport.isDataset()) |
260 |
|
{ |
261 |
478 |
addMouseMotionListener(this); |
262 |
478 |
addMouseListener(this); |
263 |
478 |
addMouseWheelListener(this); |
264 |
478 |
ssm = viewport.getStructureSelectionManager(); |
265 |
478 |
ssm.addStructureViewerListener(this); |
266 |
478 |
ssm.addSelectionListener(this); |
267 |
|
} |
268 |
|
} |
269 |
|
|
270 |
|
int startWrapBlock = -1; |
271 |
|
|
272 |
|
int wrappedBlock = -1; |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
@param |
282 |
|
@return |
283 |
|
|
|
|
| 85.7% |
Uncovered Elements: 4 (28) |
Complexity: 4 |
Complexity Density: 0.18 |
|
284 |
57 |
MousePos findMousePosition(MouseEvent evt)... |
285 |
|
{ |
286 |
57 |
int col = findColumn(evt); |
287 |
57 |
int seqIndex = -1; |
288 |
57 |
int annIndex = -1; |
289 |
57 |
int y = evt.getY(); |
290 |
|
|
291 |
57 |
int charHeight = av.getCharHeight(); |
292 |
57 |
int alignmentHeight = av.getAlignment().getHeight(); |
293 |
57 |
if (av.getWrapAlignment()) |
294 |
|
{ |
295 |
57 |
seqCanvas.calculateWrappedGeometry(seqCanvas.getWidth(), |
296 |
|
seqCanvas.getHeight()); |
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
57 |
int yOffsetPx = y % seqCanvas.wrappedRepeatHeightPx; |
302 |
|
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
57 |
int alignmentHeightPixels = seqCanvas.wrappedSpaceAboveAlignment |
308 |
|
+ alignmentHeight * charHeight |
309 |
|
+ SeqCanvas.SEQS_ANNOTATION_GAP; |
310 |
57 |
if (yOffsetPx >= alignmentHeightPixels) |
311 |
|
{ |
312 |
|
|
313 |
|
|
314 |
|
|
315 |
|
|
316 |
16 |
AlignmentAnnotation[] anns = av.getAlignment() |
317 |
|
.getAlignmentAnnotation(); |
318 |
16 |
int rowOffsetPx = yOffsetPx - alignmentHeightPixels; |
319 |
16 |
annIndex = AnnotationPanel.getRowIndex(rowOffsetPx, anns); |
320 |
16 |
seqIndex = alignmentHeight - 1; |
321 |
|
} |
322 |
|
else |
323 |
|
{ |
324 |
|
|
325 |
|
|
326 |
|
|
327 |
41 |
yOffsetPx -= seqCanvas.wrappedSpaceAboveAlignment; |
328 |
41 |
if (yOffsetPx >= 0) |
329 |
|
{ |
330 |
24 |
seqIndex = Math.min(yOffsetPx / charHeight, alignmentHeight - 1); |
331 |
|
} |
332 |
|
} |
333 |
|
} |
334 |
|
else |
335 |
|
{ |
336 |
0 |
ViewportRanges ranges = av.getRanges(); |
337 |
0 |
seqIndex = Math.min((y / charHeight) + ranges.getStartSeq(), |
338 |
|
alignmentHeight - 1); |
339 |
0 |
seqIndex = Math.min(seqIndex, ranges.getEndSeq()); |
340 |
|
} |
341 |
|
|
342 |
57 |
return new MousePos(col, seqIndex, annIndex); |
343 |
|
} |
344 |
|
|
345 |
|
|
346 |
|
@param |
347 |
|
@return |
348 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
349 |
25 |
int findAlignmentColumn(MouseEvent evt)... |
350 |
|
{ |
351 |
25 |
return findNearestColumn(evt, true); |
352 |
|
} |
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
@param |
362 |
|
@return |
363 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
364 |
70 |
int findColumn(MouseEvent evt)... |
365 |
|
{ |
366 |
70 |
return findNearestColumn(evt, false); |
367 |
|
} |
368 |
|
|
369 |
|
|
370 |
|
@param |
371 |
|
|
372 |
|
|
373 |
|
@return |
374 |
|
|
|
|
| 96.2% |
Uncovered Elements: 2 (53) |
Complexity: 10 |
Complexity Density: 0.29 |
|
375 |
95 |
private int findNearestColumn(MouseEvent evt, boolean nearestColumn)... |
376 |
|
{ |
377 |
95 |
int res = 0; |
378 |
95 |
int x = evt.getX(); |
379 |
|
|
380 |
95 |
final int startRes = av.getRanges().getStartRes(); |
381 |
95 |
final int charWidth = av.getCharWidth(); |
382 |
|
|
383 |
95 |
if (av.getWrapAlignment()) |
384 |
|
{ |
385 |
71 |
int hgap = av.getCharHeight(); |
386 |
71 |
if (av.getScaleAboveWrapped()) |
387 |
|
{ |
388 |
31 |
hgap += av.getCharHeight(); |
389 |
|
} |
390 |
|
|
391 |
71 |
int cHeight = av.getAlignment().getHeight() * av.getCharHeight() |
392 |
|
+ hgap + seqCanvas.getAnnotationHeight(); |
393 |
|
|
394 |
71 |
int y = evt.getY(); |
395 |
71 |
y = Math.max(0, y - hgap); |
396 |
71 |
x -= seqCanvas.getLabelWidthWest(); |
397 |
71 |
if (x < 0) |
398 |
|
{ |
399 |
|
|
400 |
4 |
if (!nearestColumn) |
401 |
|
{ |
402 |
3 |
return -1; |
403 |
|
} |
404 |
|
else |
405 |
|
{ |
406 |
1 |
x = 0; |
407 |
|
} |
408 |
|
} |
409 |
|
|
410 |
68 |
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth()); |
411 |
68 |
if (cwidth < 1) |
412 |
|
{ |
413 |
0 |
return 0; |
414 |
|
} |
415 |
68 |
if (x >= cwidth * charWidth) |
416 |
|
{ |
417 |
2 |
if (!nearestColumn) |
418 |
|
{ |
419 |
|
|
420 |
1 |
return -1; |
421 |
|
} |
422 |
|
else |
423 |
|
{ |
424 |
1 |
x = cwidth * charWidth - 1; |
425 |
|
} |
426 |
|
} |
427 |
|
|
428 |
67 |
wrappedBlock = y / cHeight; |
429 |
67 |
wrappedBlock += startRes / cwidth; |
430 |
|
|
431 |
67 |
int startOffset = startRes % cwidth; |
432 |
67 |
res = wrappedBlock * cwidth + startOffset |
433 |
|
+ Math.min(cwidth - 1, x / charWidth); |
434 |
|
} |
435 |
|
else |
436 |
|
{ |
437 |
|
|
438 |
|
|
439 |
|
|
440 |
|
|
441 |
24 |
x = Math.min(x, seqCanvas.getX() + seqCanvas.getWidth()); |
442 |
24 |
if (nearestColumn) |
443 |
|
{ |
444 |
18 |
x = Math.max(x, 0); |
445 |
|
} |
446 |
|
|
447 |
24 |
res = (x / charWidth) + startRes; |
448 |
24 |
res = Math.min(res, av.getRanges().getEndRes()); |
449 |
|
|
450 |
|
} |
451 |
|
|
452 |
91 |
if (av.hasHiddenColumns()) |
453 |
|
{ |
454 |
15 |
res = av.getAlignment().getHiddenColumns() |
455 |
|
.visibleToAbsoluteColumn(res); |
456 |
|
} |
457 |
|
|
458 |
91 |
return res; |
459 |
|
} |
460 |
|
|
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.27 |
|
465 |
0 |
void endEditing()... |
466 |
|
{ |
467 |
0 |
try |
468 |
|
{ |
469 |
0 |
if (editCommand != null && editCommand.getSize() > 0) |
470 |
|
{ |
471 |
0 |
ap.alignFrame.addHistoryItem(editCommand); |
472 |
0 |
av.firePropertyChange("alignment", null, |
473 |
|
av.getAlignment().getSequences()); |
474 |
|
} |
475 |
|
} finally |
476 |
|
{ |
477 |
|
|
478 |
|
|
479 |
|
|
480 |
0 |
editStartSeq = -1; |
481 |
0 |
editLastRes = -1; |
482 |
0 |
editingSeqs = false; |
483 |
0 |
groupEditing = false; |
484 |
0 |
keyboardNo1 = null; |
485 |
0 |
keyboardNo2 = null; |
486 |
0 |
editCommand = null; |
487 |
|
} |
488 |
|
} |
489 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
490 |
0 |
void setCursorRow()... |
491 |
|
{ |
492 |
0 |
seqCanvas.cursorY = getKeyboardNo1() - 1; |
493 |
0 |
scrollToVisible(true); |
494 |
|
} |
495 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
496 |
0 |
void setCursorColumn()... |
497 |
|
{ |
498 |
0 |
seqCanvas.cursorX = getKeyboardNo1() - 1; |
499 |
0 |
scrollToVisible(true); |
500 |
|
} |
501 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
502 |
0 |
void setCursorRowAndColumn()... |
503 |
|
{ |
504 |
0 |
if (keyboardNo2 == null) |
505 |
|
{ |
506 |
0 |
keyboardNo2 = new StringBuffer(); |
507 |
|
} |
508 |
|
else |
509 |
|
{ |
510 |
0 |
seqCanvas.cursorX = getKeyboardNo1() - 1; |
511 |
0 |
seqCanvas.cursorY = getKeyboardNo2() - 1; |
512 |
0 |
scrollToVisible(true); |
513 |
|
} |
514 |
|
} |
515 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
516 |
0 |
void setCursorPosition()... |
517 |
|
{ |
518 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY); |
519 |
|
|
520 |
0 |
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1; |
521 |
0 |
scrollToVisible(true); |
522 |
|
} |
523 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
524 |
0 |
void moveCursor(int dx, int dy)... |
525 |
|
{ |
526 |
0 |
moveCursor(dx, dy, false); |
527 |
|
} |
528 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 8 |
Complexity Density: 0.33 |
|
529 |
0 |
void moveCursor(int dx, int dy, boolean nextWord)... |
530 |
|
{ |
531 |
0 |
HiddenColumns hidden = av.getAlignment().getHiddenColumns(); |
532 |
|
|
533 |
0 |
if (nextWord) |
534 |
|
{ |
535 |
0 |
int maxWidth = av.getAlignment().getWidth(); |
536 |
0 |
int maxHeight = av.getAlignment().getHeight(); |
537 |
0 |
SequenceI seqAtRow = av.getAlignment() |
538 |
|
.getSequenceAt(seqCanvas.cursorY); |
539 |
|
|
540 |
0 |
boolean isGap = Comparison |
541 |
|
.isGap(seqAtRow.getCharAt(seqCanvas.cursorX)); |
542 |
0 |
int p = seqCanvas.cursorX, lastP, r = seqCanvas.cursorY, lastR; |
543 |
0 |
do |
544 |
|
{ |
545 |
0 |
lastP = p; |
546 |
0 |
lastR = r; |
547 |
0 |
if (dy != 0) |
548 |
|
{ |
549 |
0 |
r += dy; |
550 |
0 |
if (r < 0) |
551 |
|
{ |
552 |
0 |
r = 0; |
553 |
|
} |
554 |
0 |
if (r >= maxHeight) |
555 |
|
{ |
556 |
0 |
r = maxHeight - 1; |
557 |
|
} |
558 |
0 |
seqAtRow = av.getAlignment().getSequenceAt(r); |
559 |
|
} |
560 |
0 |
p = nextVisible(hidden, maxWidth, p, dx); |
561 |
0 |
} while ((dx != 0 ? p != lastP : r != lastR) |
562 |
|
&& isGap == Comparison.isGap(seqAtRow.getCharAt(p))); |
563 |
0 |
seqCanvas.cursorX = p; |
564 |
0 |
seqCanvas.cursorY = r; |
565 |
|
} |
566 |
|
else |
567 |
|
{ |
568 |
0 |
int maxWidth = av.getAlignment().getWidth(); |
569 |
0 |
seqCanvas.cursorX = nextVisible(hidden, maxWidth, seqCanvas.cursorX, |
570 |
|
dx); |
571 |
0 |
seqCanvas.cursorY += dy; |
572 |
|
} |
573 |
0 |
scrollToVisible(false); |
574 |
|
} |
575 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 9 |
Complexity Density: 0.69 |
|
576 |
0 |
private int nextVisible(HiddenColumns hidden, int maxWidth, int original,... |
577 |
|
int dx) |
578 |
|
{ |
579 |
0 |
int newCursorX = original + dx; |
580 |
0 |
if (av.hasHiddenColumns() && !hidden.isVisible(newCursorX)) |
581 |
|
{ |
582 |
0 |
int visx = hidden.absoluteToVisibleColumn(newCursorX - dx); |
583 |
0 |
int[] region = hidden.getRegionWithEdgeAtRes(visx); |
584 |
|
|
585 |
0 |
if (region != null) |
586 |
|
{ |
587 |
0 |
if (dx == 1) |
588 |
|
{ |
589 |
|
|
590 |
0 |
newCursorX = region[1] + 1; |
591 |
|
} |
592 |
0 |
else if (dx == -1) |
593 |
|
{ |
594 |
|
|
595 |
0 |
newCursorX = region[0] - 1; |
596 |
|
} |
597 |
|
} |
598 |
|
} |
599 |
0 |
newCursorX = (newCursorX < 0) ? 0 : newCursorX; |
600 |
0 |
if (newCursorX >= maxWidth || !hidden.isVisible(newCursorX)) |
601 |
|
{ |
602 |
0 |
newCursorX = original; |
603 |
|
} |
604 |
0 |
return newCursorX; |
605 |
|
} |
606 |
|
|
607 |
|
|
608 |
|
|
609 |
|
|
610 |
|
@param |
611 |
|
|
612 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 9 |
Complexity Density: 0.45 |
|
613 |
0 |
void scrollToVisible(boolean jump)... |
614 |
|
{ |
615 |
0 |
if (seqCanvas.cursorX < 0) |
616 |
|
{ |
617 |
0 |
seqCanvas.cursorX = 0; |
618 |
|
} |
619 |
0 |
else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1) |
620 |
|
{ |
621 |
0 |
seqCanvas.cursorX = av.getAlignment().getWidth() - 1; |
622 |
|
} |
623 |
|
|
624 |
0 |
if (seqCanvas.cursorY < 0) |
625 |
|
{ |
626 |
0 |
seqCanvas.cursorY = 0; |
627 |
|
} |
628 |
0 |
else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1) |
629 |
|
{ |
630 |
0 |
seqCanvas.cursorY = av.getAlignment().getHeight() - 1; |
631 |
|
} |
632 |
|
|
633 |
0 |
endEditing(); |
634 |
|
|
635 |
0 |
boolean repaintNeeded = true; |
636 |
0 |
if (jump) |
637 |
|
{ |
638 |
|
|
639 |
|
|
640 |
0 |
repaintNeeded = !av.getRanges().setViewportLocation(seqCanvas.cursorX, |
641 |
|
seqCanvas.cursorY); |
642 |
|
} |
643 |
|
else |
644 |
|
{ |
645 |
0 |
if (av.getWrapAlignment()) |
646 |
|
{ |
647 |
|
|
648 |
0 |
int x = av.getAlignment().getHiddenColumns() |
649 |
|
.absoluteToVisibleColumn(seqCanvas.cursorX); |
650 |
0 |
av.getRanges().scrollToWrappedVisible(x); |
651 |
|
} |
652 |
|
else |
653 |
|
{ |
654 |
0 |
av.getRanges().scrollToVisible(seqCanvas.cursorX, |
655 |
|
seqCanvas.cursorY); |
656 |
|
} |
657 |
|
} |
658 |
|
|
659 |
0 |
if (av.getAlignment().getHiddenColumns().isVisible(seqCanvas.cursorX)) |
660 |
|
{ |
661 |
0 |
setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY), |
662 |
|
seqCanvas.cursorX, seqCanvas.cursorY); |
663 |
|
} |
664 |
|
|
665 |
0 |
if (repaintNeeded) |
666 |
|
{ |
667 |
0 |
seqCanvas.repaint(); |
668 |
|
} |
669 |
|
} |
670 |
|
|
|
|
| 0% |
Uncovered Elements: 53 (53) |
Complexity: 11 |
Complexity Density: 0.33 |
|
671 |
0 |
void setSelectionAreaAtCursor(boolean topLeft)... |
672 |
|
{ |
673 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY); |
674 |
|
|
675 |
0 |
if (av.getSelectionGroup() != null) |
676 |
|
{ |
677 |
0 |
SequenceGroup sg = av.getSelectionGroup(); |
678 |
|
|
679 |
0 |
int min = av.getAlignment().getHeight(), max = 0; |
680 |
0 |
for (int i = 0; i < sg.getSize(); i++) |
681 |
|
{ |
682 |
0 |
int index = av.getAlignment().findIndex(sg.getSequenceAt(i)); |
683 |
0 |
if (index > max) |
684 |
|
{ |
685 |
0 |
max = index; |
686 |
|
} |
687 |
0 |
if (index < min) |
688 |
|
{ |
689 |
0 |
min = index; |
690 |
|
} |
691 |
|
} |
692 |
|
|
693 |
0 |
max++; |
694 |
|
|
695 |
0 |
if (topLeft) |
696 |
|
{ |
697 |
0 |
sg.setStartRes(seqCanvas.cursorX); |
698 |
0 |
if (sg.getEndRes() < seqCanvas.cursorX) |
699 |
|
{ |
700 |
0 |
sg.setEndRes(seqCanvas.cursorX); |
701 |
|
} |
702 |
|
|
703 |
0 |
min = seqCanvas.cursorY; |
704 |
|
} |
705 |
|
else |
706 |
|
{ |
707 |
0 |
sg.setEndRes(seqCanvas.cursorX); |
708 |
0 |
if (sg.getStartRes() > seqCanvas.cursorX) |
709 |
|
{ |
710 |
0 |
sg.setStartRes(seqCanvas.cursorX); |
711 |
|
} |
712 |
|
|
713 |
0 |
max = seqCanvas.cursorY + 1; |
714 |
|
} |
715 |
|
|
716 |
0 |
if (min > max) |
717 |
|
{ |
718 |
|
|
719 |
0 |
av.setSelectionGroup(null); |
720 |
|
} |
721 |
|
else |
722 |
|
{ |
723 |
|
|
724 |
0 |
sg.getSequences(null).clear(); |
725 |
0 |
for (int i = min; i < max; i++) |
726 |
|
{ |
727 |
0 |
sg.addSequence(av.getAlignment().getSequenceAt(i), false); |
728 |
|
} |
729 |
|
} |
730 |
|
} |
731 |
|
|
732 |
0 |
if (av.getSelectionGroup() == null) |
733 |
|
{ |
734 |
0 |
SequenceGroup sg = new SequenceGroup(); |
735 |
0 |
sg.setStartRes(seqCanvas.cursorX); |
736 |
0 |
sg.setEndRes(seqCanvas.cursorX); |
737 |
0 |
sg.addSequence(sequence, false); |
738 |
0 |
av.setSelectionGroup(sg); |
739 |
|
} |
740 |
|
|
741 |
0 |
ap.paintAlignment(false, false); |
742 |
0 |
av.sendSelection(); |
743 |
|
} |
744 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
745 |
0 |
void insertGapAtCursor(boolean group)... |
746 |
|
{ |
747 |
0 |
groupEditing = group; |
748 |
0 |
editStartSeq = seqCanvas.cursorY; |
749 |
0 |
editLastRes = seqCanvas.cursorX; |
750 |
0 |
editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1()); |
751 |
0 |
endEditing(); |
752 |
|
} |
753 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
754 |
0 |
void deleteGapAtCursor(boolean group)... |
755 |
|
{ |
756 |
0 |
groupEditing = group; |
757 |
0 |
editStartSeq = seqCanvas.cursorY; |
758 |
0 |
editLastRes = seqCanvas.cursorX + getKeyboardNo1(); |
759 |
0 |
editSequence(false, false, seqCanvas.cursorX); |
760 |
0 |
endEditing(); |
761 |
|
} |
762 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
763 |
0 |
void insertNucAtCursor(boolean group, String nuc)... |
764 |
|
{ |
765 |
|
|
766 |
0 |
groupEditing = group; |
767 |
0 |
editStartSeq = seqCanvas.cursorY; |
768 |
0 |
editLastRes = seqCanvas.cursorX; |
769 |
0 |
editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1()); |
770 |
0 |
endEditing(); |
771 |
|
} |
772 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
773 |
0 |
void numberPressed(char value)... |
774 |
|
{ |
775 |
0 |
if (keyboardNo1 == null) |
776 |
|
{ |
777 |
0 |
keyboardNo1 = new StringBuffer(); |
778 |
|
} |
779 |
|
|
780 |
0 |
if (keyboardNo2 != null) |
781 |
|
{ |
782 |
0 |
keyboardNo2.append(value); |
783 |
|
} |
784 |
|
else |
785 |
|
{ |
786 |
0 |
keyboardNo1.append(value); |
787 |
|
} |
788 |
|
} |
789 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
790 |
0 |
int getKeyboardNo1()... |
791 |
|
{ |
792 |
0 |
try |
793 |
|
{ |
794 |
0 |
if (keyboardNo1 != null) |
795 |
|
{ |
796 |
0 |
int value = Integer.parseInt(keyboardNo1.toString()); |
797 |
0 |
keyboardNo1 = null; |
798 |
0 |
return value; |
799 |
|
} |
800 |
|
} catch (Exception x) |
801 |
|
{ |
802 |
|
} |
803 |
0 |
keyboardNo1 = null; |
804 |
0 |
return 1; |
805 |
|
} |
806 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
807 |
0 |
int getKeyboardNo2()... |
808 |
|
{ |
809 |
0 |
try |
810 |
|
{ |
811 |
0 |
if (keyboardNo2 != null) |
812 |
|
{ |
813 |
0 |
int value = Integer.parseInt(keyboardNo2.toString()); |
814 |
0 |
keyboardNo2 = null; |
815 |
0 |
return value; |
816 |
|
} |
817 |
|
} catch (Exception x) |
818 |
|
{ |
819 |
|
} |
820 |
0 |
keyboardNo2 = null; |
821 |
0 |
return 1; |
822 |
|
} |
823 |
|
|
824 |
|
|
825 |
|
|
826 |
|
|
827 |
|
@param |
828 |
|
|
829 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.46 |
|
830 |
0 |
@Override... |
831 |
|
public void mouseReleased(MouseEvent evt) |
832 |
|
{ |
833 |
0 |
MousePos pos = findMousePosition(evt); |
834 |
0 |
if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1) |
835 |
|
{ |
836 |
0 |
return; |
837 |
|
} |
838 |
|
|
839 |
0 |
boolean didDrag = mouseDragging; |
840 |
0 |
mouseDragging = false; |
841 |
0 |
mouseWheelPressed = false; |
842 |
|
|
843 |
0 |
if (evt.isPopupTrigger()) |
844 |
|
{ |
845 |
0 |
showPopupMenu(evt, pos); |
846 |
0 |
evt.consume(); |
847 |
0 |
return; |
848 |
|
} |
849 |
|
|
850 |
0 |
if (editingSeqs) |
851 |
|
{ |
852 |
0 |
endEditing(); |
853 |
|
} |
854 |
|
else |
855 |
|
{ |
856 |
0 |
doMouseReleasedDefineMode(evt, didDrag); |
857 |
|
} |
858 |
|
} |
859 |
|
|
860 |
|
|
861 |
|
|
862 |
|
|
863 |
|
@param |
864 |
|
|
865 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 10 |
Complexity Density: 0.45 |
|
866 |
0 |
@Override... |
867 |
|
public void mousePressed(MouseEvent evt) |
868 |
|
{ |
869 |
0 |
lastMousePress = evt.getPoint(); |
870 |
0 |
MousePos pos = findMousePosition(evt); |
871 |
0 |
if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1) |
872 |
|
{ |
873 |
0 |
return; |
874 |
|
} |
875 |
|
|
876 |
0 |
if (SwingUtilities.isMiddleMouseButton(evt)) |
877 |
|
{ |
878 |
0 |
mouseWheelPressed = true; |
879 |
0 |
return; |
880 |
|
} |
881 |
|
|
882 |
0 |
boolean isControlDown = Platform.isControlDown(evt); |
883 |
0 |
if (evt.isShiftDown() || isControlDown) |
884 |
|
{ |
885 |
0 |
editingSeqs = true; |
886 |
0 |
if (isControlDown) |
887 |
|
{ |
888 |
0 |
groupEditing = true; |
889 |
|
} |
890 |
|
} |
891 |
|
else |
892 |
|
{ |
893 |
0 |
doMousePressedDefineMode(evt, pos); |
894 |
0 |
return; |
895 |
|
} |
896 |
|
|
897 |
0 |
int seq = pos.seqIndex; |
898 |
0 |
int res = pos.column; |
899 |
|
|
900 |
0 |
if ((seq < av.getAlignment().getHeight()) |
901 |
|
&& (res < av.getAlignment().getSequenceAt(seq).getLength())) |
902 |
|
{ |
903 |
0 |
editStartSeq = seq; |
904 |
0 |
editLastRes = res; |
905 |
|
} |
906 |
|
else |
907 |
|
{ |
908 |
0 |
editStartSeq = -1; |
909 |
0 |
editLastRes = -1; |
910 |
|
} |
911 |
|
|
912 |
0 |
return; |
913 |
|
} |
914 |
|
|
915 |
|
String lastMessage; |
916 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
917 |
0 |
@Override... |
918 |
|
public void mouseOverSequence(SequenceI sequence, int index, int pos) |
919 |
|
{ |
920 |
0 |
String tmp = sequence.hashCode() + " " + index + " " + pos; |
921 |
|
|
922 |
0 |
if (lastMessage == null || !lastMessage.equals(tmp)) |
923 |
|
{ |
924 |
|
|
925 |
0 |
ssm.mouseOverSequence(sequence, index, pos, av); |
926 |
|
} |
927 |
0 |
lastMessage = tmp; |
928 |
|
} |
929 |
|
|
930 |
|
|
931 |
|
|
932 |
|
|
933 |
|
|
934 |
|
|
935 |
|
|
|
|
| 70.8% |
Uncovered Elements: 7 (24) |
Complexity: 7 |
Complexity Density: 0.5 |
|
936 |
1 |
@Override... |
937 |
|
public String highlightSequence(SearchResultsI results) |
938 |
|
{ |
939 |
1 |
if (results == null || results.equals(lastSearchResults)) |
940 |
|
{ |
941 |
0 |
return null; |
942 |
|
} |
943 |
1 |
lastSearchResults = results; |
944 |
|
|
945 |
1 |
boolean wasScrolled = false; |
946 |
|
|
947 |
1 |
if (av.isFollowHighlight()) |
948 |
|
{ |
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
|
953 |
1 |
ap.setToScrollComplementPanel(false); |
954 |
1 |
wasScrolled = ap.scrollToPosition(results); |
955 |
1 |
if (wasScrolled) |
956 |
|
{ |
957 |
0 |
seqCanvas.revalidate(); |
958 |
|
} |
959 |
1 |
ap.setToScrollComplementPanel(true); |
960 |
|
} |
961 |
|
|
962 |
1 |
boolean fastPaint = !(wasScrolled && av.getWrapAlignment()); |
963 |
1 |
if (seqCanvas.highlightSearchResults(results, fastPaint)) |
964 |
|
{ |
965 |
1 |
setStatusMessage(results); |
966 |
|
} |
967 |
1 |
return results.isEmpty() ? null : getHighlightInfo(results); |
968 |
|
} |
969 |
|
|
970 |
|
|
971 |
|
|
972 |
|
|
973 |
|
|
974 |
|
|
975 |
|
|
976 |
|
|
977 |
|
|
978 |
|
|
979 |
|
|
980 |
|
@param |
981 |
|
@return |
982 |
|
|
|
|
| 9.1% |
Uncovered Elements: 40 (44) |
Complexity: 10 |
Complexity Density: 0.36 |
|
983 |
1 |
private String getHighlightInfo(SearchResultsI results)... |
984 |
|
{ |
985 |
|
|
986 |
|
|
987 |
|
|
988 |
|
|
989 |
1 |
AlignViewportI complement = ap.getAlignViewport().getCodingComplement(); |
990 |
1 |
if (complement == null) |
991 |
|
{ |
992 |
1 |
return null; |
993 |
|
} |
994 |
0 |
AlignFrame af = Desktop.getAlignFrameFor(complement); |
995 |
0 |
FeatureRendererModel fr2 = af.getFeatureRenderer(); |
996 |
|
|
997 |
0 |
List<SearchResultMatchI> matches = results.getResults(); |
998 |
0 |
int j = matches.size(); |
999 |
0 |
List<String> infos = new ArrayList<>(); |
1000 |
0 |
for (int i = 0; i < j; i++) |
1001 |
|
{ |
1002 |
0 |
SearchResultMatchI match = matches.get(i); |
1003 |
0 |
int pos = match.getStart(); |
1004 |
0 |
if (pos == match.getEnd()) |
1005 |
|
{ |
1006 |
0 |
SequenceI seq = match.getSequence(); |
1007 |
0 |
SequenceI ds = seq.getDatasetSequence() == null ? seq |
1008 |
|
: seq.getDatasetSequence(); |
1009 |
0 |
MappedFeatures mf = fr2.findComplementFeaturesAtResidue(ds, pos); |
1010 |
0 |
if (mf != null) |
1011 |
|
{ |
1012 |
0 |
for (SequenceFeature sf : mf.features) |
1013 |
|
{ |
1014 |
0 |
String pv = mf.findProteinVariants(sf); |
1015 |
0 |
if (pv.length() > 0 && !infos.contains(pv)) |
1016 |
|
{ |
1017 |
0 |
infos.add(pv); |
1018 |
|
} |
1019 |
|
} |
1020 |
|
} |
1021 |
|
} |
1022 |
|
} |
1023 |
|
|
1024 |
0 |
if (infos.isEmpty()) |
1025 |
|
{ |
1026 |
0 |
return null; |
1027 |
|
} |
1028 |
0 |
StringBuilder sb = new StringBuilder(); |
1029 |
0 |
for (String info : infos) |
1030 |
|
{ |
1031 |
0 |
if (sb.length() > 0) |
1032 |
|
{ |
1033 |
0 |
sb.append("|"); |
1034 |
|
} |
1035 |
0 |
sb.append(info); |
1036 |
|
} |
1037 |
0 |
return sb.toString(); |
1038 |
|
} |
1039 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1040 |
0 |
@Override... |
1041 |
|
public VamsasSource getVamsasSource() |
1042 |
|
{ |
1043 |
0 |
return this.ap == null ? null : this.ap.av; |
1044 |
|
} |
1045 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1046 |
0 |
@Override... |
1047 |
|
public void updateColours(SequenceI seq, int index) |
1048 |
|
{ |
1049 |
0 |
jalview.bin.Console.outPrintln("update the seqPanel colours"); |
1050 |
|
|
1051 |
|
} |
1052 |
|
|
1053 |
|
|
1054 |
|
|
1055 |
|
|
1056 |
|
|
1057 |
|
|
1058 |
|
|
1059 |
|
@param |
1060 |
|
|
|
|
| 0% |
Uncovered Elements: 99 (99) |
Complexity: 25 |
Complexity Density: 0.41 |
|
1061 |
0 |
@Override... |
1062 |
|
public void mouseMoved(MouseEvent evt) |
1063 |
|
{ |
1064 |
0 |
if (editingSeqs) |
1065 |
|
{ |
1066 |
|
|
1067 |
|
|
1068 |
0 |
mouseDragged(evt); |
1069 |
|
} |
1070 |
|
|
1071 |
0 |
final MousePos mousePos = findMousePosition(evt); |
1072 |
0 |
if (mousePos.equals(lastMousePosition)) |
1073 |
|
{ |
1074 |
|
|
1075 |
|
|
1076 |
|
|
1077 |
0 |
moveTooltip = false; |
1078 |
0 |
return; |
1079 |
|
} |
1080 |
0 |
moveTooltip = true; |
1081 |
0 |
lastMousePosition = mousePos; |
1082 |
|
|
1083 |
0 |
if (mousePos.isOverAnnotation()) |
1084 |
|
{ |
1085 |
0 |
mouseMovedOverAnnotation(mousePos); |
1086 |
0 |
return; |
1087 |
|
} |
1088 |
0 |
final int seq = mousePos.seqIndex; |
1089 |
|
|
1090 |
0 |
final int column = mousePos.column; |
1091 |
0 |
if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight()) |
1092 |
|
{ |
1093 |
0 |
lastMousePosition = null; |
1094 |
0 |
setToolTipText(null); |
1095 |
0 |
lastTooltip = null; |
1096 |
0 |
lastFormattedTooltip = null; |
1097 |
0 |
ap.alignFrame.setStatus(""); |
1098 |
0 |
return; |
1099 |
|
} |
1100 |
|
|
1101 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seq); |
1102 |
|
|
1103 |
0 |
if (column >= sequence.getLength()) |
1104 |
|
{ |
1105 |
0 |
return; |
1106 |
|
} |
1107 |
|
|
1108 |
|
|
1109 |
|
|
1110 |
|
|
1111 |
0 |
boolean isGapped = Comparison.isGap(sequence.getCharAt(column)); |
1112 |
0 |
final int pos = setStatusMessage(sequence, column, seq); |
1113 |
0 |
if (ssm != null && !isGapped) |
1114 |
|
{ |
1115 |
0 |
mouseOverSequence(sequence, column, pos); |
1116 |
|
} |
1117 |
|
|
1118 |
0 |
StringBuilder tooltipText = new StringBuilder(64); |
1119 |
|
|
1120 |
0 |
SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence); |
1121 |
0 |
if (groups != null) |
1122 |
|
{ |
1123 |
0 |
for (int g = 0; g < groups.length; g++) |
1124 |
|
{ |
1125 |
0 |
if (groups[g].getStartRes() <= column |
1126 |
|
&& groups[g].getEndRes() >= column) |
1127 |
|
{ |
1128 |
0 |
if (!groups[g].getName().startsWith("JTreeGroup") |
1129 |
|
&& !groups[g].getName().startsWith("JGroup")) |
1130 |
|
{ |
1131 |
0 |
tooltipText.append(groups[g].getName()); |
1132 |
|
} |
1133 |
|
|
1134 |
0 |
if (groups[g].getDescription() != null) |
1135 |
|
{ |
1136 |
0 |
tooltipText.append(": " + groups[g].getDescription()); |
1137 |
|
} |
1138 |
|
} |
1139 |
|
} |
1140 |
|
} |
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
|
|
1145 |
|
|
1146 |
|
|
1147 |
0 |
int unshownFeatures = 0; |
1148 |
0 |
if (av.isShowSequenceFeatures()) |
1149 |
|
{ |
1150 |
0 |
List<SequenceFeature> features = ap.getFeatureRenderer() |
1151 |
|
.findFeaturesAtColumn(sequence, column + 1); |
1152 |
0 |
unshownFeatures = seqARep.appendFeatures(tooltipText, pos, features, |
1153 |
|
this.ap.getSeqPanel().seqCanvas.fr, MAX_TOOLTIP_LENGTH); |
1154 |
|
|
1155 |
|
|
1156 |
|
|
1157 |
|
|
1158 |
|
|
1159 |
0 |
if (av.isShowComplementFeatures()) |
1160 |
|
{ |
1161 |
0 |
if (!Comparison.isGap(sequence.getCharAt(column))) |
1162 |
|
{ |
1163 |
0 |
AlignViewportI complement = ap.getAlignViewport() |
1164 |
|
.getCodingComplement(); |
1165 |
0 |
AlignFrame af = Desktop.getAlignFrameFor(complement); |
1166 |
0 |
FeatureRendererModel fr2 = af.getFeatureRenderer(); |
1167 |
0 |
MappedFeatures mf = fr2.findComplementFeaturesAtResidue(sequence, |
1168 |
|
pos); |
1169 |
0 |
if (mf != null) |
1170 |
|
{ |
1171 |
0 |
unshownFeatures += seqARep.appendFeatures(tooltipText, pos, mf, |
1172 |
|
fr2, MAX_TOOLTIP_LENGTH); |
1173 |
|
} |
1174 |
|
} |
1175 |
|
} |
1176 |
|
} |
1177 |
0 |
if (tooltipText.length() == 0) |
1178 |
|
{ |
1179 |
0 |
setToolTipText(null); |
1180 |
0 |
lastTooltip = null; |
1181 |
|
} |
1182 |
|
else |
1183 |
|
{ |
1184 |
0 |
if (tooltipText.length() > MAX_TOOLTIP_LENGTH) |
1185 |
|
{ |
1186 |
0 |
tooltipText.setLength(MAX_TOOLTIP_LENGTH); |
1187 |
0 |
tooltipText.append("..."); |
1188 |
|
} |
1189 |
0 |
if (unshownFeatures > 0) |
1190 |
|
{ |
1191 |
0 |
tooltipText.append("<br/>").append("... ").append("<i>") |
1192 |
|
.append(MessageManager.formatMessage( |
1193 |
|
"label.features_not_shown", unshownFeatures)) |
1194 |
|
.append("</i>"); |
1195 |
|
} |
1196 |
0 |
String textString = tooltipText.toString(); |
1197 |
0 |
if (!textString.equals(lastTooltip)) |
1198 |
|
{ |
1199 |
0 |
lastTooltip = textString; |
1200 |
0 |
lastFormattedTooltip = JvSwingUtils.wrapTooltip(true, textString); |
1201 |
0 |
setToolTipText(lastFormattedTooltip); |
1202 |
|
} |
1203 |
|
} |
1204 |
|
} |
1205 |
|
|
1206 |
|
|
1207 |
|
|
1208 |
|
|
1209 |
|
|
1210 |
|
@param |
1211 |
|
@param |
1212 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 8 |
Complexity Density: 0.67 |
|
1213 |
0 |
protected void mouseMovedOverAnnotation(MousePos pos)... |
1214 |
|
{ |
1215 |
0 |
final int column = pos.column; |
1216 |
0 |
final int rowIndex = pos.annotationIndex; |
1217 |
|
|
1218 |
|
|
1219 |
0 |
if (column < 0 || !av.getWrapAlignment() || !av.isShowAnnotation() |
1220 |
|
|| rowIndex < 0) |
1221 |
|
{ |
1222 |
0 |
return; |
1223 |
|
} |
1224 |
0 |
AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); |
1225 |
|
|
1226 |
0 |
String tooltip = AnnotationPanel.buildToolTip(anns[rowIndex], column, |
1227 |
|
anns, 0, av, ap); |
1228 |
0 |
if (tooltip == null ? tooltip != lastTooltip |
1229 |
|
: !tooltip.equals(lastTooltip)) |
1230 |
|
{ |
1231 |
0 |
lastTooltip = tooltip; |
1232 |
0 |
lastFormattedTooltip = tooltip == null ? null |
1233 |
|
: JvSwingUtils.wrapTooltip(true, tooltip); |
1234 |
0 |
setToolTipText(lastFormattedTooltip); |
1235 |
|
} |
1236 |
|
|
1237 |
0 |
String msg = AnnotationPanel.getStatusMessage(av.getAlignment(), column, |
1238 |
|
anns[rowIndex], 0, av); |
1239 |
0 |
ap.alignFrame.setStatus(msg); |
1240 |
|
} |
1241 |
|
|
1242 |
|
|
1243 |
|
|
1244 |
|
|
1245 |
|
|
1246 |
|
private Point lastTooltipLocation = null; |
1247 |
|
|
1248 |
|
|
1249 |
|
|
1250 |
|
|
1251 |
|
|
1252 |
|
private boolean moveTooltip = true; |
1253 |
|
|
1254 |
|
|
1255 |
|
|
1256 |
|
|
1257 |
|
private JToolTip tempTip = new JLabel().createToolTip(); |
1258 |
|
|
1259 |
|
|
1260 |
|
|
1261 |
|
|
1262 |
|
@see |
1263 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 6 |
Complexity Density: 0.5 |
|
1264 |
0 |
@Override... |
1265 |
|
public Point getToolTipLocation(MouseEvent event) |
1266 |
|
{ |
1267 |
|
|
1268 |
|
|
1269 |
0 |
if (lastTooltip == null || !moveTooltip) |
1270 |
|
{ |
1271 |
0 |
return null; |
1272 |
|
} |
1273 |
|
|
1274 |
0 |
if (lastTooltipLocation != null && event.isShiftDown()) |
1275 |
|
{ |
1276 |
0 |
return lastTooltipLocation; |
1277 |
|
} |
1278 |
|
|
1279 |
0 |
int x = event.getX(); |
1280 |
0 |
int y = event.getY(); |
1281 |
0 |
int w = getWidth(); |
1282 |
|
|
1283 |
0 |
tempTip.setTipText(lastFormattedTooltip); |
1284 |
0 |
int tipWidth = (int) tempTip.getPreferredSize().getWidth(); |
1285 |
|
|
1286 |
|
|
1287 |
0 |
x = (x + tipWidth < w ? x + 10 : w - tipWidth); |
1288 |
0 |
Point p = new Point(x, y + av.getCharHeight()); |
1289 |
|
|
1290 |
0 |
return lastTooltipLocation = p; |
1291 |
|
} |
1292 |
|
|
1293 |
|
|
1294 |
|
|
1295 |
|
|
1296 |
|
|
1297 |
|
|
1298 |
|
|
1299 |
|
|
1300 |
|
private boolean updateOverviewAndStructs = false; |
1301 |
|
|
1302 |
|
|
1303 |
|
|
1304 |
|
|
1305 |
|
|
1306 |
|
|
1307 |
|
|
1308 |
|
|
1309 |
|
|
1310 |
|
|
1311 |
|
|
1312 |
|
|
1313 |
|
|
1314 |
|
|
1315 |
|
|
1316 |
|
|
1317 |
|
@param |
1318 |
|
|
1319 |
|
@param |
1320 |
|
|
1321 |
|
@param |
1322 |
|
|
1323 |
|
@return |
1324 |
|
|
1325 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1326 |
5 |
int setStatusMessage(SequenceI sequence, final int column, int seqIndex)... |
1327 |
|
{ |
1328 |
5 |
char sequenceChar = sequence.getCharAt(column); |
1329 |
5 |
int pos = sequence.findPosition(column); |
1330 |
5 |
setStatusMessage(sequence.getName(), seqIndex, sequenceChar, pos); |
1331 |
|
|
1332 |
5 |
return pos; |
1333 |
|
} |
1334 |
|
|
1335 |
|
|
1336 |
|
|
1337 |
|
|
1338 |
|
|
1339 |
|
|
1340 |
|
|
1341 |
|
|
1342 |
|
|
1343 |
|
|
1344 |
|
|
1345 |
|
|
1346 |
|
@param |
1347 |
|
@param |
1348 |
|
|
1349 |
|
@param |
1350 |
|
|
1351 |
|
@param |
1352 |
|
|
1353 |
|
|
|
|
| 78.6% |
Uncovered Elements: 6 (28) |
Complexity: 8 |
Complexity Density: 0.57 |
|
1354 |
6 |
protected void setStatusMessage(String seqName, int seqIndex,... |
1355 |
|
char sequenceChar, int residuePos) |
1356 |
|
{ |
1357 |
6 |
StringBuilder text = new StringBuilder(32); |
1358 |
|
|
1359 |
|
|
1360 |
|
|
1361 |
|
|
1362 |
6 |
String seqno = seqIndex == -1 ? "" : " " + (seqIndex + 1); |
1363 |
6 |
text.append("Sequence").append(seqno).append(" ID: ").append(seqName); |
1364 |
|
|
1365 |
6 |
String residue = null; |
1366 |
|
|
1367 |
|
|
1368 |
|
|
1369 |
|
|
1370 |
6 |
boolean isGapped = Comparison.isGap(sequenceChar); |
1371 |
|
|
1372 |
6 |
if (!isGapped) |
1373 |
|
{ |
1374 |
4 |
boolean nucleotide = av.getAlignment().isNucleotide(); |
1375 |
4 |
String displayChar = String.valueOf(sequenceChar); |
1376 |
4 |
if (nucleotide) |
1377 |
|
{ |
1378 |
0 |
residue = ResidueProperties.nucleotideName.get(displayChar); |
1379 |
|
} |
1380 |
|
else |
1381 |
|
{ |
1382 |
4 |
residue = "X".equalsIgnoreCase(displayChar) ? "X" |
1383 |
4 |
: ("*".equals(displayChar) ? "STOP" |
1384 |
|
: ResidueProperties.aa2Triplet.get(displayChar)); |
1385 |
|
} |
1386 |
4 |
text.append(" ").append(nucleotide ? "Nucleotide" : "Residue") |
1387 |
4 |
.append(": ").append(residue == null ? displayChar : residue); |
1388 |
|
|
1389 |
4 |
text.append(" (").append(Integer.toString(residuePos)).append(")"); |
1390 |
|
} |
1391 |
6 |
ap.alignFrame.setStatus(text.toString()); |
1392 |
|
} |
1393 |
|
|
1394 |
|
|
1395 |
|
|
1396 |
|
|
1397 |
|
|
1398 |
|
@param |
1399 |
|
|
|
|
| 80% |
Uncovered Elements: 4 (20) |
Complexity: 4 |
Complexity Density: 0.29 |
|
1400 |
1 |
private void setStatusMessage(SearchResultsI results)... |
1401 |
|
{ |
1402 |
1 |
AlignmentI al = this.av.getAlignment(); |
1403 |
1 |
int sequenceIndex = al.findIndex(results); |
1404 |
1 |
if (sequenceIndex == -1) |
1405 |
|
{ |
1406 |
0 |
return; |
1407 |
|
} |
1408 |
1 |
SequenceI alignedSeq = al.getSequenceAt(sequenceIndex); |
1409 |
1 |
SequenceI ds = alignedSeq.getDatasetSequence(); |
1410 |
1 |
for (SearchResultMatchI m : results.getResults()) |
1411 |
|
{ |
1412 |
1 |
SequenceI seq = m.getSequence(); |
1413 |
1 |
if (seq.getDatasetSequence() != null) |
1414 |
|
{ |
1415 |
1 |
seq = seq.getDatasetSequence(); |
1416 |
|
} |
1417 |
|
|
1418 |
1 |
if (seq == ds) |
1419 |
|
{ |
1420 |
1 |
int start = m.getStart(); |
1421 |
1 |
setStatusMessage(alignedSeq.getName(), sequenceIndex, |
1422 |
|
seq.getCharAt(start - 1), start); |
1423 |
1 |
return; |
1424 |
|
} |
1425 |
|
} |
1426 |
|
} |
1427 |
|
|
1428 |
|
|
1429 |
|
@inheritDoc |
1430 |
|
|
|
|
| 0% |
Uncovered Elements: 94 (94) |
Complexity: 22 |
Complexity Density: 0.37 |
|
1431 |
0 |
@Override... |
1432 |
|
public void mouseDragged(MouseEvent evt) |
1433 |
|
{ |
1434 |
0 |
MousePos pos = findMousePosition(evt); |
1435 |
0 |
if (pos.isOverAnnotation() || pos.column == -1) |
1436 |
|
{ |
1437 |
0 |
return; |
1438 |
|
} |
1439 |
|
|
1440 |
0 |
if (mouseWheelPressed) |
1441 |
|
{ |
1442 |
0 |
boolean inSplitFrame = ap.av.getCodingComplement() != null; |
1443 |
0 |
boolean copyChanges = inSplitFrame && av.isProteinFontAsCdna(); |
1444 |
|
|
1445 |
0 |
int oldWidth = av.getCharWidth(); |
1446 |
|
|
1447 |
|
|
1448 |
0 |
if (Math.abs(evt.getY() - lastMousePress.getY()) > Math |
1449 |
|
.abs(evt.getX() - lastMousePress.getX())) |
1450 |
|
{ |
1451 |
|
|
1452 |
|
|
1453 |
|
|
1454 |
0 |
int fontSize = av.font.getSize(); |
1455 |
0 |
boolean fontChanged = false; |
1456 |
|
|
1457 |
0 |
if (evt.getY() < lastMousePress.getY()) |
1458 |
|
{ |
1459 |
0 |
fontChanged = true; |
1460 |
0 |
fontSize--; |
1461 |
|
} |
1462 |
0 |
else if (evt.getY() > lastMousePress.getY()) |
1463 |
|
{ |
1464 |
0 |
fontChanged = true; |
1465 |
0 |
fontSize++; |
1466 |
|
} |
1467 |
|
|
1468 |
0 |
if (fontSize < 1) |
1469 |
|
{ |
1470 |
0 |
fontSize = 1; |
1471 |
|
} |
1472 |
|
|
1473 |
0 |
if (fontChanged) |
1474 |
|
{ |
1475 |
0 |
Font newFont = new Font(av.font.getName(), av.font.getStyle(), |
1476 |
|
fontSize); |
1477 |
0 |
av.setFont(newFont, true); |
1478 |
0 |
av.setCharWidth(oldWidth); |
1479 |
0 |
ap.fontChanged(); |
1480 |
0 |
if (copyChanges) |
1481 |
|
{ |
1482 |
0 |
ap.av.getCodingComplement().setFont(newFont, true); |
1483 |
0 |
SplitFrame splitFrame = (SplitFrame) ap.alignFrame |
1484 |
|
.getSplitViewContainer(); |
1485 |
0 |
splitFrame.adjustLayout(); |
1486 |
0 |
splitFrame.repaint(); |
1487 |
|
} |
1488 |
|
} |
1489 |
|
} |
1490 |
|
else |
1491 |
|
{ |
1492 |
|
|
1493 |
|
|
1494 |
|
|
1495 |
0 |
int newWidth = 0; |
1496 |
0 |
if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1) |
1497 |
|
{ |
1498 |
0 |
newWidth = av.getCharWidth() - 1; |
1499 |
0 |
av.setCharWidth(newWidth); |
1500 |
|
} |
1501 |
0 |
else if (evt.getX() > lastMousePress.getX()) |
1502 |
|
{ |
1503 |
0 |
newWidth = av.getCharWidth() + 1; |
1504 |
0 |
av.setCharWidth(newWidth); |
1505 |
|
} |
1506 |
0 |
if (newWidth > 0) |
1507 |
|
{ |
1508 |
0 |
ap.paintAlignment(false, false); |
1509 |
0 |
if (copyChanges) |
1510 |
|
{ |
1511 |
|
|
1512 |
|
|
1513 |
|
|
1514 |
|
|
1515 |
|
|
1516 |
0 |
av.getCodingComplement().setCharWidth(newWidth); |
1517 |
0 |
SplitFrame splitFrame = (SplitFrame) ap.alignFrame |
1518 |
|
.getSplitViewContainer(); |
1519 |
0 |
splitFrame.adjustLayout(); |
1520 |
0 |
splitFrame.repaint(); |
1521 |
|
} |
1522 |
|
} |
1523 |
|
} |
1524 |
|
|
1525 |
0 |
FontMetrics fm = getFontMetrics(av.getFont()); |
1526 |
0 |
av.validCharWidth = fm.charWidth('M') <= av.getCharWidth(); |
1527 |
|
|
1528 |
0 |
lastMousePress = evt.getPoint(); |
1529 |
|
|
1530 |
0 |
return; |
1531 |
|
} |
1532 |
|
|
1533 |
0 |
if (!editingSeqs) |
1534 |
|
{ |
1535 |
0 |
dragStretchGroup(evt); |
1536 |
0 |
return; |
1537 |
|
} |
1538 |
|
|
1539 |
0 |
int res = pos.column; |
1540 |
|
|
1541 |
0 |
if (res < 0) |
1542 |
|
{ |
1543 |
0 |
res = 0; |
1544 |
|
} |
1545 |
|
|
1546 |
0 |
if ((editLastRes == -1) || (editLastRes == res)) |
1547 |
|
{ |
1548 |
0 |
return; |
1549 |
|
} |
1550 |
|
|
1551 |
0 |
if ((res < av.getAlignment().getWidth()) && (res < editLastRes)) |
1552 |
|
{ |
1553 |
|
|
1554 |
0 |
editSequence(false, false, res); |
1555 |
|
} |
1556 |
|
else |
1557 |
|
{ |
1558 |
0 |
editSequence(true, false, res); |
1559 |
|
} |
1560 |
|
|
1561 |
0 |
mouseDragging = true; |
1562 |
0 |
if (scrollThread != null) |
1563 |
|
{ |
1564 |
0 |
scrollThread.setMousePosition(evt.getPoint()); |
1565 |
|
} |
1566 |
|
} |
1567 |
|
|
1568 |
|
|
1569 |
|
|
1570 |
|
|
1571 |
|
|
1572 |
|
|
1573 |
|
|
1574 |
|
|
1575 |
|
|
1576 |
|
|
1577 |
|
|
1578 |
|
|
1579 |
|
|
1580 |
|
|
1581 |
|
|
1582 |
|
|
1583 |
|
|
1584 |
|
@param |
1585 |
|
|
1586 |
|
@param |
1587 |
|
|
1588 |
|
@param |
1589 |
|
|
1590 |
|
|
1591 |
|
|
1592 |
|
|
|
|
| 0% |
Uncovered Elements: 99 (99) |
Complexity: 35 |
Complexity Density: 0.56 |
|
1593 |
0 |
synchronized void editSequence(boolean insertGap, boolean editSeq,... |
1594 |
|
final int startres) |
1595 |
|
{ |
1596 |
0 |
int fixedLeft = -1; |
1597 |
0 |
int fixedRight = -1; |
1598 |
0 |
boolean fixedColumns = false; |
1599 |
0 |
SequenceGroup sg = av.getSelectionGroup(); |
1600 |
|
|
1601 |
0 |
final SequenceI seq = av.getAlignment().getSequenceAt(editStartSeq); |
1602 |
|
|
1603 |
|
|
1604 |
0 |
if (!groupEditing && av.hasHiddenRows()) |
1605 |
|
{ |
1606 |
0 |
if (av.isHiddenRepSequence(seq)) |
1607 |
|
{ |
1608 |
0 |
sg = av.getRepresentedSequences(seq); |
1609 |
0 |
groupEditing = true; |
1610 |
|
} |
1611 |
|
} |
1612 |
|
|
1613 |
0 |
StringBuilder message = new StringBuilder(64); |
1614 |
|
|
1615 |
|
|
1616 |
|
|
1617 |
|
|
1618 |
|
|
1619 |
0 |
String label = null; |
1620 |
0 |
if (groupEditing) |
1621 |
|
{ |
1622 |
0 |
message.append("Edit group:"); |
1623 |
0 |
label = MessageManager.getString("action.edit_group"); |
1624 |
|
} |
1625 |
|
else |
1626 |
|
{ |
1627 |
0 |
message.append("Edit sequence: " + seq.getName()); |
1628 |
0 |
label = seq.getName(); |
1629 |
0 |
if (label.length() > 10) |
1630 |
|
{ |
1631 |
0 |
label = label.substring(0, 10); |
1632 |
|
} |
1633 |
0 |
label = MessageManager.formatMessage("label.edit_params", |
1634 |
|
new String[] |
1635 |
|
{ label }); |
1636 |
|
} |
1637 |
|
|
1638 |
|
|
1639 |
|
|
1640 |
|
|
1641 |
|
|
1642 |
0 |
if (editCommand == null) |
1643 |
|
{ |
1644 |
0 |
editCommand = new EditCommand(label); |
1645 |
|
} |
1646 |
|
|
1647 |
0 |
if (insertGap) |
1648 |
|
{ |
1649 |
0 |
message.append(" insert "); |
1650 |
|
} |
1651 |
|
else |
1652 |
|
{ |
1653 |
0 |
message.append(" delete "); |
1654 |
|
} |
1655 |
|
|
1656 |
0 |
message.append(Math.abs(startres - editLastRes) + " gaps."); |
1657 |
0 |
ap.alignFrame.setStatus(message.toString()); |
1658 |
|
|
1659 |
|
|
1660 |
|
|
1661 |
|
|
1662 |
|
|
1663 |
|
|
1664 |
0 |
boolean inSelectionGroup = sg != null |
1665 |
|
&& sg.getSequences(av.getHiddenRepSequences()).contains(seq); |
1666 |
0 |
if (groupEditing || inSelectionGroup) |
1667 |
|
{ |
1668 |
0 |
fixedColumns = true; |
1669 |
|
|
1670 |
|
|
1671 |
|
|
1672 |
0 |
if (sg == null) |
1673 |
|
{ |
1674 |
0 |
if (!av.isHiddenRepSequence(seq)) |
1675 |
|
{ |
1676 |
0 |
endEditing(); |
1677 |
0 |
return; |
1678 |
|
} |
1679 |
0 |
sg = av.getRepresentedSequences(seq); |
1680 |
|
} |
1681 |
|
|
1682 |
0 |
fixedLeft = sg.getStartRes(); |
1683 |
0 |
fixedRight = sg.getEndRes(); |
1684 |
|
|
1685 |
0 |
if ((startres < fixedLeft && editLastRes >= fixedLeft) |
1686 |
|
|| (startres >= fixedLeft && editLastRes < fixedLeft) |
1687 |
|
|| (startres > fixedRight && editLastRes <= fixedRight) |
1688 |
|
|| (startres <= fixedRight && editLastRes > fixedRight)) |
1689 |
|
{ |
1690 |
0 |
endEditing(); |
1691 |
0 |
return; |
1692 |
|
} |
1693 |
|
|
1694 |
0 |
if (fixedLeft > startres) |
1695 |
|
{ |
1696 |
0 |
fixedRight = fixedLeft - 1; |
1697 |
0 |
fixedLeft = 0; |
1698 |
|
} |
1699 |
0 |
else if (fixedRight < startres) |
1700 |
|
{ |
1701 |
0 |
fixedLeft = fixedRight; |
1702 |
0 |
fixedRight = -1; |
1703 |
|
} |
1704 |
|
} |
1705 |
|
|
1706 |
0 |
if (av.hasHiddenColumns()) |
1707 |
|
{ |
1708 |
0 |
fixedColumns = true; |
1709 |
0 |
int y1 = av.getAlignment().getHiddenColumns() |
1710 |
|
.getNextHiddenBoundary(true, startres); |
1711 |
0 |
int y2 = av.getAlignment().getHiddenColumns() |
1712 |
|
.getNextHiddenBoundary(false, startres); |
1713 |
|
|
1714 |
0 |
if ((insertGap && startres > y1 && editLastRes < y1) |
1715 |
|
|| (!insertGap && startres < y2 && editLastRes > y2)) |
1716 |
|
{ |
1717 |
0 |
endEditing(); |
1718 |
0 |
return; |
1719 |
|
} |
1720 |
|
|
1721 |
|
|
1722 |
|
|
1723 |
0 |
if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1)) |
1724 |
|
{ |
1725 |
0 |
if (startres >= y2) |
1726 |
|
{ |
1727 |
0 |
fixedLeft = y2; |
1728 |
|
} |
1729 |
|
else |
1730 |
|
{ |
1731 |
0 |
fixedRight = y2 - 1; |
1732 |
|
} |
1733 |
|
} |
1734 |
|
} |
1735 |
|
|
1736 |
0 |
boolean success = doEditSequence(insertGap, editSeq, startres, |
1737 |
|
fixedRight, fixedColumns, sg); |
1738 |
|
|
1739 |
|
|
1740 |
|
|
1741 |
|
|
1742 |
|
|
1743 |
0 |
String msg = getEditStatusMessage(editCommand); |
1744 |
0 |
ap.alignFrame.setStatus(msg == null ? " " : msg); |
1745 |
0 |
if (!success) |
1746 |
|
{ |
1747 |
0 |
endEditing(); |
1748 |
|
} |
1749 |
|
|
1750 |
0 |
editLastRes = startres; |
1751 |
0 |
seqCanvas.repaint(); |
1752 |
|
} |
1753 |
|
|
1754 |
|
|
1755 |
|
|
1756 |
|
|
1757 |
|
|
1758 |
|
|
1759 |
|
|
1760 |
|
|
1761 |
|
|
1762 |
|
@param |
1763 |
|
|
1764 |
|
@param |
1765 |
|
|
1766 |
|
@param |
1767 |
|
|
1768 |
|
@param |
1769 |
|
|
1770 |
|
|
1771 |
|
@param |
1772 |
|
|
1773 |
|
@param |
1774 |
|
|
1775 |
|
@return |
1776 |
|
|
|
|
| 0% |
Uncovered Elements: 148 (148) |
Complexity: 46 |
Complexity Density: 0.62 |
|
1777 |
0 |
protected boolean doEditSequence(final boolean insertGap,... |
1778 |
|
final boolean editSeq, final int startres, int fixedRight, |
1779 |
|
final boolean fixedColumns, final SequenceGroup sg) |
1780 |
|
{ |
1781 |
0 |
final SequenceI seq = av.getAlignment().getSequenceAt(editStartSeq); |
1782 |
0 |
SequenceI[] seqs = new SequenceI[] { seq }; |
1783 |
|
|
1784 |
0 |
if (groupEditing) |
1785 |
|
{ |
1786 |
0 |
List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences()); |
1787 |
0 |
int g, groupSize = vseqs.size(); |
1788 |
0 |
SequenceI[] groupSeqs = new SequenceI[groupSize]; |
1789 |
0 |
for (g = 0; g < groupSeqs.length; g++) |
1790 |
|
{ |
1791 |
0 |
groupSeqs[g] = vseqs.get(g); |
1792 |
|
} |
1793 |
|
|
1794 |
|
|
1795 |
0 |
if (insertGap) |
1796 |
|
{ |
1797 |
|
|
1798 |
|
|
1799 |
0 |
if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight |
1800 |
|
&& sg.getEndRes() == av.getAlignment().getWidth() - 1) |
1801 |
|
{ |
1802 |
0 |
sg.setEndRes( |
1803 |
|
av.getAlignment().getWidth() + startres - editLastRes); |
1804 |
0 |
fixedRight = sg.getEndRes(); |
1805 |
|
} |
1806 |
|
|
1807 |
|
|
1808 |
|
|
1809 |
|
|
1810 |
0 |
boolean blank = false; |
1811 |
0 |
for (; fixedRight > editLastRes; fixedRight--) |
1812 |
|
{ |
1813 |
0 |
blank = true; |
1814 |
|
|
1815 |
0 |
for (g = 0; g < groupSize; g++) |
1816 |
|
{ |
1817 |
0 |
for (int j = 0; j < startres - editLastRes; j++) |
1818 |
|
{ |
1819 |
0 |
if (!Comparison.isGap(groupSeqs[g].getCharAt(fixedRight - j))) |
1820 |
|
{ |
1821 |
0 |
blank = false; |
1822 |
0 |
break; |
1823 |
|
} |
1824 |
|
} |
1825 |
|
} |
1826 |
0 |
if (blank) |
1827 |
|
{ |
1828 |
0 |
break; |
1829 |
|
} |
1830 |
|
} |
1831 |
|
|
1832 |
0 |
if (!blank) |
1833 |
|
{ |
1834 |
0 |
if (sg.getSize() == av.getAlignment().getHeight()) |
1835 |
|
{ |
1836 |
0 |
if ((av.hasHiddenColumns() |
1837 |
|
&& startres < av.getAlignment().getHiddenColumns() |
1838 |
|
.getNextHiddenBoundary(false, startres))) |
1839 |
|
{ |
1840 |
0 |
return false; |
1841 |
|
} |
1842 |
|
|
1843 |
0 |
int alWidth = av.getAlignment().getWidth(); |
1844 |
0 |
if (av.hasHiddenRows()) |
1845 |
|
{ |
1846 |
0 |
int hwidth = av.getAlignment().getHiddenSequences() |
1847 |
|
.getWidth(); |
1848 |
0 |
if (hwidth > alWidth) |
1849 |
|
{ |
1850 |
0 |
alWidth = hwidth; |
1851 |
|
} |
1852 |
|
} |
1853 |
|
|
1854 |
|
|
1855 |
0 |
sg.setEndRes(sg.getEndRes() + startres - editLastRes); |
1856 |
0 |
fixedRight = alWidth + startres - editLastRes; |
1857 |
|
} |
1858 |
|
else |
1859 |
|
{ |
1860 |
0 |
return false; |
1861 |
|
} |
1862 |
|
} |
1863 |
|
} |
1864 |
|
|
1865 |
|
|
1866 |
0 |
else if (!insertGap) |
1867 |
|
{ |
1868 |
|
|
1869 |
|
|
1870 |
|
|
1871 |
0 |
for (g = 0; g < groupSize; g++) |
1872 |
|
{ |
1873 |
0 |
for (int j = startres; j < editLastRes; j++) |
1874 |
|
{ |
1875 |
0 |
if (groupSeqs[g].getLength() <= j) |
1876 |
|
{ |
1877 |
0 |
continue; |
1878 |
|
} |
1879 |
|
|
1880 |
0 |
if (!Comparison.isGap(groupSeqs[g].getCharAt(j))) |
1881 |
|
{ |
1882 |
|
|
1883 |
0 |
return false; |
1884 |
|
} |
1885 |
|
} |
1886 |
|
} |
1887 |
|
} |
1888 |
|
|
1889 |
0 |
if (insertGap) |
1890 |
|
{ |
1891 |
|
|
1892 |
0 |
if (fixedColumns && fixedRight != -1) |
1893 |
|
{ |
1894 |
0 |
for (int j = editLastRes; j < startres; j++) |
1895 |
|
{ |
1896 |
0 |
insertGap(j, groupSeqs, fixedRight); |
1897 |
|
} |
1898 |
|
} |
1899 |
|
else |
1900 |
|
{ |
1901 |
0 |
appendEdit(Action.INSERT_GAP, groupSeqs, startres, |
1902 |
|
startres - editLastRes, false); |
1903 |
|
} |
1904 |
|
} |
1905 |
|
else |
1906 |
|
{ |
1907 |
|
|
1908 |
0 |
if (fixedColumns && fixedRight != -1) |
1909 |
|
{ |
1910 |
0 |
for (int j = editLastRes; j > startres; j--) |
1911 |
|
{ |
1912 |
0 |
deleteChar(startres, groupSeqs, fixedRight); |
1913 |
|
} |
1914 |
|
} |
1915 |
|
else |
1916 |
|
{ |
1917 |
0 |
appendEdit(Action.DELETE_GAP, groupSeqs, startres, |
1918 |
|
editLastRes - startres, false); |
1919 |
|
} |
1920 |
|
} |
1921 |
|
} |
1922 |
|
else |
1923 |
|
{ |
1924 |
|
|
1925 |
|
|
1926 |
|
|
1927 |
0 |
if (insertGap) |
1928 |
|
{ |
1929 |
|
|
1930 |
0 |
if (fixedColumns && fixedRight != -1) |
1931 |
|
{ |
1932 |
0 |
for (int j = editLastRes; j < startres; j++) |
1933 |
|
{ |
1934 |
0 |
if (!insertGap(j, seqs, fixedRight)) |
1935 |
|
{ |
1936 |
|
|
1937 |
|
|
1938 |
|
|
1939 |
|
|
1940 |
0 |
return false; |
1941 |
|
} |
1942 |
|
} |
1943 |
|
} |
1944 |
|
else |
1945 |
|
{ |
1946 |
0 |
appendEdit(Action.INSERT_GAP, seqs, editLastRes, |
1947 |
|
startres - editLastRes, false); |
1948 |
|
} |
1949 |
|
} |
1950 |
|
else |
1951 |
|
{ |
1952 |
0 |
if (!editSeq) |
1953 |
|
{ |
1954 |
|
|
1955 |
0 |
if (fixedColumns && fixedRight != -1) |
1956 |
|
{ |
1957 |
0 |
for (int j = editLastRes; j > startres; j--) |
1958 |
|
{ |
1959 |
0 |
if (!Comparison.isGap(seq.getCharAt(startres))) |
1960 |
|
{ |
1961 |
0 |
return false; |
1962 |
|
} |
1963 |
0 |
deleteChar(startres, seqs, fixedRight); |
1964 |
|
} |
1965 |
|
} |
1966 |
|
else |
1967 |
|
{ |
1968 |
|
|
1969 |
0 |
int max = 0; |
1970 |
0 |
for (int m = startres; m < editLastRes; m++) |
1971 |
|
{ |
1972 |
0 |
if (!Comparison.isGap(seq.getCharAt(m))) |
1973 |
|
{ |
1974 |
0 |
break; |
1975 |
|
} |
1976 |
0 |
max++; |
1977 |
|
} |
1978 |
0 |
if (max > 0) |
1979 |
|
{ |
1980 |
0 |
appendEdit(Action.DELETE_GAP, seqs, startres, max, false); |
1981 |
|
} |
1982 |
|
} |
1983 |
|
} |
1984 |
|
else |
1985 |
|
{ |
1986 |
0 |
if (fixedColumns && fixedRight != -1) |
1987 |
|
{ |
1988 |
0 |
for (int j = editLastRes; j < startres; j++) |
1989 |
|
{ |
1990 |
0 |
insertGap(j, seqs, fixedRight); |
1991 |
|
} |
1992 |
|
} |
1993 |
|
else |
1994 |
|
{ |
1995 |
0 |
appendEdit(Action.INSERT_NUC, seqs, editLastRes, |
1996 |
|
startres - editLastRes, false); |
1997 |
|
} |
1998 |
|
} |
1999 |
|
} |
2000 |
|
} |
2001 |
|
|
2002 |
0 |
return true; |
2003 |
|
} |
2004 |
|
|
2005 |
|
|
2006 |
|
|
2007 |
|
|
2008 |
|
|
2009 |
|
@param |
2010 |
|
|
2011 |
|
@return |
2012 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 8 |
Complexity Density: 0.73 |
|
2013 |
14 |
protected static String getEditStatusMessage(EditCommand editCommand)... |
2014 |
|
{ |
2015 |
14 |
if (editCommand == null) |
2016 |
|
{ |
2017 |
1 |
return null; |
2018 |
|
} |
2019 |
|
|
2020 |
|
|
2021 |
|
|
2022 |
|
|
2023 |
|
|
2024 |
|
|
2025 |
13 |
int count = 0; |
2026 |
13 |
for (Edit cmd : editCommand.getEdits()) |
2027 |
|
{ |
2028 |
63 |
if (!cmd.isSystemGenerated()) |
2029 |
|
{ |
2030 |
42 |
count += cmd.getAction() == Action.INSERT_GAP ? cmd.getNumber() |
2031 |
|
: -cmd.getNumber(); |
2032 |
|
} |
2033 |
|
} |
2034 |
|
|
2035 |
13 |
if (count == 0) |
2036 |
|
{ |
2037 |
|
|
2038 |
|
|
2039 |
|
|
2040 |
3 |
return null; |
2041 |
|
} |
2042 |
|
|
2043 |
10 |
String msgKey = count > 1 ? "label.insert_gaps" |
2044 |
7 |
: (count == 1 ? "label.insert_gap" |
2045 |
4 |
: (count == -1 ? "label.delete_gap" |
2046 |
|
: "label.delete_gaps")); |
2047 |
10 |
count = Math.abs(count); |
2048 |
|
|
2049 |
10 |
return MessageManager.formatMessage(msgKey, String.valueOf(count)); |
2050 |
|
} |
2051 |
|
|
2052 |
|
|
2053 |
|
|
2054 |
|
|
2055 |
|
|
2056 |
|
|
2057 |
|
|
2058 |
|
@param |
2059 |
|
@param |
2060 |
|
@param |
2061 |
|
@return |
2062 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
2063 |
0 |
boolean insertGap(int j, SequenceI[] seq, int fixedColumn)... |
2064 |
|
{ |
2065 |
0 |
int blankColumn = fixedColumn; |
2066 |
0 |
for (int s = 0; s < seq.length; s++) |
2067 |
|
{ |
2068 |
|
|
2069 |
|
|
2070 |
|
|
2071 |
0 |
for (blankColumn = fixedColumn; blankColumn > j; blankColumn--) |
2072 |
|
{ |
2073 |
0 |
if (Comparison.isGap(seq[s].getCharAt(blankColumn))) |
2074 |
|
{ |
2075 |
|
|
2076 |
0 |
break; |
2077 |
|
} |
2078 |
|
} |
2079 |
|
|
2080 |
0 |
if (blankColumn <= j) |
2081 |
|
{ |
2082 |
0 |
blankColumn = fixedColumn; |
2083 |
0 |
endEditing(); |
2084 |
0 |
return false; |
2085 |
|
} |
2086 |
|
} |
2087 |
|
|
2088 |
0 |
appendEdit(Action.DELETE_GAP, seq, blankColumn, 1, true); |
2089 |
|
|
2090 |
0 |
appendEdit(Action.INSERT_GAP, seq, j, 1, false); |
2091 |
|
|
2092 |
0 |
return true; |
2093 |
|
} |
2094 |
|
|
2095 |
|
|
2096 |
|
|
2097 |
|
|
2098 |
|
@param |
2099 |
|
@param |
2100 |
|
@param |
2101 |
|
@param |
2102 |
|
@param |
2103 |
|
|
2104 |
|
|
2105 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
2106 |
0 |
protected void appendEdit(Action action, SequenceI[] seq, int pos,... |
2107 |
|
int count, boolean systemGenerated) |
2108 |
|
{ |
2109 |
|
|
2110 |
0 |
final Edit edit = new EditCommand().new Edit(action, seq, pos, count, |
2111 |
|
av.getAlignment().getGapCharacter()); |
2112 |
0 |
edit.setSystemGenerated(systemGenerated); |
2113 |
|
|
2114 |
0 |
editCommand.appendEdit(edit, av.getAlignment(), true, null); |
2115 |
|
} |
2116 |
|
|
2117 |
|
|
2118 |
|
|
2119 |
|
|
2120 |
|
|
2121 |
|
|
2122 |
|
@param |
2123 |
|
@param |
2124 |
|
@param |
2125 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
2126 |
0 |
void deleteChar(int j, SequenceI[] seqs, int fixedColumn)... |
2127 |
|
{ |
2128 |
0 |
appendEdit(Action.DELETE_GAP, seqs, j, 1, false); |
2129 |
|
|
2130 |
0 |
appendEdit(Action.INSERT_GAP, seqs, fixedColumn, 1, true); |
2131 |
|
} |
2132 |
|
|
2133 |
|
|
2134 |
|
|
2135 |
|
|
2136 |
|
|
2137 |
|
@param |
2138 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
2139 |
0 |
@Override... |
2140 |
|
public void mouseEntered(MouseEvent e) |
2141 |
|
{ |
2142 |
0 |
if (oldSeq < 0) |
2143 |
|
{ |
2144 |
0 |
oldSeq = 0; |
2145 |
|
} |
2146 |
0 |
stopScrolling(); |
2147 |
|
} |
2148 |
|
|
2149 |
|
|
2150 |
|
|
2151 |
|
|
2152 |
|
|
2153 |
|
@param |
2154 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
2155 |
0 |
@Override... |
2156 |
|
public void mouseExited(MouseEvent e) |
2157 |
|
{ |
2158 |
0 |
lastMousePosition = null; |
2159 |
0 |
ap.alignFrame.setStatus(" "); |
2160 |
0 |
if (av.getWrapAlignment()) |
2161 |
|
{ |
2162 |
0 |
return; |
2163 |
|
} |
2164 |
|
|
2165 |
0 |
if (mouseDragging && scrollThread == null) |
2166 |
|
{ |
2167 |
0 |
startScrolling(e.getPoint()); |
2168 |
|
} |
2169 |
|
} |
2170 |
|
|
2171 |
|
|
2172 |
|
|
2173 |
|
|
2174 |
|
|
2175 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 10 |
Complexity Density: 0.62 |
|
2176 |
0 |
@Override... |
2177 |
|
public void mouseClicked(MouseEvent evt) |
2178 |
|
{ |
2179 |
0 |
SequenceGroup sg = null; |
2180 |
0 |
MousePos pos = findMousePosition(evt); |
2181 |
0 |
if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1) |
2182 |
|
{ |
2183 |
0 |
return; |
2184 |
|
} |
2185 |
|
|
2186 |
0 |
if (evt.getClickCount() > 1 && av.isShowSequenceFeatures()) |
2187 |
|
{ |
2188 |
0 |
sg = av.getSelectionGroup(); |
2189 |
0 |
if (sg != null && sg.getSize() == 1 |
2190 |
|
&& sg.getEndRes() - sg.getStartRes() < 2) |
2191 |
|
{ |
2192 |
0 |
av.setSelectionGroup(null); |
2193 |
|
} |
2194 |
|
|
2195 |
0 |
int column = pos.column; |
2196 |
|
|
2197 |
|
|
2198 |
|
|
2199 |
|
|
2200 |
|
|
2201 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(pos.seqIndex); |
2202 |
0 |
List<SequenceFeature> features = seqCanvas.getFeatureRenderer() |
2203 |
|
.findFeaturesAtColumn(sequence, column + 1); |
2204 |
|
|
2205 |
0 |
if (!features.isEmpty()) |
2206 |
|
{ |
2207 |
|
|
2208 |
|
|
2209 |
|
|
2210 |
0 |
SearchResultsI highlight = new SearchResults(); |
2211 |
0 |
highlight.addResult(sequence, features.get(0).getBegin(), |
2212 |
|
features.get(0).getEnd()); |
2213 |
0 |
seqCanvas.highlightSearchResults(highlight, true); |
2214 |
|
|
2215 |
|
|
2216 |
|
|
2217 |
|
|
2218 |
0 |
new FeatureEditor(ap, Collections.singletonList(sequence), features, |
2219 |
|
false).showDialog(); |
2220 |
|
} |
2221 |
|
} |
2222 |
|
} |
2223 |
|
|
2224 |
|
|
2225 |
|
|
2226 |
|
|
2227 |
|
|
2228 |
|
|
2229 |
|
|
2230 |
|
|
2231 |
|
|
2232 |
|
|
2233 |
|
|
|
|
| 0% |
Uncovered Elements: 45 (45) |
Complexity: 14 |
Complexity Density: 0.67 |
|
2234 |
0 |
@Override... |
2235 |
|
public void mouseWheelMoved(MouseWheelEvent e) |
2236 |
|
{ |
2237 |
0 |
e.consume(); |
2238 |
0 |
double wheelRotation = e.getPreciseWheelRotation(); |
2239 |
|
|
2240 |
|
|
2241 |
|
|
2242 |
|
|
2243 |
0 |
int size = 1 + (int) Math.abs(wheelRotation); |
2244 |
|
|
2245 |
0 |
if (wheelRotation > 0) |
2246 |
|
{ |
2247 |
0 |
if (e.isShiftDown()) |
2248 |
|
{ |
2249 |
|
|
2250 |
|
|
2251 |
|
|
2252 |
|
|
2253 |
|
|
2254 |
0 |
while (size-- > 0 && !ap.isScrolledFullyRight()) |
2255 |
|
{ |
2256 |
0 |
if (!av.getRanges().scrollRight(true)) |
2257 |
|
{ |
2258 |
0 |
break; |
2259 |
|
} |
2260 |
|
} |
2261 |
|
} |
2262 |
|
else |
2263 |
|
{ |
2264 |
|
|
2265 |
|
|
2266 |
|
|
2267 |
0 |
while (size-- > 0) |
2268 |
|
{ |
2269 |
0 |
if (!av.getRanges().scrollUp(false)) |
2270 |
|
{ |
2271 |
0 |
break; |
2272 |
|
} |
2273 |
|
} |
2274 |
|
} |
2275 |
|
} |
2276 |
0 |
else if (wheelRotation < 0) |
2277 |
|
{ |
2278 |
0 |
if (e.isShiftDown()) |
2279 |
|
{ |
2280 |
|
|
2281 |
|
|
2282 |
|
|
2283 |
0 |
while (size-- > 0) |
2284 |
|
{ |
2285 |
0 |
if (!av.getRanges().scrollRight(false)) |
2286 |
|
{ |
2287 |
0 |
break; |
2288 |
|
} |
2289 |
|
} |
2290 |
|
} |
2291 |
|
else |
2292 |
|
{ |
2293 |
|
|
2294 |
|
|
2295 |
|
|
2296 |
0 |
while (size-- > 0) |
2297 |
|
{ |
2298 |
0 |
if (!av.getRanges().scrollUp(true)) |
2299 |
|
{ |
2300 |
0 |
break; |
2301 |
|
} |
2302 |
|
} |
2303 |
|
} |
2304 |
|
} |
2305 |
|
|
2306 |
|
|
2307 |
|
|
2308 |
|
|
2309 |
|
|
2310 |
0 |
mouseMoved(e); |
2311 |
0 |
ToolTipManager.sharedInstance().mouseMoved(e); |
2312 |
|
} |
2313 |
|
|
2314 |
|
|
2315 |
|
|
2316 |
|
|
2317 |
|
@param |
2318 |
|
|
2319 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 14 |
Complexity Density: 0.47 |
|
2320 |
0 |
protected void doMousePressedDefineMode(MouseEvent evt, MousePos pos)... |
2321 |
|
{ |
2322 |
0 |
if (pos.isOverAnnotation() || pos.seqIndex == -1 || pos.column == -1) |
2323 |
|
{ |
2324 |
0 |
return; |
2325 |
|
} |
2326 |
|
|
2327 |
0 |
final int res = pos.column; |
2328 |
0 |
final int seq = pos.seqIndex; |
2329 |
0 |
oldSeq = seq; |
2330 |
0 |
updateOverviewAndStructs = false; |
2331 |
|
|
2332 |
0 |
startWrapBlock = wrappedBlock; |
2333 |
|
|
2334 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seq); |
2335 |
|
|
2336 |
0 |
if ((sequence == null) || (res > sequence.getLength())) |
2337 |
|
{ |
2338 |
0 |
return; |
2339 |
|
} |
2340 |
|
|
2341 |
0 |
stretchGroup = av.getSelectionGroup(); |
2342 |
|
|
2343 |
0 |
if (stretchGroup == null || !stretchGroup.contains(sequence, res)) |
2344 |
|
{ |
2345 |
0 |
stretchGroup = av.getAlignment().findGroup(sequence, res); |
2346 |
0 |
if (stretchGroup != null) |
2347 |
|
{ |
2348 |
|
|
2349 |
|
|
2350 |
0 |
av.setSelectionGroup(stretchGroup); |
2351 |
|
} |
2352 |
|
} |
2353 |
|
|
2354 |
|
|
2355 |
|
|
2356 |
|
|
2357 |
|
|
2358 |
|
|
2359 |
0 |
if (Platform.isWinRightButton(evt)) |
2360 |
|
{ |
2361 |
0 |
return; |
2362 |
|
} |
2363 |
|
|
2364 |
0 |
if (evt.isPopupTrigger()) |
2365 |
|
{ |
2366 |
0 |
showPopupMenu(evt, pos); |
2367 |
0 |
return; |
2368 |
|
} |
2369 |
|
|
2370 |
0 |
if (av.cursorMode) |
2371 |
|
{ |
2372 |
0 |
seqCanvas.cursorX = res; |
2373 |
0 |
seqCanvas.cursorY = seq; |
2374 |
0 |
seqCanvas.repaint(); |
2375 |
0 |
return; |
2376 |
|
} |
2377 |
|
|
2378 |
0 |
if (stretchGroup == null) |
2379 |
|
{ |
2380 |
0 |
createStretchGroup(res, sequence); |
2381 |
|
} |
2382 |
|
|
2383 |
0 |
if (stretchGroup != null) |
2384 |
|
{ |
2385 |
0 |
stretchGroup.addPropertyChangeListener(seqCanvas); |
2386 |
|
} |
2387 |
|
|
2388 |
0 |
seqCanvas.repaint(); |
2389 |
|
} |
2390 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.47 |
|
2391 |
0 |
private void createStretchGroup(int res, SequenceI sequence)... |
2392 |
|
{ |
2393 |
|
|
2394 |
|
|
2395 |
0 |
SequenceGroup sg = new SequenceGroup(); |
2396 |
0 |
sg.setStartRes(res); |
2397 |
0 |
sg.setEndRes(res); |
2398 |
0 |
sg.addSequence(sequence, false); |
2399 |
0 |
av.setSelectionGroup(sg); |
2400 |
0 |
stretchGroup = sg; |
2401 |
|
|
2402 |
0 |
if (av.getConservationSelected()) |
2403 |
|
{ |
2404 |
0 |
SliderPanel.setConservationSlider(ap, av.getResidueShading(), |
2405 |
|
ap.getViewName()); |
2406 |
|
} |
2407 |
|
|
2408 |
0 |
if (av.getAbovePIDThreshold()) |
2409 |
|
{ |
2410 |
0 |
SliderPanel.setPIDSliderSource(ap, av.getResidueShading(), |
2411 |
|
ap.getViewName()); |
2412 |
|
} |
2413 |
|
|
2414 |
|
|
2415 |
0 |
if ((stretchGroup != null) && (stretchGroup.getEndRes() == res)) |
2416 |
|
{ |
2417 |
|
|
2418 |
0 |
changeEndRes = true; |
2419 |
|
} |
2420 |
0 |
else if ((stretchGroup != null) && (stretchGroup.getStartRes() == res)) |
2421 |
|
{ |
2422 |
|
|
2423 |
0 |
changeStartRes = true; |
2424 |
|
} |
2425 |
0 |
stretchGroup.getWidth(); |
2426 |
|
|
2427 |
|
} |
2428 |
|
|
2429 |
|
|
2430 |
|
|
2431 |
|
|
2432 |
|
@param |
2433 |
|
@param |
2434 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
2435 |
0 |
void showPopupMenu(MouseEvent evt, MousePos pos)... |
2436 |
|
{ |
2437 |
0 |
final int column = pos.column; |
2438 |
0 |
final int seq = pos.seqIndex; |
2439 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seq); |
2440 |
0 |
if (sequence != null) |
2441 |
|
{ |
2442 |
0 |
PopupMenu pop = new PopupMenu(ap, sequence, column); |
2443 |
0 |
pop.show(this, evt.getX(), evt.getY()); |
2444 |
|
} |
2445 |
|
} |
2446 |
|
|
2447 |
|
|
2448 |
|
|
2449 |
|
|
2450 |
|
@param |
2451 |
|
|
2452 |
|
@param |
2453 |
|
|
2454 |
|
|
2455 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 7 |
Complexity Density: 0.3 |
|
2456 |
0 |
protected void doMouseReleasedDefineMode(MouseEvent evt,... |
2457 |
|
boolean afterDrag) |
2458 |
|
{ |
2459 |
0 |
if (stretchGroup == null) |
2460 |
|
{ |
2461 |
0 |
return; |
2462 |
|
} |
2463 |
|
|
2464 |
0 |
stretchGroup.removePropertyChangeListener(seqCanvas); |
2465 |
|
|
2466 |
|
|
2467 |
|
|
2468 |
0 |
boolean vischange = stretchGroup.recalcConservation(true); |
2469 |
0 |
updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup() |
2470 |
|
&& afterDrag; |
2471 |
0 |
if (stretchGroup.cs != null) |
2472 |
|
{ |
2473 |
0 |
if (afterDrag) |
2474 |
|
{ |
2475 |
0 |
stretchGroup.cs.alignmentChanged(stretchGroup, |
2476 |
|
av.getHiddenRepSequences()); |
2477 |
|
} |
2478 |
|
|
2479 |
0 |
ResidueShaderI groupColourScheme = stretchGroup |
2480 |
|
.getGroupColourScheme(); |
2481 |
0 |
String name = stretchGroup.getName(); |
2482 |
0 |
if (stretchGroup.cs.conservationApplied()) |
2483 |
|
{ |
2484 |
0 |
SliderPanel.setConservationSlider(ap, groupColourScheme, name); |
2485 |
|
} |
2486 |
0 |
if (stretchGroup.cs.getThreshold() > 0) |
2487 |
|
{ |
2488 |
0 |
SliderPanel.setPIDSliderSource(ap, groupColourScheme, name); |
2489 |
|
} |
2490 |
0 |
if (stretchGroup.cs.isConsensusSecondaryStructureColouring()) |
2491 |
|
{ |
2492 |
0 |
SliderPanel.setConsensusSecondaryStructureSlider(ap, |
2493 |
|
groupColourScheme, name); |
2494 |
|
} |
2495 |
|
} |
2496 |
0 |
PaintRefresher.Refresh(this, av.getSequenceSetId()); |
2497 |
|
|
2498 |
|
|
2499 |
0 |
ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs); |
2500 |
0 |
updateOverviewAndStructs = false; |
2501 |
0 |
changeEndRes = false; |
2502 |
0 |
changeStartRes = false; |
2503 |
0 |
stretchGroup = null; |
2504 |
0 |
av.sendSelection(); |
2505 |
|
} |
2506 |
|
|
2507 |
|
|
2508 |
|
|
2509 |
|
|
2510 |
|
|
2511 |
|
@param |
2512 |
|
|
|
|
| 0% |
Uncovered Elements: 103 (103) |
Complexity: 25 |
Complexity Density: 0.4 |
|
2513 |
0 |
protected void dragStretchGroup(MouseEvent evt)... |
2514 |
|
{ |
2515 |
0 |
if (stretchGroup == null) |
2516 |
|
{ |
2517 |
0 |
return; |
2518 |
|
} |
2519 |
|
|
2520 |
0 |
MousePos pos = findMousePosition(evt); |
2521 |
0 |
if (pos.isOverAnnotation() || pos.column == -1 || pos.seqIndex == -1) |
2522 |
|
{ |
2523 |
0 |
return; |
2524 |
|
} |
2525 |
|
|
2526 |
0 |
int res = pos.column; |
2527 |
0 |
int y = pos.seqIndex; |
2528 |
|
|
2529 |
0 |
if (wrappedBlock != startWrapBlock) |
2530 |
|
{ |
2531 |
0 |
return; |
2532 |
|
} |
2533 |
|
|
2534 |
0 |
res = Math.min(res, av.getAlignment().getWidth() - 1); |
2535 |
|
|
2536 |
0 |
if (stretchGroup.getEndRes() == res) |
2537 |
|
{ |
2538 |
|
|
2539 |
0 |
changeEndRes = true; |
2540 |
|
} |
2541 |
0 |
else if (stretchGroup.getStartRes() == res) |
2542 |
|
{ |
2543 |
|
|
2544 |
0 |
changeStartRes = true; |
2545 |
|
} |
2546 |
|
|
2547 |
0 |
if (res < av.getRanges().getStartRes()) |
2548 |
|
{ |
2549 |
0 |
res = av.getRanges().getStartRes(); |
2550 |
|
} |
2551 |
|
|
2552 |
0 |
if (changeEndRes) |
2553 |
|
{ |
2554 |
0 |
if (res > (stretchGroup.getStartRes() - 1)) |
2555 |
|
{ |
2556 |
0 |
stretchGroup.setEndRes(res); |
2557 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
2558 |
|
} |
2559 |
|
} |
2560 |
0 |
else if (changeStartRes) |
2561 |
|
{ |
2562 |
0 |
if (res < (stretchGroup.getEndRes() + 1)) |
2563 |
|
{ |
2564 |
0 |
stretchGroup.setStartRes(res); |
2565 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
2566 |
|
} |
2567 |
|
} |
2568 |
|
|
2569 |
0 |
int dragDirection = 0; |
2570 |
|
|
2571 |
0 |
if (y > oldSeq) |
2572 |
|
{ |
2573 |
0 |
dragDirection = 1; |
2574 |
|
} |
2575 |
0 |
else if (y < oldSeq) |
2576 |
|
{ |
2577 |
0 |
dragDirection = -1; |
2578 |
|
} |
2579 |
|
|
2580 |
0 |
while ((y != oldSeq) && (oldSeq > -1) |
2581 |
|
&& (y < av.getAlignment().getHeight())) |
2582 |
|
{ |
2583 |
|
|
2584 |
|
|
2585 |
0 |
Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq); |
2586 |
|
|
2587 |
0 |
oldSeq += dragDirection; |
2588 |
|
|
2589 |
0 |
if (oldSeq < 0) |
2590 |
|
{ |
2591 |
0 |
break; |
2592 |
|
} |
2593 |
|
|
2594 |
0 |
Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq); |
2595 |
|
|
2596 |
0 |
if (stretchGroup.getSequences(null).contains(nextSeq)) |
2597 |
|
{ |
2598 |
0 |
stretchGroup.deleteSequence(seq, false); |
2599 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
2600 |
|
} |
2601 |
|
else |
2602 |
|
{ |
2603 |
0 |
if (seq != null) |
2604 |
|
{ |
2605 |
0 |
stretchGroup.addSequence(seq, false); |
2606 |
|
} |
2607 |
|
|
2608 |
0 |
stretchGroup.addSequence(nextSeq, false); |
2609 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
2610 |
|
} |
2611 |
|
} |
2612 |
|
|
2613 |
0 |
if (oldSeq < 0) |
2614 |
|
{ |
2615 |
0 |
oldSeq = -1; |
2616 |
|
} |
2617 |
|
|
2618 |
0 |
mouseDragging = true; |
2619 |
|
|
2620 |
0 |
if (scrollThread != null) |
2621 |
|
{ |
2622 |
0 |
scrollThread.setMousePosition(evt.getPoint()); |
2623 |
|
} |
2624 |
|
|
2625 |
|
|
2626 |
|
|
2627 |
|
|
2628 |
0 |
StringBuilder status = new StringBuilder(64); |
2629 |
0 |
List<SequenceI> seqs = stretchGroup.getSequences(); |
2630 |
0 |
String name = seqs.get(0).getName(); |
2631 |
0 |
if (name.length() > 20) |
2632 |
|
{ |
2633 |
0 |
name = name.substring(0, 20); |
2634 |
|
} |
2635 |
0 |
status.append(name).append(" - "); |
2636 |
0 |
name = seqs.get(seqs.size() - 1).getName(); |
2637 |
0 |
if (name.length() > 20) |
2638 |
|
{ |
2639 |
0 |
name = name.substring(0, 20); |
2640 |
|
} |
2641 |
0 |
status.append(name).append(" "); |
2642 |
0 |
int startRes = stretchGroup.getStartRes(); |
2643 |
0 |
status.append(" cols ").append(String.valueOf(startRes + 1)) |
2644 |
|
.append("-"); |
2645 |
0 |
int endRes = stretchGroup.getEndRes(); |
2646 |
0 |
status.append(String.valueOf(endRes + 1)); |
2647 |
0 |
status.append(" (").append(String.valueOf(seqs.size())).append(" x ") |
2648 |
|
.append(String.valueOf(endRes - startRes + 1)).append(")"); |
2649 |
0 |
ap.alignFrame.setStatus(status.toString()); |
2650 |
|
} |
2651 |
|
|
2652 |
|
|
2653 |
|
|
2654 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
2655 |
3 |
void stopScrolling()... |
2656 |
|
{ |
2657 |
3 |
if (scrollThread != null) |
2658 |
|
{ |
2659 |
0 |
scrollThread.stopScrolling(); |
2660 |
0 |
scrollThread = null; |
2661 |
|
} |
2662 |
3 |
mouseDragging = false; |
2663 |
|
} |
2664 |
|
|
2665 |
|
|
2666 |
|
|
2667 |
|
|
2668 |
|
|
2669 |
|
@param |
2670 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
2671 |
0 |
void startScrolling(Point mousePos)... |
2672 |
|
{ |
2673 |
|
|
2674 |
|
|
2675 |
|
|
2676 |
|
|
2677 |
0 |
mouseDragging = true; |
2678 |
0 |
if (!av.getWrapAlignment() && scrollThread == null) |
2679 |
|
{ |
2680 |
0 |
scrollThread = new ScrollThread(); |
2681 |
0 |
scrollThread.setMousePosition(mousePos); |
2682 |
0 |
if (Platform.isJS()) |
2683 |
|
{ |
2684 |
|
|
2685 |
|
|
2686 |
|
|
2687 |
|
|
2688 |
0 |
Timer t = new Timer(20, new ActionListener() |
2689 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
2690 |
0 |
@Override... |
2691 |
|
public void actionPerformed(ActionEvent e) |
2692 |
|
{ |
2693 |
0 |
if (scrollThread != null) |
2694 |
|
{ |
2695 |
|
|
2696 |
0 |
scrollThread.scrollOnce(); |
2697 |
|
} |
2698 |
|
} |
2699 |
|
}); |
2700 |
0 |
t.addActionListener(new ActionListener() |
2701 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
2702 |
0 |
@Override... |
2703 |
|
public void actionPerformed(ActionEvent e) |
2704 |
|
{ |
2705 |
0 |
if (scrollThread == null) |
2706 |
|
{ |
2707 |
|
|
2708 |
0 |
t.stop(); |
2709 |
|
} |
2710 |
|
} |
2711 |
|
}); |
2712 |
0 |
t.start(); |
2713 |
|
} |
2714 |
|
else |
2715 |
|
{ |
2716 |
|
|
2717 |
|
|
2718 |
|
|
2719 |
0 |
scrollThread.start(); |
2720 |
|
} |
2721 |
|
} |
2722 |
|
} |
2723 |
|
|
2724 |
|
|
2725 |
|
|
2726 |
|
|
2727 |
|
|
2728 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 13 |
Complexity Density: 0.59 |
|
2729 |
|
class ScrollThread extends Thread |
2730 |
|
{ |
2731 |
|
private Point mousePos; |
2732 |
|
|
2733 |
|
private volatile boolean keepRunning = true; |
2734 |
|
|
2735 |
|
|
2736 |
|
|
2737 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2738 |
0 |
public ScrollThread()... |
2739 |
|
{ |
2740 |
0 |
setName("SeqPanel$ScrollThread"); |
2741 |
|
} |
2742 |
|
|
2743 |
|
|
2744 |
|
|
2745 |
|
|
2746 |
|
|
2747 |
|
|
2748 |
|
|
2749 |
|
|
2750 |
|
@param |
2751 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2752 |
0 |
public void setMousePosition(Point p)... |
2753 |
|
{ |
2754 |
0 |
mousePos = p; |
2755 |
|
} |
2756 |
|
|
2757 |
|
|
2758 |
|
|
2759 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2760 |
0 |
public void stopScrolling()... |
2761 |
|
{ |
2762 |
0 |
keepRunning = false; |
2763 |
|
} |
2764 |
|
|
2765 |
|
|
2766 |
|
|
2767 |
|
|
2768 |
|
|
2769 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
2770 |
0 |
@Override... |
2771 |
|
public void run() |
2772 |
|
{ |
2773 |
0 |
while (keepRunning) |
2774 |
|
{ |
2775 |
0 |
if (mousePos != null) |
2776 |
|
{ |
2777 |
0 |
keepRunning = scrollOnce(); |
2778 |
|
} |
2779 |
0 |
try |
2780 |
|
{ |
2781 |
0 |
Thread.sleep(20); |
2782 |
|
} catch (Exception ex) |
2783 |
|
{ |
2784 |
|
} |
2785 |
|
} |
2786 |
0 |
SeqPanel.this.scrollThread = null; |
2787 |
|
} |
2788 |
|
|
2789 |
|
|
2790 |
|
|
2791 |
|
|
2792 |
|
|
2793 |
|
|
2794 |
|
|
2795 |
|
|
2796 |
|
|
2797 |
|
|
2798 |
|
|
2799 |
|
|
2800 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0.46 |
|
2801 |
0 |
boolean scrollOnce()... |
2802 |
|
{ |
2803 |
|
|
2804 |
|
|
2805 |
|
|
2806 |
0 |
if (!mouseDragging) |
2807 |
|
{ |
2808 |
0 |
return false; |
2809 |
|
} |
2810 |
|
|
2811 |
0 |
boolean scrolled = false; |
2812 |
0 |
ViewportRanges ranges = SeqPanel.this.av.getRanges(); |
2813 |
|
|
2814 |
|
|
2815 |
|
|
2816 |
|
|
2817 |
0 |
if (mousePos.y < 0) |
2818 |
|
{ |
2819 |
|
|
2820 |
0 |
scrolled = ranges.scrollUp(true); |
2821 |
|
} |
2822 |
0 |
else if (mousePos.y >= getHeight()) |
2823 |
|
{ |
2824 |
|
|
2825 |
0 |
scrolled = ranges.scrollUp(false); |
2826 |
|
} |
2827 |
|
|
2828 |
|
|
2829 |
|
|
2830 |
|
|
2831 |
0 |
if (mousePos.x < 0) |
2832 |
|
{ |
2833 |
0 |
scrolled |= ranges.scrollRight(false); |
2834 |
|
} |
2835 |
0 |
else if (mousePos.x >= getWidth()) |
2836 |
|
{ |
2837 |
0 |
scrolled |= ranges.scrollRight(true); |
2838 |
|
} |
2839 |
0 |
return scrolled; |
2840 |
|
} |
2841 |
|
} |
2842 |
|
|
2843 |
|
|
2844 |
|
|
2845 |
|
|
|
|
| 51.3% |
Uncovered Elements: 37 (76) |
Complexity: 25 |
Complexity Density: 0.6 |
|
2846 |
100 |
@Override... |
2847 |
|
public void selection(SequenceGroup seqsel, ColumnSelection colsel, |
2848 |
|
HiddenColumns hidden, SelectionSource source) |
2849 |
|
{ |
2850 |
|
|
2851 |
|
|
2852 |
|
|
2853 |
|
|
2854 |
100 |
boolean iSentTheSelection = (av == source |
2855 |
|
|| (source instanceof AlignViewport |
2856 |
|
&& ((AlignmentViewport) source).getSequenceSetId() |
2857 |
|
.equals(av.getSequenceSetId()))); |
2858 |
|
|
2859 |
100 |
if (iSentTheSelection) |
2860 |
|
{ |
2861 |
|
|
2862 |
24 |
if (ap.getCalculationDialog() != null) |
2863 |
|
{ |
2864 |
0 |
ap.getCalculationDialog().validateCalcTypes(); |
2865 |
|
} |
2866 |
|
|
2867 |
24 |
return; |
2868 |
|
} |
2869 |
|
|
2870 |
|
|
2871 |
76 |
if (!av.followSelection) |
2872 |
|
{ |
2873 |
0 |
return; |
2874 |
|
} |
2875 |
|
|
2876 |
|
|
2877 |
|
|
2878 |
|
|
2879 |
76 |
if (av.isSelectionGroupChanged(false) || av.isColSelChanged(false)) |
2880 |
|
{ |
2881 |
0 |
return; |
2882 |
|
} |
2883 |
|
|
2884 |
|
|
2885 |
|
|
2886 |
|
|
2887 |
|
|
2888 |
76 |
if (selectionFromTranslation(seqsel, colsel, hidden, source)) |
2889 |
|
{ |
2890 |
0 |
return; |
2891 |
|
} |
2892 |
|
|
2893 |
|
|
2894 |
|
|
2895 |
|
|
2896 |
|
|
2897 |
|
|
2898 |
|
|
2899 |
76 |
boolean repaint = false; |
2900 |
76 |
boolean copycolsel = false; |
2901 |
|
|
2902 |
76 |
SequenceGroup sgroup = null; |
2903 |
76 |
if (seqsel != null && seqsel.getSize() > 0) |
2904 |
|
{ |
2905 |
57 |
if (av.getAlignment() == null) |
2906 |
|
{ |
2907 |
0 |
Console.warn("alignviewport av SeqSetId=" + av.getSequenceSetId() |
2908 |
|
+ " ViewId=" + av.getViewId() |
2909 |
|
+ " 's alignment is NULL! returning immediately."); |
2910 |
0 |
return; |
2911 |
|
} |
2912 |
57 |
sgroup = seqsel.intersect(av.getAlignment(), |
2913 |
57 |
(av.hasHiddenRows()) ? av.getHiddenRepSequences() : null); |
2914 |
57 |
if ((sgroup != null && sgroup.getSize() > 0)) |
2915 |
|
{ |
2916 |
0 |
copycolsel = true; |
2917 |
|
} |
2918 |
|
} |
2919 |
76 |
if (sgroup != null && sgroup.getSize() > 0) |
2920 |
|
{ |
2921 |
0 |
av.setSelectionGroup(sgroup); |
2922 |
|
} |
2923 |
|
else |
2924 |
|
{ |
2925 |
76 |
av.setSelectionGroup(null); |
2926 |
|
} |
2927 |
76 |
av.isSelectionGroupChanged(true); |
2928 |
76 |
repaint = true; |
2929 |
|
|
2930 |
76 |
if (copycolsel) |
2931 |
|
{ |
2932 |
|
|
2933 |
|
|
2934 |
0 |
if (colsel == null || colsel.isEmpty()) |
2935 |
|
{ |
2936 |
0 |
if (av.getColumnSelection() != null) |
2937 |
|
{ |
2938 |
0 |
av.getColumnSelection().clear(); |
2939 |
0 |
repaint = true; |
2940 |
|
} |
2941 |
|
} |
2942 |
|
else |
2943 |
|
{ |
2944 |
|
|
2945 |
0 |
if (av.getColumnSelection() == null) |
2946 |
|
{ |
2947 |
0 |
av.setColumnSelection(new ColumnSelection(colsel)); |
2948 |
|
} |
2949 |
|
else |
2950 |
|
{ |
2951 |
0 |
av.getColumnSelection().setElementsFrom(colsel, |
2952 |
|
av.getAlignment().getHiddenColumns()); |
2953 |
|
} |
2954 |
|
} |
2955 |
0 |
av.isColSelChanged(true); |
2956 |
0 |
repaint = true; |
2957 |
|
} |
2958 |
|
|
2959 |
76 |
if (copycolsel && av.hasHiddenColumns() |
2960 |
|
&& (av.getAlignment().getHiddenColumns() == null)) |
2961 |
|
{ |
2962 |
0 |
jalview.bin.Console.errPrintln("Bad things"); |
2963 |
|
} |
2964 |
76 |
if (repaint) |
2965 |
|
{ |
2966 |
|
|
2967 |
76 |
PaintRefresher.Refresh(this, av.getSequenceSetId()); |
2968 |
|
|
2969 |
|
} |
2970 |
|
|
2971 |
|
|
2972 |
76 |
if (ap.getCalculationDialog() != null) |
2973 |
|
{ |
2974 |
0 |
ap.getCalculationDialog().validateCalcTypes(); |
2975 |
|
} |
2976 |
|
|
2977 |
|
} |
2978 |
|
|
2979 |
|
|
2980 |
|
|
2981 |
|
|
2982 |
|
|
2983 |
|
|
2984 |
|
@param |
2985 |
|
@param |
2986 |
|
@param |
2987 |
|
|
|
|
| 23.1% |
Uncovered Elements: 20 (26) |
Complexity: 7 |
Complexity Density: 0.39 |
|
2988 |
76 |
protected boolean selectionFromTranslation(SequenceGroup seqsel,... |
2989 |
|
ColumnSelection colsel, HiddenColumns hidden, |
2990 |
|
SelectionSource source) |
2991 |
|
{ |
2992 |
76 |
if (!(source instanceof AlignViewportI)) |
2993 |
|
{ |
2994 |
0 |
return false; |
2995 |
|
} |
2996 |
76 |
final AlignViewportI sourceAv = (AlignViewportI) source; |
2997 |
76 |
if (sourceAv.getCodingComplement() != av |
2998 |
|
&& av.getCodingComplement() != sourceAv) |
2999 |
|
{ |
3000 |
76 |
return false; |
3001 |
|
} |
3002 |
|
|
3003 |
|
|
3004 |
|
|
3005 |
|
|
3006 |
0 |
SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av); |
3007 |
0 |
av.setSelectionGroup(sg != null && sg.getSize() > 0 ? sg : null); |
3008 |
0 |
av.isSelectionGroupChanged(true); |
3009 |
|
|
3010 |
|
|
3011 |
|
|
3012 |
|
|
3013 |
|
|
3014 |
|
|
3015 |
0 |
ColumnSelection cs = new ColumnSelection(); |
3016 |
0 |
HiddenColumns hs = new HiddenColumns(); |
3017 |
0 |
MappingUtils.mapColumnSelection(colsel, hidden, sourceAv, av, cs, hs); |
3018 |
0 |
av.setColumnSelection(cs); |
3019 |
0 |
boolean hiddenChanged = av.getAlignment().setHiddenColumns(hs); |
3020 |
|
|
3021 |
|
|
3022 |
0 |
if (ap.getCalculationDialog() != null) |
3023 |
|
{ |
3024 |
0 |
ap.getCalculationDialog().validateCalcTypes(); |
3025 |
|
} |
3026 |
|
|
3027 |
|
|
3028 |
|
|
3029 |
|
|
3030 |
|
|
3031 |
0 |
ap.paintAlignment(hiddenChanged, hiddenChanged); |
3032 |
|
|
3033 |
0 |
PaintRefresher.Refresh(ap, av.getSequenceSetId()); |
3034 |
|
|
3035 |
0 |
return true; |
3036 |
|
} |
3037 |
|
|
3038 |
|
|
3039 |
|
|
3040 |
|
@return |
3041 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
3042 |
1 |
public SearchResultsI getLastSearchResults()... |
3043 |
|
{ |
3044 |
1 |
return lastSearchResults; |
3045 |
|
} |
3046 |
|
} |