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 jalview.api.AlignViewportI; |
24 |
|
import jalview.bin.Cache; |
25 |
|
import jalview.bin.Jalview; |
26 |
|
import jalview.commands.EditCommand; |
27 |
|
import jalview.commands.EditCommand.Action; |
28 |
|
import jalview.commands.EditCommand.Edit; |
29 |
|
import jalview.datamodel.AlignmentI; |
30 |
|
import jalview.datamodel.ColumnSelection; |
31 |
|
import jalview.datamodel.HiddenColumns; |
32 |
|
import jalview.datamodel.SearchResultMatchI; |
33 |
|
import jalview.datamodel.SearchResults; |
34 |
|
import jalview.datamodel.SearchResultsI; |
35 |
|
import jalview.datamodel.Sequence; |
36 |
|
import jalview.datamodel.SequenceFeature; |
37 |
|
import jalview.datamodel.SequenceGroup; |
38 |
|
import jalview.datamodel.SequenceI; |
39 |
|
import jalview.io.SequenceAnnotationReport; |
40 |
|
import jalview.renderer.ResidueShaderI; |
41 |
|
import jalview.schemes.ResidueProperties; |
42 |
|
import jalview.structure.SelectionListener; |
43 |
|
import jalview.structure.SelectionSource; |
44 |
|
import jalview.structure.SequenceListener; |
45 |
|
import jalview.structure.StructureSelectionManager; |
46 |
|
import jalview.structure.VamsasSource; |
47 |
|
import jalview.util.Comparison; |
48 |
|
import jalview.util.MappingUtils; |
49 |
|
import jalview.util.MessageManager; |
50 |
|
import jalview.util.Platform; |
51 |
|
import jalview.viewmodel.AlignmentViewport; |
52 |
|
import jalview.viewmodel.ViewportRanges; |
53 |
|
|
54 |
|
import java.awt.BorderLayout; |
55 |
|
import java.awt.Color; |
56 |
|
import java.awt.Font; |
57 |
|
import java.awt.FontMetrics; |
58 |
|
import java.awt.Point; |
59 |
|
import java.awt.event.ActionEvent; |
60 |
|
import java.awt.event.ActionListener; |
61 |
|
import java.awt.event.MouseEvent; |
62 |
|
import java.awt.event.MouseListener; |
63 |
|
import java.awt.event.MouseMotionListener; |
64 |
|
import java.awt.event.MouseWheelEvent; |
65 |
|
import java.awt.event.MouseWheelListener; |
66 |
|
import java.util.Collections; |
67 |
|
import java.util.List; |
68 |
|
|
69 |
|
import javax.swing.JLabel; |
70 |
|
import javax.swing.JPanel; |
71 |
|
import javax.swing.JToolTip; |
72 |
|
import javax.swing.SwingUtilities; |
73 |
|
import javax.swing.Timer; |
74 |
|
import javax.swing.ToolTipManager; |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@author |
80 |
|
@version |
81 |
|
|
|
|
| 9.4% |
Uncovered Elements: 1,124 (1,240) |
Complexity: 338 |
Complexity Density: 0.45 |
|
82 |
|
public class SeqPanel extends JPanel |
83 |
|
implements MouseListener, MouseMotionListener, MouseWheelListener, |
84 |
|
SequenceListener, SelectionListener |
85 |
|
{ |
86 |
|
private static final int MAX_TOOLTIP_LENGTH = 300; |
87 |
|
|
88 |
|
public SeqCanvas seqCanvas; |
89 |
|
|
90 |
|
public AlignmentPanel ap; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
private int lastMouseColumn; |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
private int lastMouseSeq; |
101 |
|
|
102 |
|
protected int lastres; |
103 |
|
|
104 |
|
protected int startseq; |
105 |
|
|
106 |
|
protected AlignViewport av; |
107 |
|
|
108 |
|
ScrollThread scrollThread = null; |
109 |
|
|
110 |
|
boolean mouseDragging = false; |
111 |
|
|
112 |
|
boolean editingSeqs = false; |
113 |
|
|
114 |
|
boolean groupEditing = false; |
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
int oldSeq = -1; |
120 |
|
|
121 |
|
boolean changeEndSeq = false; |
122 |
|
|
123 |
|
boolean changeStartSeq = false; |
124 |
|
|
125 |
|
boolean changeEndRes = false; |
126 |
|
|
127 |
|
boolean changeStartRes = false; |
128 |
|
|
129 |
|
SequenceGroup stretchGroup = null; |
130 |
|
|
131 |
|
boolean remove = false; |
132 |
|
|
133 |
|
Point lastMousePress; |
134 |
|
|
135 |
|
boolean mouseWheelPressed = false; |
136 |
|
|
137 |
|
StringBuffer keyboardNo1; |
138 |
|
|
139 |
|
StringBuffer keyboardNo2; |
140 |
|
|
141 |
|
java.net.URL linkImageURL; |
142 |
|
|
143 |
|
private final SequenceAnnotationReport seqARep; |
144 |
|
|
145 |
|
StringBuilder tooltipText = new StringBuilder(); |
146 |
|
|
147 |
|
String tmpString; |
148 |
|
|
149 |
|
EditCommand editCommand; |
150 |
|
|
151 |
|
StructureSelectionManager ssm; |
152 |
|
|
153 |
|
SearchResultsI lastSearchResults; |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
@param |
159 |
|
@param |
160 |
|
|
|
|
| 95.5% |
Uncovered Elements: 1 (22) |
Complexity: 2 |
Complexity Density: 0.1 |
|
161 |
217 |
public SeqPanel(AlignViewport viewport, AlignmentPanel alignPanel)... |
162 |
|
{ |
163 |
217 |
linkImageURL = getClass().getResource("/images/link.gif"); |
164 |
217 |
seqARep = new SequenceAnnotationReport(linkImageURL.toString()); |
165 |
217 |
ToolTipManager.sharedInstance().registerComponent(this); |
166 |
217 |
ToolTipManager.sharedInstance().setInitialDelay(0); |
167 |
217 |
ToolTipManager.sharedInstance().setDismissDelay(10000); |
168 |
|
|
169 |
|
|
170 |
217 |
this.av = viewport; |
171 |
217 |
setBackground(Color.white); |
172 |
|
|
173 |
217 |
seqCanvas = new SeqCanvas(alignPanel); |
174 |
217 |
setLayout(new BorderLayout()); |
175 |
217 |
add(seqCanvas, BorderLayout.CENTER); |
176 |
|
|
177 |
217 |
this.ap = alignPanel; |
178 |
|
|
179 |
217 |
if (!viewport.isDataset()) |
180 |
|
{ |
181 |
217 |
addMouseMotionListener(this); |
182 |
217 |
addMouseListener(this); |
183 |
217 |
addMouseWheelListener(this); |
184 |
217 |
ssm = viewport.getStructureSelectionManager(); |
185 |
217 |
ssm.addStructureViewerListener(this); |
186 |
217 |
ssm.addSelectionListener(this); |
187 |
|
} |
188 |
|
|
189 |
217 |
lastMouseColumn = -1; |
190 |
217 |
lastMouseSeq = -1; |
191 |
|
} |
192 |
|
|
193 |
|
int startWrapBlock = -1; |
194 |
|
|
195 |
|
int wrappedBlock = -1; |
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
@param |
202 |
|
@return |
203 |
|
|
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 7 |
Complexity Density: 0.27 |
|
204 |
0 |
int findColumn(MouseEvent evt)... |
205 |
|
{ |
206 |
0 |
int res = 0; |
207 |
0 |
int x = evt.getX(); |
208 |
|
|
209 |
0 |
int startRes = av.getRanges().getStartRes(); |
210 |
0 |
if (av.getWrapAlignment()) |
211 |
|
{ |
212 |
|
|
213 |
0 |
int hgap = av.getCharHeight(); |
214 |
0 |
if (av.getScaleAboveWrapped()) |
215 |
|
{ |
216 |
0 |
hgap += av.getCharHeight(); |
217 |
|
} |
218 |
|
|
219 |
0 |
int cHeight = av.getAlignment().getHeight() * av.getCharHeight() |
220 |
|
+ hgap + seqCanvas.getAnnotationHeight(); |
221 |
|
|
222 |
0 |
int y = evt.getY(); |
223 |
0 |
y = Math.max(0, y - hgap); |
224 |
0 |
x = Math.max(0, x - seqCanvas.getLabelWidthWest()); |
225 |
|
|
226 |
0 |
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth()); |
227 |
0 |
if (cwidth < 1) |
228 |
|
{ |
229 |
0 |
return 0; |
230 |
|
} |
231 |
|
|
232 |
0 |
wrappedBlock = y / cHeight; |
233 |
0 |
wrappedBlock += startRes / cwidth; |
234 |
|
|
235 |
0 |
int startOffset = startRes % cwidth; |
236 |
0 |
res = wrappedBlock * cwidth + startOffset |
237 |
|
+ +Math.min(cwidth - 1, x / av.getCharWidth()); |
238 |
|
} |
239 |
|
else |
240 |
|
{ |
241 |
0 |
if (x > seqCanvas.getX() + seqCanvas.getWidth()) |
242 |
|
{ |
243 |
|
|
244 |
|
|
245 |
0 |
x = seqCanvas.getX() + seqCanvas.getWidth(); |
246 |
|
} |
247 |
0 |
res = (x / av.getCharWidth()) + startRes; |
248 |
0 |
if (res > av.getRanges().getEndRes()) |
249 |
|
{ |
250 |
|
|
251 |
0 |
res = av.getRanges().getEndRes(); |
252 |
|
} |
253 |
|
} |
254 |
|
|
255 |
0 |
if (av.hasHiddenColumns()) |
256 |
|
{ |
257 |
0 |
res = av.getAlignment().getHiddenColumns() |
258 |
|
.visibleToAbsoluteColumn(res); |
259 |
|
} |
260 |
|
|
261 |
0 |
return res; |
262 |
|
|
263 |
|
} |
264 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
265 |
0 |
int findSeq(MouseEvent evt)... |
266 |
|
{ |
267 |
0 |
int seq = 0; |
268 |
0 |
int y = evt.getY(); |
269 |
|
|
270 |
0 |
if (av.getWrapAlignment()) |
271 |
|
{ |
272 |
0 |
int hgap = av.getCharHeight(); |
273 |
0 |
if (av.getScaleAboveWrapped()) |
274 |
|
{ |
275 |
0 |
hgap += av.getCharHeight(); |
276 |
|
} |
277 |
|
|
278 |
0 |
int cHeight = av.getAlignment().getHeight() * av.getCharHeight() |
279 |
|
+ hgap + seqCanvas.getAnnotationHeight(); |
280 |
|
|
281 |
0 |
y -= hgap; |
282 |
|
|
283 |
0 |
seq = Math.min((y % cHeight) / av.getCharHeight(), |
284 |
|
av.getAlignment().getHeight() - 1); |
285 |
|
} |
286 |
|
else |
287 |
|
{ |
288 |
0 |
seq = Math.min( |
289 |
|
(y / av.getCharHeight()) + av.getRanges().getStartSeq(), |
290 |
|
av.getAlignment().getHeight() - 1); |
291 |
|
} |
292 |
|
|
293 |
0 |
return seq; |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.27 |
|
300 |
0 |
void endEditing()... |
301 |
|
{ |
302 |
0 |
try |
303 |
|
{ |
304 |
0 |
if (editCommand != null && editCommand.getSize() > 0) |
305 |
|
{ |
306 |
0 |
ap.alignFrame.addHistoryItem(editCommand); |
307 |
0 |
av.firePropertyChange("alignment", null, |
308 |
|
av.getAlignment().getSequences()); |
309 |
|
} |
310 |
|
} finally |
311 |
|
{ |
312 |
|
|
313 |
|
|
314 |
|
|
315 |
0 |
startseq = -1; |
316 |
0 |
lastres = -1; |
317 |
0 |
editingSeqs = false; |
318 |
0 |
groupEditing = false; |
319 |
0 |
keyboardNo1 = null; |
320 |
0 |
keyboardNo2 = null; |
321 |
0 |
editCommand = null; |
322 |
|
} |
323 |
|
} |
324 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
325 |
0 |
void setCursorRow()... |
326 |
|
{ |
327 |
0 |
seqCanvas.cursorY = getKeyboardNo1() - 1; |
328 |
0 |
scrollToVisible(true); |
329 |
|
} |
330 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
331 |
0 |
void setCursorColumn()... |
332 |
|
{ |
333 |
0 |
seqCanvas.cursorX = getKeyboardNo1() - 1; |
334 |
0 |
scrollToVisible(true); |
335 |
|
} |
336 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
337 |
0 |
void setCursorRowAndColumn()... |
338 |
|
{ |
339 |
0 |
if (keyboardNo2 == null) |
340 |
|
{ |
341 |
0 |
keyboardNo2 = new StringBuffer(); |
342 |
|
} |
343 |
|
else |
344 |
|
{ |
345 |
0 |
seqCanvas.cursorX = getKeyboardNo1() - 1; |
346 |
0 |
seqCanvas.cursorY = getKeyboardNo2() - 1; |
347 |
0 |
scrollToVisible(true); |
348 |
|
} |
349 |
|
} |
350 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
351 |
0 |
void setCursorPosition()... |
352 |
|
{ |
353 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY); |
354 |
|
|
355 |
0 |
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1; |
356 |
0 |
scrollToVisible(true); |
357 |
|
} |
358 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 10 |
Complexity Density: 0.56 |
|
359 |
0 |
void moveCursor(int dx, int dy)... |
360 |
|
{ |
361 |
0 |
seqCanvas.cursorX += dx; |
362 |
0 |
seqCanvas.cursorY += dy; |
363 |
|
|
364 |
0 |
HiddenColumns hidden = av.getAlignment().getHiddenColumns(); |
365 |
|
|
366 |
0 |
if (av.hasHiddenColumns() && !hidden.isVisible(seqCanvas.cursorX)) |
367 |
|
{ |
368 |
0 |
int original = seqCanvas.cursorX - dx; |
369 |
0 |
int maxWidth = av.getAlignment().getWidth(); |
370 |
|
|
371 |
0 |
if (!hidden.isVisible(seqCanvas.cursorX)) |
372 |
|
{ |
373 |
0 |
int visx = hidden.absoluteToVisibleColumn(seqCanvas.cursorX - dx); |
374 |
0 |
int[] region = hidden.getRegionWithEdgeAtRes(visx); |
375 |
|
|
376 |
0 |
if (region != null) |
377 |
|
{ |
378 |
0 |
if (dx == 1) |
379 |
|
{ |
380 |
|
|
381 |
0 |
seqCanvas.cursorX = region[1] + 1; |
382 |
|
} |
383 |
0 |
else if (dx == -1) |
384 |
|
{ |
385 |
|
|
386 |
0 |
seqCanvas.cursorX = region[0] - 1; |
387 |
|
} |
388 |
|
} |
389 |
0 |
seqCanvas.cursorX = (seqCanvas.cursorX < 0) ? 0 : seqCanvas.cursorX; |
390 |
|
} |
391 |
|
|
392 |
0 |
if (seqCanvas.cursorX >= maxWidth |
393 |
|
|| !hidden.isVisible(seqCanvas.cursorX)) |
394 |
|
{ |
395 |
0 |
seqCanvas.cursorX = original; |
396 |
|
} |
397 |
|
} |
398 |
|
|
399 |
0 |
scrollToVisible(false); |
400 |
|
} |
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
@param |
406 |
|
|
407 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 9 |
Complexity Density: 0.45 |
|
408 |
0 |
void scrollToVisible(boolean jump)... |
409 |
|
{ |
410 |
0 |
if (seqCanvas.cursorX < 0) |
411 |
|
{ |
412 |
0 |
seqCanvas.cursorX = 0; |
413 |
|
} |
414 |
0 |
else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1) |
415 |
|
{ |
416 |
0 |
seqCanvas.cursorX = av.getAlignment().getWidth() - 1; |
417 |
|
} |
418 |
|
|
419 |
0 |
if (seqCanvas.cursorY < 0) |
420 |
|
{ |
421 |
0 |
seqCanvas.cursorY = 0; |
422 |
|
} |
423 |
0 |
else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1) |
424 |
|
{ |
425 |
0 |
seqCanvas.cursorY = av.getAlignment().getHeight() - 1; |
426 |
|
} |
427 |
|
|
428 |
0 |
endEditing(); |
429 |
|
|
430 |
0 |
boolean repaintNeeded = true; |
431 |
0 |
if (jump) |
432 |
|
{ |
433 |
|
|
434 |
|
|
435 |
0 |
repaintNeeded = !av.getRanges().setViewportLocation(seqCanvas.cursorX, |
436 |
|
seqCanvas.cursorY); |
437 |
|
} |
438 |
|
else |
439 |
|
{ |
440 |
0 |
if (av.getWrapAlignment()) |
441 |
|
{ |
442 |
|
|
443 |
0 |
int x = av.getAlignment().getHiddenColumns() |
444 |
|
.absoluteToVisibleColumn(seqCanvas.cursorX); |
445 |
0 |
av.getRanges().scrollToWrappedVisible(x); |
446 |
|
} |
447 |
|
else |
448 |
|
{ |
449 |
0 |
av.getRanges().scrollToVisible(seqCanvas.cursorX, |
450 |
|
seqCanvas.cursorY); |
451 |
|
} |
452 |
|
} |
453 |
|
|
454 |
0 |
if (av.getAlignment().getHiddenColumns().isVisible(seqCanvas.cursorX)) |
455 |
|
{ |
456 |
0 |
setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY), |
457 |
|
seqCanvas.cursorX, seqCanvas.cursorY); |
458 |
|
} |
459 |
|
|
460 |
0 |
if (repaintNeeded) |
461 |
|
{ |
462 |
0 |
seqCanvas.repaint(); |
463 |
|
} |
464 |
|
} |
465 |
|
|
466 |
|
|
|
|
| 0% |
Uncovered Elements: 53 (53) |
Complexity: 11 |
Complexity Density: 0.33 |
|
467 |
0 |
void setSelectionAreaAtCursor(boolean topLeft)... |
468 |
|
{ |
469 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY); |
470 |
|
|
471 |
0 |
if (av.getSelectionGroup() != null) |
472 |
|
{ |
473 |
0 |
SequenceGroup sg = av.getSelectionGroup(); |
474 |
|
|
475 |
0 |
int min = av.getAlignment().getHeight(), max = 0; |
476 |
0 |
for (int i = 0; i < sg.getSize(); i++) |
477 |
|
{ |
478 |
0 |
int index = av.getAlignment().findIndex(sg.getSequenceAt(i)); |
479 |
0 |
if (index > max) |
480 |
|
{ |
481 |
0 |
max = index; |
482 |
|
} |
483 |
0 |
if (index < min) |
484 |
|
{ |
485 |
0 |
min = index; |
486 |
|
} |
487 |
|
} |
488 |
|
|
489 |
0 |
max++; |
490 |
|
|
491 |
0 |
if (topLeft) |
492 |
|
{ |
493 |
0 |
sg.setStartRes(seqCanvas.cursorX); |
494 |
0 |
if (sg.getEndRes() < seqCanvas.cursorX) |
495 |
|
{ |
496 |
0 |
sg.setEndRes(seqCanvas.cursorX); |
497 |
|
} |
498 |
|
|
499 |
0 |
min = seqCanvas.cursorY; |
500 |
|
} |
501 |
|
else |
502 |
|
{ |
503 |
0 |
sg.setEndRes(seqCanvas.cursorX); |
504 |
0 |
if (sg.getStartRes() > seqCanvas.cursorX) |
505 |
|
{ |
506 |
0 |
sg.setStartRes(seqCanvas.cursorX); |
507 |
|
} |
508 |
|
|
509 |
0 |
max = seqCanvas.cursorY + 1; |
510 |
|
} |
511 |
|
|
512 |
0 |
if (min > max) |
513 |
|
{ |
514 |
|
|
515 |
0 |
av.setSelectionGroup(null); |
516 |
|
} |
517 |
|
else |
518 |
|
{ |
519 |
|
|
520 |
0 |
sg.getSequences(null).clear(); |
521 |
0 |
for (int i = min; i < max; i++) |
522 |
|
{ |
523 |
0 |
sg.addSequence(av.getAlignment().getSequenceAt(i), false); |
524 |
|
} |
525 |
|
} |
526 |
|
} |
527 |
|
|
528 |
0 |
if (av.getSelectionGroup() == null) |
529 |
|
{ |
530 |
0 |
SequenceGroup sg = new SequenceGroup(); |
531 |
0 |
sg.setStartRes(seqCanvas.cursorX); |
532 |
0 |
sg.setEndRes(seqCanvas.cursorX); |
533 |
0 |
sg.addSequence(sequence, false); |
534 |
0 |
av.setSelectionGroup(sg); |
535 |
|
} |
536 |
|
|
537 |
0 |
ap.paintAlignment(false, false); |
538 |
0 |
av.sendSelection(); |
539 |
|
} |
540 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
541 |
0 |
void insertGapAtCursor(boolean group)... |
542 |
|
{ |
543 |
0 |
groupEditing = group; |
544 |
0 |
startseq = seqCanvas.cursorY; |
545 |
0 |
lastres = seqCanvas.cursorX; |
546 |
0 |
editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1()); |
547 |
0 |
endEditing(); |
548 |
|
} |
549 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
550 |
0 |
void deleteGapAtCursor(boolean group)... |
551 |
|
{ |
552 |
0 |
groupEditing = group; |
553 |
0 |
startseq = seqCanvas.cursorY; |
554 |
0 |
lastres = seqCanvas.cursorX + getKeyboardNo1(); |
555 |
0 |
editSequence(false, false, seqCanvas.cursorX); |
556 |
0 |
endEditing(); |
557 |
|
} |
558 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
559 |
0 |
void insertNucAtCursor(boolean group, String nuc)... |
560 |
|
{ |
561 |
|
|
562 |
0 |
groupEditing = group; |
563 |
0 |
startseq = seqCanvas.cursorY; |
564 |
0 |
lastres = seqCanvas.cursorX; |
565 |
0 |
editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1()); |
566 |
0 |
endEditing(); |
567 |
|
} |
568 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
569 |
0 |
void numberPressed(char value)... |
570 |
|
{ |
571 |
0 |
if (keyboardNo1 == null) |
572 |
|
{ |
573 |
0 |
keyboardNo1 = new StringBuffer(); |
574 |
|
} |
575 |
|
|
576 |
0 |
if (keyboardNo2 != null) |
577 |
|
{ |
578 |
0 |
keyboardNo2.append(value); |
579 |
|
} |
580 |
|
else |
581 |
|
{ |
582 |
0 |
keyboardNo1.append(value); |
583 |
|
} |
584 |
|
} |
585 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
586 |
0 |
int getKeyboardNo1()... |
587 |
|
{ |
588 |
0 |
try |
589 |
|
{ |
590 |
0 |
if (keyboardNo1 != null) |
591 |
|
{ |
592 |
0 |
int value = Integer.parseInt(keyboardNo1.toString()); |
593 |
0 |
keyboardNo1 = null; |
594 |
0 |
return value; |
595 |
|
} |
596 |
|
} catch (Exception x) |
597 |
|
{ |
598 |
|
} |
599 |
0 |
keyboardNo1 = null; |
600 |
0 |
return 1; |
601 |
|
} |
602 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
603 |
0 |
int getKeyboardNo2()... |
604 |
|
{ |
605 |
0 |
try |
606 |
|
{ |
607 |
0 |
if (keyboardNo2 != null) |
608 |
|
{ |
609 |
0 |
int value = Integer.parseInt(keyboardNo2.toString()); |
610 |
0 |
keyboardNo2 = null; |
611 |
0 |
return value; |
612 |
|
} |
613 |
|
} catch (Exception x) |
614 |
|
{ |
615 |
|
} |
616 |
0 |
keyboardNo2 = null; |
617 |
0 |
return 1; |
618 |
|
} |
619 |
|
|
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
@param |
624 |
|
|
625 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
626 |
0 |
@Override... |
627 |
|
public void mouseReleased(MouseEvent evt) |
628 |
|
{ |
629 |
0 |
boolean didDrag = mouseDragging; |
630 |
0 |
mouseDragging = false; |
631 |
0 |
mouseWheelPressed = false; |
632 |
|
|
633 |
0 |
if (evt.isPopupTrigger()) |
634 |
|
{ |
635 |
0 |
showPopupMenu(evt); |
636 |
0 |
evt.consume(); |
637 |
0 |
return; |
638 |
|
} |
639 |
|
|
640 |
0 |
if (editingSeqs) |
641 |
|
{ |
642 |
0 |
endEditing(); |
643 |
|
} |
644 |
|
else |
645 |
|
{ |
646 |
0 |
doMouseReleasedDefineMode(evt, didDrag); |
647 |
|
} |
648 |
|
} |
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
|
@param |
654 |
|
|
655 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 9 |
Complexity Density: 0.43 |
|
656 |
0 |
@Override... |
657 |
|
public void mousePressed(MouseEvent evt) |
658 |
|
{ |
659 |
0 |
lastMousePress = evt.getPoint(); |
660 |
|
|
661 |
0 |
if (SwingUtilities.isMiddleMouseButton(evt)) |
662 |
|
{ |
663 |
0 |
mouseWheelPressed = true; |
664 |
0 |
return; |
665 |
|
} |
666 |
|
|
667 |
0 |
boolean isControlDown = Platform.isControlDown(evt); |
668 |
0 |
if (evt.isShiftDown() || isControlDown) |
669 |
|
{ |
670 |
0 |
editingSeqs = true; |
671 |
0 |
if (isControlDown) |
672 |
|
{ |
673 |
0 |
groupEditing = true; |
674 |
|
} |
675 |
|
} |
676 |
|
else |
677 |
|
{ |
678 |
0 |
doMousePressedDefineMode(evt); |
679 |
0 |
return; |
680 |
|
} |
681 |
|
|
682 |
0 |
int seq = findSeq(evt); |
683 |
0 |
int res = findColumn(evt); |
684 |
|
|
685 |
0 |
if (seq < 0 || res < 0) |
686 |
|
{ |
687 |
0 |
return; |
688 |
|
} |
689 |
|
|
690 |
0 |
if ((seq < av.getAlignment().getHeight()) |
691 |
|
&& (res < av.getAlignment().getSequenceAt(seq).getLength())) |
692 |
|
{ |
693 |
0 |
startseq = seq; |
694 |
0 |
lastres = res; |
695 |
|
} |
696 |
|
else |
697 |
|
{ |
698 |
0 |
startseq = -1; |
699 |
0 |
lastres = -1; |
700 |
|
} |
701 |
|
|
702 |
0 |
return; |
703 |
|
} |
704 |
|
|
705 |
|
String lastMessage; |
706 |
|
|
707 |
|
private String formattedTooltipText; |
708 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
709 |
0 |
@Override... |
710 |
|
public void mouseOverSequence(SequenceI sequence, int index, int pos) |
711 |
|
{ |
712 |
0 |
String tmp = sequence.hashCode() + " " + index + " " + pos; |
713 |
|
|
714 |
0 |
if (lastMessage == null || !lastMessage.equals(tmp)) |
715 |
|
{ |
716 |
|
|
717 |
0 |
ssm.mouseOverSequence(sequence, index, pos, av); |
718 |
|
} |
719 |
0 |
lastMessage = tmp; |
720 |
|
} |
721 |
|
|
722 |
|
|
723 |
|
|
724 |
|
|
725 |
|
|
726 |
|
|
727 |
|
|
|
|
| 66.7% |
Uncovered Elements: 7 (21) |
Complexity: 6 |
Complexity Density: 0.46 |
|
728 |
3 |
@Override... |
729 |
|
public void highlightSequence(SearchResultsI results) |
730 |
|
{ |
731 |
3 |
if (results == null || results.equals(lastSearchResults)) |
732 |
|
{ |
733 |
0 |
return; |
734 |
|
} |
735 |
3 |
lastSearchResults = results; |
736 |
|
|
737 |
3 |
boolean wasScrolled = false; |
738 |
|
|
739 |
3 |
if (av.isFollowHighlight()) |
740 |
|
{ |
741 |
|
|
742 |
|
|
743 |
|
|
744 |
|
|
745 |
3 |
ap.setToScrollComplementPanel(false); |
746 |
3 |
wasScrolled = ap.scrollToPosition(results, false); |
747 |
3 |
if (wasScrolled) |
748 |
|
{ |
749 |
0 |
seqCanvas.revalidate(); |
750 |
|
} |
751 |
3 |
ap.setToScrollComplementPanel(true); |
752 |
|
} |
753 |
|
|
754 |
3 |
boolean fastPaint = !(wasScrolled && av.getWrapAlignment()); |
755 |
3 |
if (seqCanvas.highlightSearchResults(results, fastPaint)) |
756 |
|
{ |
757 |
0 |
setStatusMessage(results); |
758 |
|
} |
759 |
|
} |
760 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
761 |
0 |
@Override... |
762 |
|
public VamsasSource getVamsasSource() |
763 |
|
{ |
764 |
0 |
return this.ap == null ? null : this.ap.av; |
765 |
|
} |
766 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
767 |
0 |
@Override... |
768 |
|
public void updateColours(SequenceI seq, int index) |
769 |
|
{ |
770 |
0 |
System.out.println("update the seqPanel colours"); |
771 |
|
|
772 |
|
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
777 |
|
|
778 |
|
|
779 |
|
|
780 |
|
@param |
781 |
|
|
|
|
| 0% |
Uncovered Elements: 69 (69) |
Complexity: 22 |
Complexity Density: 0.54 |
|
782 |
0 |
@Override... |
783 |
|
public void mouseMoved(MouseEvent evt) |
784 |
|
{ |
785 |
0 |
if (editingSeqs) |
786 |
|
{ |
787 |
|
|
788 |
|
|
789 |
0 |
mouseDragged(evt); |
790 |
|
} |
791 |
|
|
792 |
0 |
final int column = findColumn(evt); |
793 |
0 |
final int seq = findSeq(evt); |
794 |
|
|
795 |
0 |
if (column < 0 || seq < 0 || seq >= av.getAlignment().getHeight()) |
796 |
|
{ |
797 |
0 |
lastMouseSeq = -1; |
798 |
0 |
return; |
799 |
|
} |
800 |
0 |
if (column == lastMouseColumn && seq == lastMouseSeq) |
801 |
|
{ |
802 |
|
|
803 |
|
|
804 |
|
|
805 |
0 |
return; |
806 |
|
} |
807 |
0 |
lastMouseColumn = column; |
808 |
0 |
lastMouseSeq = seq; |
809 |
|
|
810 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seq); |
811 |
|
|
812 |
0 |
if (column >= sequence.getLength()) |
813 |
|
{ |
814 |
0 |
return; |
815 |
|
} |
816 |
|
|
817 |
|
|
818 |
|
|
819 |
|
|
820 |
0 |
boolean isGapped = Comparison.isGap(sequence.getCharAt(column)); |
821 |
0 |
final int pos = setStatusMessage(sequence, column, seq); |
822 |
0 |
if (ssm != null && !isGapped) |
823 |
|
{ |
824 |
0 |
mouseOverSequence(sequence, column, pos); |
825 |
|
} |
826 |
|
|
827 |
0 |
tooltipText.setLength(6); |
828 |
|
|
829 |
0 |
SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence); |
830 |
0 |
if (groups != null) |
831 |
|
{ |
832 |
0 |
for (int g = 0; g < groups.length; g++) |
833 |
|
{ |
834 |
0 |
if (groups[g].getStartRes() <= column |
835 |
|
&& groups[g].getEndRes() >= column) |
836 |
|
{ |
837 |
0 |
if (!groups[g].getName().startsWith("JTreeGroup") |
838 |
|
&& !groups[g].getName().startsWith("JGroup")) |
839 |
|
{ |
840 |
0 |
tooltipText.append(groups[g].getName()); |
841 |
|
} |
842 |
|
|
843 |
0 |
if (groups[g].getDescription() != null) |
844 |
|
{ |
845 |
0 |
tooltipText.append(": " + groups[g].getDescription()); |
846 |
|
} |
847 |
|
} |
848 |
|
} |
849 |
|
} |
850 |
|
|
851 |
|
|
852 |
|
|
853 |
|
|
854 |
|
|
855 |
|
|
856 |
0 |
if (av.isShowSequenceFeatures()) |
857 |
|
{ |
858 |
0 |
List<SequenceFeature> features = ap.getFeatureRenderer() |
859 |
|
.findFeaturesAtColumn(sequence, column + 1); |
860 |
0 |
seqARep.appendFeatures(tooltipText, pos, features, |
861 |
|
this.ap.getSeqPanel().seqCanvas.fr); |
862 |
|
} |
863 |
0 |
if (tooltipText.length() == 6) |
864 |
|
{ |
865 |
0 |
setToolTipText(null); |
866 |
0 |
lastTooltip = null; |
867 |
|
} |
868 |
|
else |
869 |
|
{ |
870 |
0 |
if (tooltipText.length() > MAX_TOOLTIP_LENGTH) |
871 |
|
{ |
872 |
0 |
tooltipText.setLength(MAX_TOOLTIP_LENGTH); |
873 |
0 |
tooltipText.append("..."); |
874 |
|
} |
875 |
0 |
String textString = tooltipText.toString(); |
876 |
0 |
if (lastTooltip == null || !lastTooltip.equals(textString)) |
877 |
|
{ |
878 |
0 |
formattedTooltipText = JvSwingUtils.wrapTooltip(true, |
879 |
|
textString); |
880 |
0 |
setToolTipText(formattedTooltipText); |
881 |
|
|
882 |
0 |
lastTooltip = textString; |
883 |
|
} |
884 |
|
} |
885 |
|
} |
886 |
|
|
887 |
|
|
888 |
|
private Point lastp = null; |
889 |
|
|
890 |
|
private JToolTip tempTip = new JLabel().createToolTip(); |
891 |
|
|
892 |
|
|
893 |
|
|
894 |
|
|
895 |
|
@see |
896 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.46 |
|
897 |
0 |
@Override... |
898 |
|
public Point getToolTipLocation(MouseEvent event) |
899 |
|
{ |
900 |
|
|
901 |
|
|
902 |
0 |
if (tooltipText == null || tooltipText.length() == 6) |
903 |
0 |
return null; |
904 |
|
|
905 |
0 |
if (lastp != null && event.isShiftDown()) |
906 |
0 |
return lastp; |
907 |
|
|
908 |
0 |
Point p = lastp; |
909 |
0 |
int x = event.getX(); |
910 |
0 |
int y = event.getY(); |
911 |
0 |
int w = getWidth(); |
912 |
|
|
913 |
0 |
tempTip.setTipText(formattedTooltipText); |
914 |
0 |
int tipWidth = (int) tempTip.getPreferredSize().getWidth(); |
915 |
|
|
916 |
|
|
917 |
0 |
x = (x + tipWidth < w ? x + 10 : w - tipWidth); |
918 |
0 |
p = new Point(x, y + 20); |
919 |
|
|
920 |
|
|
921 |
|
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
0 |
return lastp = p; |
926 |
|
} |
927 |
|
|
928 |
|
String lastTooltip; |
929 |
|
|
930 |
|
|
931 |
|
|
932 |
|
|
933 |
|
|
934 |
|
|
935 |
|
|
936 |
|
|
937 |
|
private boolean updateOverviewAndStructs = false; |
938 |
|
|
939 |
|
|
940 |
|
|
941 |
|
|
942 |
|
|
943 |
|
|
944 |
|
|
945 |
|
|
946 |
|
|
947 |
|
|
948 |
|
|
949 |
|
|
950 |
|
|
951 |
|
|
952 |
|
|
953 |
|
@param |
954 |
|
|
955 |
|
@param |
956 |
|
|
957 |
|
@param |
958 |
|
|
959 |
|
@return |
960 |
|
|
961 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
962 |
5 |
int setStatusMessage(SequenceI sequence, final int column, int seqIndex)... |
963 |
|
{ |
964 |
5 |
char sequenceChar = sequence.getCharAt(column); |
965 |
5 |
int pos = sequence.findPosition(column); |
966 |
5 |
setStatusMessage(sequence, seqIndex, sequenceChar, pos); |
967 |
|
|
968 |
5 |
return pos; |
969 |
|
} |
970 |
|
|
971 |
|
|
972 |
|
|
973 |
|
|
974 |
|
|
975 |
|
|
976 |
|
|
977 |
|
|
978 |
|
|
979 |
|
|
980 |
|
|
981 |
|
|
982 |
|
@param |
983 |
|
@param |
984 |
|
|
985 |
|
@param |
986 |
|
|
987 |
|
@param |
988 |
|
|
989 |
|
|
|
|
| 78.6% |
Uncovered Elements: 6 (28) |
Complexity: 8 |
Complexity Density: 0.57 |
|
990 |
5 |
protected void setStatusMessage(SequenceI sequence, int seqIndex,... |
991 |
|
char sequenceChar, int residuePos) |
992 |
|
{ |
993 |
5 |
StringBuilder text = new StringBuilder(32); |
994 |
|
|
995 |
|
|
996 |
|
|
997 |
|
|
998 |
5 |
String seqno = seqIndex == -1 ? "" : " " + (seqIndex + 1); |
999 |
5 |
text.append("Sequence").append(seqno).append(" ID: ") |
1000 |
|
.append(sequence.getName()); |
1001 |
|
|
1002 |
5 |
String residue = null; |
1003 |
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
5 |
boolean isGapped = Comparison.isGap(sequenceChar); |
1008 |
|
|
1009 |
5 |
if (!isGapped) |
1010 |
|
{ |
1011 |
3 |
boolean nucleotide = av.getAlignment().isNucleotide(); |
1012 |
3 |
String displayChar = String.valueOf(sequenceChar); |
1013 |
3 |
if (nucleotide) |
1014 |
|
{ |
1015 |
0 |
residue = ResidueProperties.nucleotideName.get(displayChar); |
1016 |
|
} |
1017 |
|
else |
1018 |
|
{ |
1019 |
3 |
residue = "X".equalsIgnoreCase(displayChar) ? "X" |
1020 |
3 |
: ("*".equals(displayChar) ? "STOP" |
1021 |
|
: ResidueProperties.aa2Triplet.get(displayChar)); |
1022 |
|
} |
1023 |
3 |
text.append(" ").append(nucleotide ? "Nucleotide" : "Residue") |
1024 |
3 |
.append(": ").append(residue == null ? displayChar : residue); |
1025 |
|
|
1026 |
3 |
text.append(" (").append(Integer.toString(residuePos)).append(")"); |
1027 |
|
} |
1028 |
5 |
ap.alignFrame.setStatus(text.toString()); |
1029 |
|
} |
1030 |
|
|
1031 |
|
|
1032 |
|
|
1033 |
|
|
1034 |
|
|
1035 |
|
@param |
1036 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
1037 |
0 |
private void setStatusMessage(SearchResultsI results)... |
1038 |
|
{ |
1039 |
0 |
AlignmentI al = this.av.getAlignment(); |
1040 |
0 |
int sequenceIndex = al.findIndex(results); |
1041 |
0 |
if (sequenceIndex == -1) |
1042 |
|
{ |
1043 |
0 |
return; |
1044 |
|
} |
1045 |
0 |
SequenceI ds = al.getSequenceAt(sequenceIndex).getDatasetSequence(); |
1046 |
0 |
for (SearchResultMatchI m : results.getResults()) |
1047 |
|
{ |
1048 |
0 |
SequenceI seq = m.getSequence(); |
1049 |
0 |
if (seq.getDatasetSequence() != null) |
1050 |
|
{ |
1051 |
0 |
seq = seq.getDatasetSequence(); |
1052 |
|
} |
1053 |
|
|
1054 |
0 |
if (seq == ds) |
1055 |
|
{ |
1056 |
0 |
int start = m.getStart(); |
1057 |
0 |
setStatusMessage(seq, sequenceIndex, seq.getCharAt(start - 1), |
1058 |
|
start); |
1059 |
0 |
return; |
1060 |
|
} |
1061 |
|
} |
1062 |
|
} |
1063 |
|
|
1064 |
|
|
1065 |
|
@inheritDoc |
1066 |
|
|
|
|
| 0% |
Uncovered Elements: 89 (89) |
Complexity: 20 |
Complexity Density: 0.35 |
|
1067 |
0 |
@Override... |
1068 |
|
public void mouseDragged(MouseEvent evt) |
1069 |
|
{ |
1070 |
0 |
if (mouseWheelPressed) |
1071 |
|
{ |
1072 |
0 |
boolean inSplitFrame = ap.av.getCodingComplement() != null; |
1073 |
0 |
boolean copyChanges = inSplitFrame && av.isProteinFontAsCdna(); |
1074 |
|
|
1075 |
0 |
int oldWidth = av.getCharWidth(); |
1076 |
|
|
1077 |
|
|
1078 |
0 |
if (Math.abs(evt.getY() - lastMousePress.getY()) > Math |
1079 |
|
.abs(evt.getX() - lastMousePress.getX())) |
1080 |
|
{ |
1081 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
0 |
int fontSize = av.font.getSize(); |
1085 |
0 |
boolean fontChanged = false; |
1086 |
|
|
1087 |
0 |
if (evt.getY() < lastMousePress.getY()) |
1088 |
|
{ |
1089 |
0 |
fontChanged = true; |
1090 |
0 |
fontSize--; |
1091 |
|
} |
1092 |
0 |
else if (evt.getY() > lastMousePress.getY()) |
1093 |
|
{ |
1094 |
0 |
fontChanged = true; |
1095 |
0 |
fontSize++; |
1096 |
|
} |
1097 |
|
|
1098 |
0 |
if (fontSize < 1) |
1099 |
|
{ |
1100 |
0 |
fontSize = 1; |
1101 |
|
} |
1102 |
|
|
1103 |
0 |
if (fontChanged) |
1104 |
|
{ |
1105 |
0 |
Font newFont = new Font(av.font.getName(), av.font.getStyle(), |
1106 |
|
fontSize); |
1107 |
0 |
av.setFont(newFont, true); |
1108 |
0 |
av.setCharWidth(oldWidth); |
1109 |
0 |
ap.fontChanged(); |
1110 |
0 |
if (copyChanges) |
1111 |
|
{ |
1112 |
0 |
ap.av.getCodingComplement().setFont(newFont, true); |
1113 |
0 |
SplitFrame splitFrame = (SplitFrame) ap.alignFrame |
1114 |
|
.getSplitViewContainer(); |
1115 |
0 |
splitFrame.adjustLayout(); |
1116 |
0 |
splitFrame.repaint(); |
1117 |
|
} |
1118 |
|
} |
1119 |
|
} |
1120 |
|
else |
1121 |
|
{ |
1122 |
|
|
1123 |
|
|
1124 |
|
|
1125 |
0 |
int newWidth = 0; |
1126 |
0 |
if (evt.getX() < lastMousePress.getX() && av.getCharWidth() > 1) |
1127 |
|
{ |
1128 |
0 |
newWidth = av.getCharWidth() - 1; |
1129 |
0 |
av.setCharWidth(newWidth); |
1130 |
|
} |
1131 |
0 |
else if (evt.getX() > lastMousePress.getX()) |
1132 |
|
{ |
1133 |
0 |
newWidth = av.getCharWidth() + 1; |
1134 |
0 |
av.setCharWidth(newWidth); |
1135 |
|
} |
1136 |
0 |
if (newWidth > 0) |
1137 |
|
{ |
1138 |
0 |
ap.paintAlignment(false, false); |
1139 |
0 |
if (copyChanges) |
1140 |
|
{ |
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
|
|
1145 |
|
|
1146 |
0 |
av.getCodingComplement().setCharWidth(newWidth); |
1147 |
0 |
SplitFrame splitFrame = (SplitFrame) ap.alignFrame |
1148 |
|
.getSplitViewContainer(); |
1149 |
0 |
splitFrame.adjustLayout(); |
1150 |
0 |
splitFrame.repaint(); |
1151 |
|
} |
1152 |
|
} |
1153 |
|
} |
1154 |
|
|
1155 |
0 |
FontMetrics fm = getFontMetrics(av.getFont()); |
1156 |
0 |
av.validCharWidth = fm.charWidth('M') <= av.getCharWidth(); |
1157 |
|
|
1158 |
0 |
lastMousePress = evt.getPoint(); |
1159 |
|
|
1160 |
0 |
return; |
1161 |
|
} |
1162 |
|
|
1163 |
0 |
if (!editingSeqs) |
1164 |
|
{ |
1165 |
0 |
doMouseDraggedDefineMode(evt); |
1166 |
0 |
return; |
1167 |
|
} |
1168 |
|
|
1169 |
0 |
int res = findColumn(evt); |
1170 |
|
|
1171 |
0 |
if (res < 0) |
1172 |
|
{ |
1173 |
0 |
res = 0; |
1174 |
|
} |
1175 |
|
|
1176 |
0 |
if ((lastres == -1) || (lastres == res)) |
1177 |
|
{ |
1178 |
0 |
return; |
1179 |
|
} |
1180 |
|
|
1181 |
0 |
if ((res < av.getAlignment().getWidth()) && (res < lastres)) |
1182 |
|
{ |
1183 |
|
|
1184 |
0 |
editSequence(false, false, res); |
1185 |
|
} |
1186 |
|
else |
1187 |
|
{ |
1188 |
0 |
editSequence(true, false, res); |
1189 |
|
} |
1190 |
|
|
1191 |
0 |
mouseDragging = true; |
1192 |
0 |
if (scrollThread != null) |
1193 |
|
{ |
1194 |
0 |
scrollThread.setMousePosition(evt.getPoint()); |
1195 |
|
} |
1196 |
|
} |
1197 |
|
|
1198 |
|
|
|
|
| 0% |
Uncovered Elements: 236 (236) |
Complexity: 79 |
Complexity Density: 0.61 |
|
1199 |
0 |
synchronized void editSequence(boolean insertGap, boolean editSeq,... |
1200 |
|
int startres) |
1201 |
|
{ |
1202 |
0 |
int fixedLeft = -1; |
1203 |
0 |
int fixedRight = -1; |
1204 |
0 |
boolean fixedColumns = false; |
1205 |
0 |
SequenceGroup sg = av.getSelectionGroup(); |
1206 |
|
|
1207 |
0 |
SequenceI seq = av.getAlignment().getSequenceAt(startseq); |
1208 |
|
|
1209 |
|
|
1210 |
0 |
if (!groupEditing && av.hasHiddenRows()) |
1211 |
|
{ |
1212 |
0 |
if (av.isHiddenRepSequence(seq)) |
1213 |
|
{ |
1214 |
0 |
sg = av.getRepresentedSequences(seq); |
1215 |
0 |
groupEditing = true; |
1216 |
|
} |
1217 |
|
} |
1218 |
|
|
1219 |
0 |
StringBuilder message = new StringBuilder(64); |
1220 |
0 |
if (groupEditing) |
1221 |
|
{ |
1222 |
0 |
message.append("Edit group:"); |
1223 |
0 |
if (editCommand == null) |
1224 |
|
{ |
1225 |
0 |
editCommand = new EditCommand( |
1226 |
|
MessageManager.getString("action.edit_group")); |
1227 |
|
} |
1228 |
|
} |
1229 |
|
else |
1230 |
|
{ |
1231 |
0 |
message.append("Edit sequence: " + seq.getName()); |
1232 |
0 |
String label = seq.getName(); |
1233 |
0 |
if (label.length() > 10) |
1234 |
|
{ |
1235 |
0 |
label = label.substring(0, 10); |
1236 |
|
} |
1237 |
0 |
if (editCommand == null) |
1238 |
|
{ |
1239 |
0 |
editCommand = new EditCommand(MessageManager |
1240 |
|
.formatMessage("label.edit_params", new String[] |
1241 |
|
{ label })); |
1242 |
|
} |
1243 |
|
} |
1244 |
|
|
1245 |
0 |
if (insertGap) |
1246 |
|
{ |
1247 |
0 |
message.append(" insert "); |
1248 |
|
} |
1249 |
|
else |
1250 |
|
{ |
1251 |
0 |
message.append(" delete "); |
1252 |
|
} |
1253 |
|
|
1254 |
0 |
message.append(Math.abs(startres - lastres) + " gaps."); |
1255 |
0 |
ap.alignFrame.setStatus(message.toString()); |
1256 |
|
|
1257 |
|
|
1258 |
0 |
if (groupEditing || (sg != null |
1259 |
|
&& sg.getSequences(av.getHiddenRepSequences()).contains(seq))) |
1260 |
|
{ |
1261 |
0 |
fixedColumns = true; |
1262 |
|
|
1263 |
|
|
1264 |
|
|
1265 |
0 |
if (sg == null) |
1266 |
|
{ |
1267 |
0 |
if (!av.isHiddenRepSequence(seq)) |
1268 |
|
{ |
1269 |
0 |
endEditing(); |
1270 |
0 |
return; |
1271 |
|
} |
1272 |
0 |
sg = av.getRepresentedSequences(seq); |
1273 |
|
} |
1274 |
|
|
1275 |
0 |
fixedLeft = sg.getStartRes(); |
1276 |
0 |
fixedRight = sg.getEndRes(); |
1277 |
|
|
1278 |
0 |
if ((startres < fixedLeft && lastres >= fixedLeft) |
1279 |
|
|| (startres >= fixedLeft && lastres < fixedLeft) |
1280 |
|
|| (startres > fixedRight && lastres <= fixedRight) |
1281 |
|
|| (startres <= fixedRight && lastres > fixedRight)) |
1282 |
|
{ |
1283 |
0 |
endEditing(); |
1284 |
0 |
return; |
1285 |
|
} |
1286 |
|
|
1287 |
0 |
if (fixedLeft > startres) |
1288 |
|
{ |
1289 |
0 |
fixedRight = fixedLeft - 1; |
1290 |
0 |
fixedLeft = 0; |
1291 |
|
} |
1292 |
0 |
else if (fixedRight < startres) |
1293 |
|
{ |
1294 |
0 |
fixedLeft = fixedRight; |
1295 |
0 |
fixedRight = -1; |
1296 |
|
} |
1297 |
|
} |
1298 |
|
|
1299 |
0 |
if (av.hasHiddenColumns()) |
1300 |
|
{ |
1301 |
0 |
fixedColumns = true; |
1302 |
0 |
int y1 = av.getAlignment().getHiddenColumns() |
1303 |
|
.getNextHiddenBoundary(true, startres); |
1304 |
0 |
int y2 = av.getAlignment().getHiddenColumns() |
1305 |
|
.getNextHiddenBoundary(false, startres); |
1306 |
|
|
1307 |
0 |
if ((insertGap && startres > y1 && lastres < y1) |
1308 |
|
|| (!insertGap && startres < y2 && lastres > y2)) |
1309 |
|
{ |
1310 |
0 |
endEditing(); |
1311 |
0 |
return; |
1312 |
|
} |
1313 |
|
|
1314 |
|
|
1315 |
|
|
1316 |
0 |
if (fixedLeft < y1 && (fixedRight > y2 || fixedRight == -1)) |
1317 |
|
{ |
1318 |
0 |
if (startres >= y2) |
1319 |
|
{ |
1320 |
0 |
fixedLeft = y2; |
1321 |
|
} |
1322 |
|
else |
1323 |
|
{ |
1324 |
0 |
fixedRight = y2 - 1; |
1325 |
|
} |
1326 |
|
} |
1327 |
|
} |
1328 |
|
|
1329 |
0 |
if (groupEditing) |
1330 |
|
{ |
1331 |
0 |
List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences()); |
1332 |
0 |
int g, groupSize = vseqs.size(); |
1333 |
0 |
SequenceI[] groupSeqs = new SequenceI[groupSize]; |
1334 |
0 |
for (g = 0; g < groupSeqs.length; g++) |
1335 |
|
{ |
1336 |
0 |
groupSeqs[g] = vseqs.get(g); |
1337 |
|
} |
1338 |
|
|
1339 |
|
|
1340 |
0 |
if (insertGap) |
1341 |
|
{ |
1342 |
|
|
1343 |
|
|
1344 |
0 |
if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight |
1345 |
|
&& sg.getEndRes() == av.getAlignment().getWidth() - 1) |
1346 |
|
{ |
1347 |
0 |
sg.setEndRes(av.getAlignment().getWidth() + startres - lastres); |
1348 |
0 |
fixedRight = sg.getEndRes(); |
1349 |
|
} |
1350 |
|
|
1351 |
|
|
1352 |
|
|
1353 |
|
|
1354 |
0 |
boolean blank = false; |
1355 |
0 |
for (; fixedRight > lastres; fixedRight--) |
1356 |
|
{ |
1357 |
0 |
blank = true; |
1358 |
|
|
1359 |
0 |
for (g = 0; g < groupSize; g++) |
1360 |
|
{ |
1361 |
0 |
for (int j = 0; j < startres - lastres; j++) |
1362 |
|
{ |
1363 |
0 |
if (!Comparison.isGap(groupSeqs[g].getCharAt(fixedRight - j))) |
1364 |
|
{ |
1365 |
0 |
blank = false; |
1366 |
0 |
break; |
1367 |
|
} |
1368 |
|
} |
1369 |
|
} |
1370 |
0 |
if (blank) |
1371 |
|
{ |
1372 |
0 |
break; |
1373 |
|
} |
1374 |
|
} |
1375 |
|
|
1376 |
0 |
if (!blank) |
1377 |
|
{ |
1378 |
0 |
if (sg.getSize() == av.getAlignment().getHeight()) |
1379 |
|
{ |
1380 |
0 |
if ((av.hasHiddenColumns() && startres < av.getAlignment() |
1381 |
|
.getHiddenColumns() |
1382 |
|
.getNextHiddenBoundary(false, startres))) |
1383 |
|
{ |
1384 |
0 |
endEditing(); |
1385 |
0 |
return; |
1386 |
|
} |
1387 |
|
|
1388 |
0 |
int alWidth = av.getAlignment().getWidth(); |
1389 |
0 |
if (av.hasHiddenRows()) |
1390 |
|
{ |
1391 |
0 |
int hwidth = av.getAlignment().getHiddenSequences() |
1392 |
|
.getWidth(); |
1393 |
0 |
if (hwidth > alWidth) |
1394 |
|
{ |
1395 |
0 |
alWidth = hwidth; |
1396 |
|
} |
1397 |
|
} |
1398 |
|
|
1399 |
|
|
1400 |
0 |
sg.setEndRes(sg.getEndRes() + startres - lastres); |
1401 |
0 |
fixedRight = alWidth + startres - lastres; |
1402 |
|
} |
1403 |
|
else |
1404 |
|
{ |
1405 |
0 |
endEditing(); |
1406 |
0 |
return; |
1407 |
|
} |
1408 |
|
} |
1409 |
|
} |
1410 |
|
|
1411 |
|
|
1412 |
0 |
else if (!insertGap) |
1413 |
|
{ |
1414 |
|
|
1415 |
|
|
1416 |
|
|
1417 |
0 |
for (g = 0; g < groupSize; g++) |
1418 |
|
{ |
1419 |
0 |
for (int j = startres; j < lastres; j++) |
1420 |
|
{ |
1421 |
0 |
if (groupSeqs[g].getLength() <= j) |
1422 |
|
{ |
1423 |
0 |
continue; |
1424 |
|
} |
1425 |
|
|
1426 |
0 |
if (!Comparison.isGap(groupSeqs[g].getCharAt(j))) |
1427 |
|
{ |
1428 |
|
|
1429 |
0 |
endEditing(); |
1430 |
0 |
return; |
1431 |
|
} |
1432 |
|
} |
1433 |
|
} |
1434 |
|
} |
1435 |
|
|
1436 |
0 |
if (insertGap) |
1437 |
|
{ |
1438 |
|
|
1439 |
0 |
if (fixedColumns && fixedRight != -1) |
1440 |
|
{ |
1441 |
0 |
for (int j = lastres; j < startres; j++) |
1442 |
|
{ |
1443 |
0 |
insertChar(j, groupSeqs, fixedRight); |
1444 |
|
} |
1445 |
|
} |
1446 |
|
else |
1447 |
|
{ |
1448 |
0 |
appendEdit(Action.INSERT_GAP, groupSeqs, startres, |
1449 |
|
startres - lastres); |
1450 |
|
} |
1451 |
|
} |
1452 |
|
else |
1453 |
|
{ |
1454 |
|
|
1455 |
0 |
if (fixedColumns && fixedRight != -1) |
1456 |
|
{ |
1457 |
0 |
for (int j = lastres; j > startres; j--) |
1458 |
|
{ |
1459 |
0 |
deleteChar(startres, groupSeqs, fixedRight); |
1460 |
|
} |
1461 |
|
} |
1462 |
|
else |
1463 |
|
{ |
1464 |
0 |
appendEdit(Action.DELETE_GAP, groupSeqs, startres, |
1465 |
|
lastres - startres); |
1466 |
|
} |
1467 |
|
|
1468 |
|
} |
1469 |
|
} |
1470 |
|
else |
1471 |
|
|
1472 |
|
{ |
1473 |
0 |
if (insertGap) |
1474 |
|
{ |
1475 |
|
|
1476 |
0 |
if (fixedColumns && fixedRight != -1) |
1477 |
|
{ |
1478 |
0 |
for (int j = lastres; j < startres; j++) |
1479 |
|
{ |
1480 |
0 |
insertChar(j, new SequenceI[] { seq }, fixedRight); |
1481 |
|
} |
1482 |
|
} |
1483 |
|
else |
1484 |
|
{ |
1485 |
0 |
appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, lastres, |
1486 |
|
startres - lastres); |
1487 |
|
} |
1488 |
|
} |
1489 |
|
else |
1490 |
|
{ |
1491 |
0 |
if (!editSeq) |
1492 |
|
{ |
1493 |
|
|
1494 |
0 |
if (fixedColumns && fixedRight != -1) |
1495 |
|
{ |
1496 |
0 |
for (int j = lastres; j > startres; j--) |
1497 |
|
{ |
1498 |
0 |
if (!Comparison.isGap(seq.getCharAt(startres))) |
1499 |
|
{ |
1500 |
0 |
endEditing(); |
1501 |
0 |
break; |
1502 |
|
} |
1503 |
0 |
deleteChar(startres, new SequenceI[] { seq }, fixedRight); |
1504 |
|
} |
1505 |
|
} |
1506 |
|
else |
1507 |
|
{ |
1508 |
|
|
1509 |
0 |
int max = 0; |
1510 |
0 |
for (int m = startres; m < lastres; m++) |
1511 |
|
{ |
1512 |
0 |
if (!Comparison.isGap(seq.getCharAt(m))) |
1513 |
|
{ |
1514 |
0 |
break; |
1515 |
|
} |
1516 |
0 |
max++; |
1517 |
|
} |
1518 |
|
|
1519 |
0 |
if (max > 0) |
1520 |
|
{ |
1521 |
0 |
appendEdit(Action.DELETE_GAP, new SequenceI[] { seq }, |
1522 |
|
startres, max); |
1523 |
|
} |
1524 |
|
} |
1525 |
|
} |
1526 |
|
else |
1527 |
|
{ |
1528 |
0 |
if (fixedColumns && fixedRight != -1) |
1529 |
|
{ |
1530 |
0 |
for (int j = lastres; j < startres; j++) |
1531 |
|
{ |
1532 |
0 |
insertChar(j, new SequenceI[] { seq }, fixedRight); |
1533 |
|
} |
1534 |
|
} |
1535 |
|
else |
1536 |
|
{ |
1537 |
0 |
appendEdit(Action.INSERT_NUC, new SequenceI[] { seq }, lastres, |
1538 |
|
startres - lastres); |
1539 |
|
} |
1540 |
|
} |
1541 |
|
} |
1542 |
|
} |
1543 |
|
|
1544 |
0 |
lastres = startres; |
1545 |
0 |
seqCanvas.repaint(); |
1546 |
|
} |
1547 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.45 |
|
1548 |
0 |
void insertChar(int j, SequenceI[] seq, int fixedColumn)... |
1549 |
|
{ |
1550 |
0 |
int blankColumn = fixedColumn; |
1551 |
0 |
for (int s = 0; s < seq.length; s++) |
1552 |
|
{ |
1553 |
|
|
1554 |
|
|
1555 |
|
|
1556 |
0 |
for (blankColumn = fixedColumn; blankColumn > j; blankColumn--) |
1557 |
|
{ |
1558 |
0 |
if (Comparison.isGap(seq[s].getCharAt(blankColumn))) |
1559 |
|
{ |
1560 |
|
|
1561 |
0 |
break; |
1562 |
|
} |
1563 |
|
} |
1564 |
|
|
1565 |
0 |
if (blankColumn <= j) |
1566 |
|
{ |
1567 |
0 |
blankColumn = fixedColumn; |
1568 |
0 |
endEditing(); |
1569 |
0 |
return; |
1570 |
|
} |
1571 |
|
} |
1572 |
|
|
1573 |
0 |
appendEdit(Action.DELETE_GAP, seq, blankColumn, 1); |
1574 |
|
|
1575 |
0 |
appendEdit(Action.INSERT_GAP, seq, j, 1); |
1576 |
|
|
1577 |
|
} |
1578 |
|
|
1579 |
|
|
1580 |
|
|
1581 |
|
|
1582 |
|
@param |
1583 |
|
@param |
1584 |
|
@param |
1585 |
|
@param |
1586 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1587 |
0 |
protected void appendEdit(Action action, SequenceI[] seq, int pos,... |
1588 |
|
int count) |
1589 |
|
{ |
1590 |
|
|
1591 |
0 |
final Edit edit = new EditCommand().new Edit(action, seq, pos, count, |
1592 |
|
av.getAlignment().getGapCharacter()); |
1593 |
|
|
1594 |
0 |
editCommand.appendEdit(edit, av.getAlignment(), true, null); |
1595 |
|
} |
1596 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1597 |
0 |
void deleteChar(int j, SequenceI[] seq, int fixedColumn)... |
1598 |
|
{ |
1599 |
|
|
1600 |
0 |
appendEdit(Action.DELETE_GAP, seq, j, 1); |
1601 |
|
|
1602 |
0 |
appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1); |
1603 |
|
} |
1604 |
|
|
1605 |
|
|
1606 |
|
|
1607 |
|
|
1608 |
|
|
1609 |
|
@param |
1610 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1611 |
0 |
@Override... |
1612 |
|
public void mouseEntered(MouseEvent e) |
1613 |
|
{ |
1614 |
0 |
if (oldSeq < 0) |
1615 |
|
{ |
1616 |
0 |
oldSeq = 0; |
1617 |
|
} |
1618 |
0 |
stopScrolling(); |
1619 |
|
} |
1620 |
|
|
1621 |
|
|
1622 |
|
|
1623 |
|
|
1624 |
|
|
1625 |
|
@param |
1626 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1627 |
0 |
@Override... |
1628 |
|
public void mouseExited(MouseEvent e) |
1629 |
|
{ |
1630 |
0 |
if (mouseDragging) |
1631 |
|
{ |
1632 |
0 |
startScrolling(e.getPoint()); |
1633 |
|
} |
1634 |
|
} |
1635 |
|
|
1636 |
|
|
1637 |
|
|
1638 |
|
|
1639 |
|
|
1640 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.46 |
|
1641 |
0 |
@Override... |
1642 |
|
public void mouseClicked(MouseEvent evt) |
1643 |
|
{ |
1644 |
0 |
SequenceGroup sg = null; |
1645 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt)); |
1646 |
0 |
if (evt.getClickCount() > 1) |
1647 |
|
{ |
1648 |
0 |
sg = av.getSelectionGroup(); |
1649 |
0 |
if (sg != null && sg.getSize() == 1 |
1650 |
|
&& sg.getEndRes() - sg.getStartRes() < 2) |
1651 |
|
{ |
1652 |
0 |
av.setSelectionGroup(null); |
1653 |
|
} |
1654 |
|
|
1655 |
0 |
int column = findColumn(evt); |
1656 |
|
|
1657 |
|
|
1658 |
|
|
1659 |
|
|
1660 |
|
|
1661 |
0 |
List<SequenceFeature> features = seqCanvas.getFeatureRenderer() |
1662 |
|
.findFeaturesAtColumn(sequence, column + 1); |
1663 |
|
|
1664 |
0 |
if (!features.isEmpty()) |
1665 |
|
{ |
1666 |
|
|
1667 |
|
|
1668 |
|
|
1669 |
0 |
SearchResultsI highlight = new SearchResults(); |
1670 |
0 |
highlight.addResult(sequence, features.get(0).getBegin(), features |
1671 |
|
.get(0).getEnd()); |
1672 |
0 |
seqCanvas.highlightSearchResults(highlight, true); |
1673 |
|
|
1674 |
|
|
1675 |
|
|
1676 |
|
|
1677 |
0 |
new FeatureEditor(ap, Collections.singletonList(sequence), features, |
1678 |
|
false).showDialog(); |
1679 |
|
} |
1680 |
|
} |
1681 |
|
} |
1682 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
1683 |
0 |
@Override... |
1684 |
|
public void mouseWheelMoved(MouseWheelEvent e) |
1685 |
|
{ |
1686 |
0 |
e.consume(); |
1687 |
0 |
double wheelRotation = e.getPreciseWheelRotation(); |
1688 |
0 |
if (wheelRotation > 0) |
1689 |
|
{ |
1690 |
0 |
if (e.isShiftDown()) |
1691 |
|
{ |
1692 |
0 |
av.getRanges().scrollRight(true); |
1693 |
|
|
1694 |
|
} |
1695 |
|
else |
1696 |
|
{ |
1697 |
0 |
av.getRanges().scrollUp(false); |
1698 |
|
} |
1699 |
|
} |
1700 |
0 |
else if (wheelRotation < 0) |
1701 |
|
{ |
1702 |
0 |
if (e.isShiftDown()) |
1703 |
|
{ |
1704 |
0 |
av.getRanges().scrollRight(false); |
1705 |
|
} |
1706 |
|
else |
1707 |
|
{ |
1708 |
0 |
av.getRanges().scrollUp(true); |
1709 |
|
} |
1710 |
|
} |
1711 |
|
|
1712 |
|
|
1713 |
|
|
1714 |
|
|
1715 |
|
|
1716 |
0 |
mouseMoved(e); |
1717 |
0 |
ToolTipManager.sharedInstance().mouseMoved(e); |
1718 |
|
} |
1719 |
|
|
1720 |
|
|
1721 |
|
|
1722 |
|
|
1723 |
|
@param |
1724 |
|
|
1725 |
|
|
|
|
| 0% |
Uncovered Elements: 53 (53) |
Complexity: 16 |
Complexity Density: 0.48 |
|
1726 |
0 |
public void doMousePressedDefineMode(MouseEvent evt)... |
1727 |
|
{ |
1728 |
0 |
final int res = findColumn(evt); |
1729 |
0 |
final int seq = findSeq(evt); |
1730 |
0 |
oldSeq = seq; |
1731 |
0 |
updateOverviewAndStructs = false; |
1732 |
|
|
1733 |
0 |
startWrapBlock = wrappedBlock; |
1734 |
|
|
1735 |
0 |
if (av.getWrapAlignment() && seq > av.getAlignment().getHeight()) |
1736 |
|
{ |
1737 |
0 |
JvOptionPane.showInternalMessageDialog(Desktop.desktop, |
1738 |
|
MessageManager.getString( |
1739 |
|
"label.cannot_edit_annotations_in_wrapped_view"), |
1740 |
|
MessageManager.getString("label.wrapped_view_no_edit"), |
1741 |
|
JvOptionPane.WARNING_MESSAGE); |
1742 |
0 |
return; |
1743 |
|
} |
1744 |
|
|
1745 |
0 |
if (seq < 0 || res < 0) |
1746 |
|
{ |
1747 |
0 |
return; |
1748 |
|
} |
1749 |
|
|
1750 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seq); |
1751 |
|
|
1752 |
0 |
if ((sequence == null) || (res > sequence.getLength())) |
1753 |
|
{ |
1754 |
0 |
return; |
1755 |
|
} |
1756 |
|
|
1757 |
0 |
stretchGroup = av.getSelectionGroup(); |
1758 |
|
|
1759 |
0 |
if (stretchGroup == null || !stretchGroup.contains(sequence, res)) |
1760 |
|
{ |
1761 |
0 |
stretchGroup = av.getAlignment().findGroup(sequence, res); |
1762 |
0 |
if (stretchGroup != null) |
1763 |
|
{ |
1764 |
|
|
1765 |
|
|
1766 |
0 |
av.setSelectionGroup(stretchGroup); |
1767 |
|
} |
1768 |
|
} |
1769 |
|
|
1770 |
0 |
if (evt.isPopupTrigger()) |
1771 |
|
{ |
1772 |
0 |
showPopupMenu(evt); |
1773 |
0 |
return; |
1774 |
|
} |
1775 |
|
|
1776 |
|
|
1777 |
|
|
1778 |
|
|
1779 |
|
|
1780 |
|
|
1781 |
0 |
if (SwingUtilities.isRightMouseButton(evt) && !Platform.isAMac()) |
1782 |
|
{ |
1783 |
0 |
return; |
1784 |
|
} |
1785 |
|
|
1786 |
0 |
if (av.cursorMode) |
1787 |
|
{ |
1788 |
0 |
seqCanvas.cursorX = findColumn(evt); |
1789 |
0 |
seqCanvas.cursorY = findSeq(evt); |
1790 |
0 |
seqCanvas.repaint(); |
1791 |
0 |
return; |
1792 |
|
} |
1793 |
|
|
1794 |
0 |
if (stretchGroup == null) |
1795 |
|
{ |
1796 |
0 |
createStretchGroup(res, sequence); |
1797 |
|
} |
1798 |
|
|
1799 |
0 |
if (stretchGroup != null) |
1800 |
|
{ |
1801 |
0 |
stretchGroup.addPropertyChangeListener(seqCanvas); |
1802 |
|
} |
1803 |
|
|
1804 |
0 |
seqCanvas.repaint(); |
1805 |
|
} |
1806 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.47 |
|
1807 |
0 |
private void createStretchGroup(int res, SequenceI sequence)... |
1808 |
|
{ |
1809 |
|
|
1810 |
|
|
1811 |
0 |
SequenceGroup sg = new SequenceGroup(); |
1812 |
0 |
sg.setStartRes(res); |
1813 |
0 |
sg.setEndRes(res); |
1814 |
0 |
sg.addSequence(sequence, false); |
1815 |
0 |
av.setSelectionGroup(sg); |
1816 |
0 |
stretchGroup = sg; |
1817 |
|
|
1818 |
0 |
if (av.getConservationSelected()) |
1819 |
|
{ |
1820 |
0 |
SliderPanel.setConservationSlider(ap, av.getResidueShading(), |
1821 |
|
ap.getViewName()); |
1822 |
|
} |
1823 |
|
|
1824 |
0 |
if (av.getAbovePIDThreshold()) |
1825 |
|
{ |
1826 |
0 |
SliderPanel.setPIDSliderSource(ap, av.getResidueShading(), |
1827 |
|
ap.getViewName()); |
1828 |
|
} |
1829 |
|
|
1830 |
|
|
1831 |
0 |
if ((stretchGroup != null) && (stretchGroup.getEndRes() == res)) |
1832 |
|
{ |
1833 |
|
|
1834 |
0 |
changeEndRes = true; |
1835 |
|
} |
1836 |
0 |
else if ((stretchGroup != null) && (stretchGroup.getStartRes() == res)) |
1837 |
|
{ |
1838 |
|
|
1839 |
0 |
changeStartRes = true; |
1840 |
|
} |
1841 |
0 |
stretchGroup.getWidth(); |
1842 |
|
|
1843 |
|
} |
1844 |
|
|
1845 |
|
|
1846 |
|
|
1847 |
|
|
1848 |
|
@param |
1849 |
|
@param |
1850 |
|
@param |
1851 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1852 |
0 |
void showPopupMenu(MouseEvent evt)... |
1853 |
|
{ |
1854 |
0 |
final int column = findColumn(evt); |
1855 |
0 |
final int seq = findSeq(evt); |
1856 |
0 |
SequenceI sequence = av.getAlignment().getSequenceAt(seq); |
1857 |
0 |
List<SequenceFeature> features = ap.getFeatureRenderer() |
1858 |
|
.findFeaturesAtColumn(sequence, column + 1); |
1859 |
|
|
1860 |
0 |
PopupMenu pop = new PopupMenu(ap, null, features); |
1861 |
0 |
pop.show(this, evt.getX(), evt.getY()); |
1862 |
|
} |
1863 |
|
|
1864 |
|
|
1865 |
|
|
1866 |
|
|
1867 |
|
@param |
1868 |
|
|
1869 |
|
@param |
1870 |
|
|
1871 |
|
|
1872 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 5 |
Complexity Density: 0.25 |
|
1873 |
0 |
public void doMouseReleasedDefineMode(MouseEvent evt, boolean afterDrag)... |
1874 |
|
{ |
1875 |
0 |
if (stretchGroup == null) |
1876 |
|
{ |
1877 |
0 |
return; |
1878 |
|
} |
1879 |
|
|
1880 |
0 |
stretchGroup.removePropertyChangeListener(seqCanvas); |
1881 |
|
|
1882 |
|
|
1883 |
|
|
1884 |
0 |
boolean vischange = stretchGroup.recalcConservation(true); |
1885 |
0 |
updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup() |
1886 |
|
&& afterDrag; |
1887 |
0 |
if (stretchGroup.cs != null) |
1888 |
|
{ |
1889 |
0 |
stretchGroup.cs.alignmentChanged(stretchGroup, |
1890 |
|
av.getHiddenRepSequences()); |
1891 |
|
|
1892 |
0 |
ResidueShaderI groupColourScheme = stretchGroup |
1893 |
|
.getGroupColourScheme(); |
1894 |
0 |
String name = stretchGroup.getName(); |
1895 |
0 |
if (stretchGroup.cs.conservationApplied()) |
1896 |
|
{ |
1897 |
0 |
SliderPanel.setConservationSlider(ap, groupColourScheme, name); |
1898 |
|
} |
1899 |
0 |
if (stretchGroup.cs.getThreshold() > 0) |
1900 |
|
{ |
1901 |
0 |
SliderPanel.setPIDSliderSource(ap, groupColourScheme, name); |
1902 |
|
} |
1903 |
|
} |
1904 |
0 |
PaintRefresher.Refresh(this, av.getSequenceSetId()); |
1905 |
|
|
1906 |
|
|
1907 |
0 |
ap.paintAlignment(updateOverviewAndStructs, updateOverviewAndStructs); |
1908 |
0 |
updateOverviewAndStructs = false; |
1909 |
0 |
changeEndRes = false; |
1910 |
0 |
changeStartRes = false; |
1911 |
0 |
stretchGroup = null; |
1912 |
0 |
av.sendSelection(); |
1913 |
|
} |
1914 |
|
|
1915 |
|
|
1916 |
|
|
1917 |
|
|
1918 |
|
@param |
1919 |
|
|
1920 |
|
|
|
|
| 0% |
Uncovered Elements: 78 (78) |
Complexity: 20 |
Complexity Density: 0.45 |
|
1921 |
0 |
public void doMouseDraggedDefineMode(MouseEvent evt)... |
1922 |
|
{ |
1923 |
0 |
int res = findColumn(evt); |
1924 |
0 |
int y = findSeq(evt); |
1925 |
|
|
1926 |
0 |
if (wrappedBlock != startWrapBlock) |
1927 |
|
{ |
1928 |
0 |
return; |
1929 |
|
} |
1930 |
|
|
1931 |
0 |
if (stretchGroup == null) |
1932 |
|
{ |
1933 |
0 |
return; |
1934 |
|
} |
1935 |
|
|
1936 |
0 |
res = Math.min(res, av.getAlignment().getWidth()-1); |
1937 |
|
|
1938 |
0 |
if (stretchGroup.getEndRes() == res) |
1939 |
|
{ |
1940 |
|
|
1941 |
0 |
changeEndRes = true; |
1942 |
|
} |
1943 |
0 |
else if (stretchGroup.getStartRes() == res) |
1944 |
|
{ |
1945 |
|
|
1946 |
0 |
changeStartRes = true; |
1947 |
|
} |
1948 |
|
|
1949 |
0 |
if (res < av.getRanges().getStartRes()) |
1950 |
|
{ |
1951 |
0 |
res = av.getRanges().getStartRes(); |
1952 |
|
} |
1953 |
|
|
1954 |
0 |
if (changeEndRes) |
1955 |
|
{ |
1956 |
0 |
if (res > (stretchGroup.getStartRes() - 1)) |
1957 |
|
{ |
1958 |
0 |
stretchGroup.setEndRes(res); |
1959 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
1960 |
|
} |
1961 |
|
} |
1962 |
0 |
else if (changeStartRes) |
1963 |
|
{ |
1964 |
0 |
if (res < (stretchGroup.getEndRes() + 1)) |
1965 |
|
{ |
1966 |
0 |
stretchGroup.setStartRes(res); |
1967 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
1968 |
|
} |
1969 |
|
} |
1970 |
|
|
1971 |
0 |
int dragDirection = 0; |
1972 |
|
|
1973 |
0 |
if (y > oldSeq) |
1974 |
|
{ |
1975 |
0 |
dragDirection = 1; |
1976 |
|
} |
1977 |
0 |
else if (y < oldSeq) |
1978 |
|
{ |
1979 |
0 |
dragDirection = -1; |
1980 |
|
} |
1981 |
|
|
1982 |
0 |
while ((y != oldSeq) && (oldSeq > -1) |
1983 |
|
&& (y < av.getAlignment().getHeight())) |
1984 |
|
{ |
1985 |
|
|
1986 |
|
|
1987 |
0 |
Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq); |
1988 |
|
|
1989 |
0 |
oldSeq += dragDirection; |
1990 |
|
|
1991 |
0 |
if (oldSeq < 0) |
1992 |
|
{ |
1993 |
0 |
break; |
1994 |
|
} |
1995 |
|
|
1996 |
0 |
Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq); |
1997 |
|
|
1998 |
0 |
if (stretchGroup.getSequences(null).contains(nextSeq)) |
1999 |
|
{ |
2000 |
0 |
stretchGroup.deleteSequence(seq, false); |
2001 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
2002 |
|
} |
2003 |
|
else |
2004 |
|
{ |
2005 |
0 |
if (seq != null) |
2006 |
|
{ |
2007 |
0 |
stretchGroup.addSequence(seq, false); |
2008 |
|
} |
2009 |
|
|
2010 |
0 |
stretchGroup.addSequence(nextSeq, false); |
2011 |
0 |
updateOverviewAndStructs |= av.isSelectionDefinedGroup(); |
2012 |
|
} |
2013 |
|
} |
2014 |
|
|
2015 |
0 |
if (oldSeq < 0) |
2016 |
|
{ |
2017 |
0 |
oldSeq = -1; |
2018 |
|
} |
2019 |
|
|
2020 |
0 |
mouseDragging = true; |
2021 |
|
|
2022 |
0 |
if (scrollThread != null) |
2023 |
|
{ |
2024 |
0 |
scrollThread.setMousePosition(evt.getPoint()); |
2025 |
|
} |
2026 |
|
} |
2027 |
|
|
2028 |
|
|
2029 |
|
|
2030 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
2031 |
0 |
void stopScrolling()... |
2032 |
|
{ |
2033 |
0 |
if (scrollThread != null) |
2034 |
|
{ |
2035 |
0 |
scrollThread.stopScrolling(); |
2036 |
0 |
scrollThread = null; |
2037 |
|
} |
2038 |
0 |
mouseDragging = false; |
2039 |
|
} |
2040 |
|
|
2041 |
|
|
2042 |
|
|
2043 |
|
|
2044 |
|
|
2045 |
|
@param |
2046 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
2047 |
0 |
void startScrolling(Point mousePos)... |
2048 |
|
{ |
2049 |
|
|
2050 |
|
|
2051 |
|
|
2052 |
|
|
2053 |
0 |
mouseDragging = true; |
2054 |
0 |
if (!av.getWrapAlignment() && scrollThread == null) |
2055 |
|
{ |
2056 |
0 |
scrollThread = new ScrollThread(); |
2057 |
0 |
scrollThread.setMousePosition(mousePos); |
2058 |
0 |
if (!Jalview.isJS()) |
2059 |
|
{ |
2060 |
|
|
2061 |
|
|
2062 |
|
|
2063 |
0 |
scrollThread.start(); |
2064 |
|
} |
2065 |
|
else |
2066 |
|
{ |
2067 |
|
|
2068 |
|
|
2069 |
|
|
2070 |
|
|
2071 |
|
|
2072 |
|
|
2073 |
|
|
2074 |
|
|
2075 |
|
|
2076 |
|
|
2077 |
|
|
2078 |
|
|
2079 |
|
|
2080 |
|
|
2081 |
|
|
2082 |
|
|
2083 |
|
|
2084 |
|
|
2085 |
0 |
Timer t = new Timer(20, new ActionListener() |
2086 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
2087 |
0 |
@Override... |
2088 |
|
public void actionPerformed(ActionEvent e) |
2089 |
|
{ |
2090 |
0 |
if (scrollThread != null) |
2091 |
|
{ |
2092 |
|
|
2093 |
0 |
scrollThread.scrollOnce(); |
2094 |
|
} |
2095 |
|
} |
2096 |
|
}); |
2097 |
0 |
t.addActionListener(new ActionListener() |
2098 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
2099 |
0 |
@Override... |
2100 |
|
public void actionPerformed(ActionEvent e) |
2101 |
|
{ |
2102 |
0 |
if (scrollThread == null) |
2103 |
|
{ |
2104 |
|
|
2105 |
0 |
t.stop(); |
2106 |
|
} |
2107 |
|
} |
2108 |
|
}); |
2109 |
0 |
t.start(); |
2110 |
|
} |
2111 |
|
} |
2112 |
|
} |
2113 |
|
|
2114 |
|
|
2115 |
|
|
2116 |
|
|
2117 |
|
|
2118 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 13 |
Complexity Density: 0.59 |
|
2119 |
|
class ScrollThread extends Thread |
2120 |
|
{ |
2121 |
|
private Point mousePos; |
2122 |
|
|
2123 |
|
private volatile boolean keepRunning = true; |
2124 |
|
|
2125 |
|
|
2126 |
|
|
2127 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2128 |
0 |
public ScrollThread()... |
2129 |
|
{ |
2130 |
0 |
setName("SeqPanel$ScrollThread"); |
2131 |
|
} |
2132 |
|
|
2133 |
|
|
2134 |
|
|
2135 |
|
|
2136 |
|
|
2137 |
|
|
2138 |
|
|
2139 |
|
|
2140 |
|
@param |
2141 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2142 |
0 |
public void setMousePosition(Point p)... |
2143 |
|
{ |
2144 |
0 |
mousePos = p; |
2145 |
|
} |
2146 |
|
|
2147 |
|
|
2148 |
|
|
2149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2150 |
0 |
public void stopScrolling()... |
2151 |
|
{ |
2152 |
0 |
keepRunning = false; |
2153 |
|
} |
2154 |
|
|
2155 |
|
|
2156 |
|
|
2157 |
|
|
2158 |
|
|
2159 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
2160 |
0 |
@Override... |
2161 |
|
public void run() |
2162 |
|
{ |
2163 |
0 |
while (keepRunning) |
2164 |
|
{ |
2165 |
0 |
if (mousePos != null) |
2166 |
|
{ |
2167 |
0 |
keepRunning = scrollOnce(); |
2168 |
|
} |
2169 |
0 |
try |
2170 |
|
{ |
2171 |
0 |
Thread.sleep(20); |
2172 |
|
} catch (Exception ex) |
2173 |
|
{ |
2174 |
|
} |
2175 |
|
} |
2176 |
0 |
SeqPanel.this.scrollThread = null; |
2177 |
|
} |
2178 |
|
|
2179 |
|
|
2180 |
|
|
2181 |
|
|
2182 |
|
|
2183 |
|
|
2184 |
|
|
2185 |
|
|
2186 |
|
|
2187 |
|
|
2188 |
|
|
2189 |
|
|
2190 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0.46 |
|
2191 |
0 |
boolean scrollOnce()... |
2192 |
|
{ |
2193 |
|
|
2194 |
|
|
2195 |
|
|
2196 |
0 |
if (!mouseDragging) |
2197 |
|
{ |
2198 |
0 |
return false; |
2199 |
|
} |
2200 |
|
|
2201 |
0 |
boolean scrolled = false; |
2202 |
0 |
ViewportRanges ranges = SeqPanel.this.av.getRanges(); |
2203 |
|
|
2204 |
|
|
2205 |
|
|
2206 |
|
|
2207 |
0 |
if (mousePos.y < 0) |
2208 |
|
{ |
2209 |
|
|
2210 |
0 |
scrolled = ranges.scrollUp(true); |
2211 |
|
} |
2212 |
0 |
else if (mousePos.y >= getHeight()) |
2213 |
|
{ |
2214 |
|
|
2215 |
0 |
scrolled = ranges.scrollUp(false); |
2216 |
|
} |
2217 |
|
|
2218 |
|
|
2219 |
|
|
2220 |
|
|
2221 |
0 |
if (mousePos.x < 0) |
2222 |
|
{ |
2223 |
0 |
scrolled |= ranges.scrollRight(false); |
2224 |
|
} |
2225 |
0 |
else if (mousePos.x >= getWidth()) |
2226 |
|
{ |
2227 |
0 |
scrolled |= ranges.scrollRight(true); |
2228 |
|
} |
2229 |
0 |
return scrolled; |
2230 |
|
} |
2231 |
|
} |
2232 |
|
|
2233 |
|
|
2234 |
|
|
2235 |
|
|
|
|
| 53.9% |
Uncovered Elements: 35 (76) |
Complexity: 25 |
Complexity Density: 0.6 |
|
2236 |
204 |
@Override... |
2237 |
|
public void selection(SequenceGroup seqsel, ColumnSelection colsel, |
2238 |
|
HiddenColumns hidden, SelectionSource source) |
2239 |
|
{ |
2240 |
|
|
2241 |
|
|
2242 |
|
|
2243 |
|
|
2244 |
204 |
boolean iSentTheSelection = (av == source |
2245 |
|
|| (source instanceof AlignViewport |
2246 |
|
&& ((AlignmentViewport) source).getSequenceSetId() |
2247 |
|
.equals(av.getSequenceSetId()))); |
2248 |
|
|
2249 |
204 |
if (iSentTheSelection) |
2250 |
|
{ |
2251 |
|
|
2252 |
14 |
if (ap.getCalculationDialog() != null) |
2253 |
|
{ |
2254 |
0 |
ap.getCalculationDialog().validateCalcTypes(); |
2255 |
|
} |
2256 |
|
|
2257 |
14 |
return; |
2258 |
|
} |
2259 |
|
|
2260 |
|
|
2261 |
190 |
if (!av.followSelection) |
2262 |
|
{ |
2263 |
0 |
return; |
2264 |
|
} |
2265 |
|
|
2266 |
|
|
2267 |
|
|
2268 |
|
|
2269 |
190 |
if (av.isSelectionGroupChanged(false) || av.isColSelChanged(false)) |
2270 |
|
{ |
2271 |
126 |
return; |
2272 |
|
} |
2273 |
|
|
2274 |
|
|
2275 |
|
|
2276 |
|
|
2277 |
|
|
2278 |
64 |
if (selectionFromTranslation(seqsel, colsel, hidden, source)) |
2279 |
|
{ |
2280 |
0 |
return; |
2281 |
|
} |
2282 |
|
|
2283 |
|
|
2284 |
|
|
2285 |
|
|
2286 |
|
|
2287 |
|
|
2288 |
|
|
2289 |
64 |
boolean repaint = false; |
2290 |
64 |
boolean copycolsel = false; |
2291 |
|
|
2292 |
64 |
SequenceGroup sgroup = null; |
2293 |
64 |
if (seqsel != null && seqsel.getSize() > 0) |
2294 |
|
{ |
2295 |
10 |
if (av.getAlignment() == null) |
2296 |
|
{ |
2297 |
0 |
Cache.log.warn("alignviewport av SeqSetId=" + av.getSequenceSetId() |
2298 |
|
+ " ViewId=" + av.getViewId() |
2299 |
|
+ " 's alignment is NULL! returning immediately."); |
2300 |
0 |
return; |
2301 |
|
} |
2302 |
10 |
sgroup = seqsel.intersect(av.getAlignment(), |
2303 |
10 |
(av.hasHiddenRows()) ? av.getHiddenRepSequences() : null); |
2304 |
10 |
if ((sgroup != null && sgroup.getSize() > 0)) |
2305 |
|
{ |
2306 |
0 |
copycolsel = true; |
2307 |
|
} |
2308 |
|
} |
2309 |
64 |
if (sgroup != null && sgroup.getSize() > 0) |
2310 |
|
{ |
2311 |
0 |
av.setSelectionGroup(sgroup); |
2312 |
|
} |
2313 |
|
else |
2314 |
|
{ |
2315 |
64 |
av.setSelectionGroup(null); |
2316 |
|
} |
2317 |
64 |
av.isSelectionGroupChanged(true); |
2318 |
64 |
repaint = true; |
2319 |
|
|
2320 |
64 |
if (copycolsel) |
2321 |
|
{ |
2322 |
|
|
2323 |
|
|
2324 |
0 |
if (colsel == null || colsel.isEmpty()) |
2325 |
|
{ |
2326 |
0 |
if (av.getColumnSelection() != null) |
2327 |
|
{ |
2328 |
0 |
av.getColumnSelection().clear(); |
2329 |
0 |
repaint = true; |
2330 |
|
} |
2331 |
|
} |
2332 |
|
else |
2333 |
|
{ |
2334 |
|
|
2335 |
0 |
if (av.getColumnSelection() == null) |
2336 |
|
{ |
2337 |
0 |
av.setColumnSelection(new ColumnSelection(colsel)); |
2338 |
|
} |
2339 |
|
else |
2340 |
|
{ |
2341 |
0 |
av.getColumnSelection().setElementsFrom(colsel, |
2342 |
|
av.getAlignment().getHiddenColumns()); |
2343 |
|
} |
2344 |
|
} |
2345 |
0 |
av.isColSelChanged(true); |
2346 |
0 |
repaint = true; |
2347 |
|
} |
2348 |
|
|
2349 |
64 |
if (copycolsel && av.hasHiddenColumns() |
2350 |
|
&& (av.getAlignment().getHiddenColumns() == null)) |
2351 |
|
{ |
2352 |
0 |
System.err.println("Bad things"); |
2353 |
|
} |
2354 |
64 |
if (repaint) |
2355 |
|
{ |
2356 |
|
|
2357 |
64 |
PaintRefresher.Refresh(this, av.getSequenceSetId()); |
2358 |
|
|
2359 |
|
} |
2360 |
|
|
2361 |
|
|
2362 |
64 |
if (ap.getCalculationDialog() != null) |
2363 |
|
{ |
2364 |
0 |
ap.getCalculationDialog().validateCalcTypes(); |
2365 |
|
} |
2366 |
|
|
2367 |
|
} |
2368 |
|
|
2369 |
|
|
2370 |
|
|
2371 |
|
|
2372 |
|
|
2373 |
|
|
2374 |
|
@param |
2375 |
|
@param |
2376 |
|
@param |
2377 |
|
|
|
|
| 26.1% |
Uncovered Elements: 17 (23) |
Complexity: 5 |
Complexity Density: 0.29 |
|
2378 |
64 |
protected boolean selectionFromTranslation(SequenceGroup seqsel,... |
2379 |
|
ColumnSelection colsel, HiddenColumns hidden, |
2380 |
|
SelectionSource source) |
2381 |
|
{ |
2382 |
64 |
if (!(source instanceof AlignViewportI)) |
2383 |
|
{ |
2384 |
0 |
return false; |
2385 |
|
} |
2386 |
64 |
final AlignViewportI sourceAv = (AlignViewportI) source; |
2387 |
64 |
if (sourceAv.getCodingComplement() != av |
2388 |
|
&& av.getCodingComplement() != sourceAv) |
2389 |
|
{ |
2390 |
64 |
return false; |
2391 |
|
} |
2392 |
|
|
2393 |
|
|
2394 |
|
|
2395 |
|
|
2396 |
0 |
SequenceGroup sg = MappingUtils.mapSequenceGroup(seqsel, sourceAv, av); |
2397 |
0 |
av.setSelectionGroup(sg); |
2398 |
0 |
av.isSelectionGroupChanged(true); |
2399 |
|
|
2400 |
|
|
2401 |
|
|
2402 |
|
|
2403 |
|
|
2404 |
|
|
2405 |
0 |
ColumnSelection cs = new ColumnSelection(); |
2406 |
0 |
HiddenColumns hs = new HiddenColumns(); |
2407 |
0 |
MappingUtils.mapColumnSelection(colsel, hidden, sourceAv, av, cs, hs); |
2408 |
0 |
av.setColumnSelection(cs); |
2409 |
0 |
av.getAlignment().setHiddenColumns(hs); |
2410 |
|
|
2411 |
|
|
2412 |
0 |
if (ap.getCalculationDialog() != null) |
2413 |
|
{ |
2414 |
0 |
ap.getCalculationDialog().validateCalcTypes(); |
2415 |
|
} |
2416 |
|
|
2417 |
0 |
PaintRefresher.Refresh(this, av.getSequenceSetId()); |
2418 |
|
|
2419 |
0 |
return true; |
2420 |
|
} |
2421 |
|
|
2422 |
|
|
2423 |
|
|
2424 |
|
@return |
2425 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
2426 |
1 |
public SearchResultsI getLastSearchResults()... |
2427 |
|
{ |
2428 |
1 |
return lastSearchResults; |
2429 |
|
} |
2430 |
|
} |