1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.viewmodel; |
22 |
|
|
23 |
|
import jalview.datamodel.AlignmentI; |
24 |
|
import jalview.datamodel.HiddenColumns; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
|
|
| 50.2% |
Uncovered Elements: 151 (303) |
Complexity: 86 |
Complexity Density: 0.48 |
|
32 |
|
public class ViewportRanges extends ViewportProperties |
33 |
|
{ |
34 |
|
public static final String STARTRES = "startres"; |
35 |
|
|
36 |
|
public static final String ENDRES = "endres"; |
37 |
|
|
38 |
|
public static final String STARTSEQ = "startseq"; |
39 |
|
|
40 |
|
public static final String ENDSEQ = "endseq"; |
41 |
|
|
42 |
|
public static final String STARTRESANDSEQ = "startresandseq"; |
43 |
|
|
44 |
|
public static final String MOVE_VIEWPORT = "move_viewport"; |
45 |
|
|
46 |
|
private boolean wrappedMode = false; |
47 |
|
|
48 |
|
|
49 |
|
private int startRes; |
50 |
|
|
51 |
|
|
52 |
|
private int endRes; |
53 |
|
|
54 |
|
|
55 |
|
private int startSeq; |
56 |
|
|
57 |
|
|
58 |
|
private int endSeq; |
59 |
|
|
60 |
|
|
61 |
|
private AlignmentI al; |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
@param |
67 |
|
|
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
69 |
272 |
public ViewportRanges(AlignmentI alignment)... |
70 |
|
{ |
71 |
|
|
72 |
272 |
this.startRes = 0; |
73 |
272 |
this.endRes = alignment.getWidth() - 1; |
74 |
272 |
this.startSeq = 0; |
75 |
272 |
this.endSeq = alignment.getHeight() - 1; |
76 |
272 |
this.al = alignment; |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
58 |
public int getAbsoluteAlignmentWidth()... |
83 |
|
{ |
84 |
58 |
return al.getWidth(); |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
42 |
public int getAbsoluteAlignmentHeight()... |
91 |
|
{ |
92 |
42 |
return al.getHeight() + al.getHiddenSequences().getSize(); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
630 |
public int getVisibleAlignmentWidth()... |
99 |
|
{ |
100 |
630 |
return al.getVisibleWidth(); |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
1122 |
public int getVisibleAlignmentHeight()... |
107 |
|
{ |
108 |
1122 |
return al.getHeight(); |
109 |
|
} |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
|
117 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
118 |
7 |
public void setStartRes(int res)... |
119 |
|
{ |
120 |
7 |
int width = getViewportWidth(); |
121 |
7 |
setStartEndRes(res, res + width - 1); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
@param |
130 |
|
|
131 |
|
@param |
132 |
|
|
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
134 |
341 |
public void setStartEndRes(int start, int end)... |
135 |
|
{ |
136 |
341 |
int[] oldvalues = updateStartEndRes(start, end); |
137 |
341 |
int oldstartres = oldvalues[0]; |
138 |
341 |
int oldendres = oldvalues[1]; |
139 |
|
|
140 |
341 |
changeSupport.firePropertyChange(STARTRES, oldstartres, startRes); |
141 |
341 |
if (oldstartres == startRes) |
142 |
|
{ |
143 |
|
|
144 |
|
|
145 |
333 |
changeSupport.firePropertyChange(ENDRES, oldendres, endRes); |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
@param |
154 |
|
|
155 |
|
@param |
156 |
|
|
157 |
|
@return |
158 |
|
|
|
|
| 72.7% |
Uncovered Elements: 6 (22) |
Complexity: 7 |
Complexity Density: 0.5 |
|
159 |
341 |
private int[] updateStartEndRes(int start, int end)... |
160 |
|
{ |
161 |
341 |
int oldstartres = this.startRes; |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
341 |
int lastColumn = getVisibleAlignmentWidth() - 1; |
167 |
341 |
if (!wrappedMode && (start > lastColumn)) |
168 |
|
{ |
169 |
0 |
startRes = Math.max(lastColumn, 0); |
170 |
|
} |
171 |
341 |
else if (start < 0) |
172 |
|
{ |
173 |
0 |
startRes = 0; |
174 |
|
} |
175 |
|
else |
176 |
|
{ |
177 |
341 |
startRes = start; |
178 |
|
} |
179 |
|
|
180 |
341 |
int oldendres = this.endRes; |
181 |
341 |
if (end < 0) |
182 |
|
{ |
183 |
0 |
endRes = 0; |
184 |
|
} |
185 |
341 |
else if (!wrappedMode && (end > lastColumn)) |
186 |
|
{ |
187 |
220 |
endRes = Math.max(lastColumn, 0); |
188 |
|
} |
189 |
|
else |
190 |
|
{ |
191 |
121 |
endRes = end; |
192 |
|
} |
193 |
341 |
return new int[] { oldstartres, oldendres }; |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
@param |
202 |
|
|
203 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
204 |
285 |
public void setStartSeq(int seq)... |
205 |
|
{ |
206 |
285 |
int startseq = seq; |
207 |
285 |
int height = getViewportHeight(); |
208 |
285 |
if (startseq + height - 1 > getVisibleAlignmentHeight() - 1) |
209 |
|
{ |
210 |
5 |
startseq = getVisibleAlignmentHeight() - height; |
211 |
|
} |
212 |
285 |
setStartEndSeq(startseq, startseq + height - 1); |
213 |
|
} |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@param |
221 |
|
|
222 |
|
@param |
223 |
|
|
224 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
225 |
649 |
public void setStartEndSeq(int start, int end)... |
226 |
|
{ |
227 |
|
|
228 |
|
|
229 |
649 |
int[] oldvalues = updateStartEndSeq(start, end); |
230 |
649 |
int oldstartseq = oldvalues[0]; |
231 |
649 |
int oldendseq = oldvalues[1]; |
232 |
|
|
233 |
649 |
changeSupport.firePropertyChange(STARTSEQ, oldstartseq, startSeq); |
234 |
649 |
if (oldstartseq == startSeq) |
235 |
|
{ |
236 |
|
|
237 |
|
|
238 |
633 |
changeSupport.firePropertyChange(ENDSEQ, oldendseq, endSeq); |
239 |
|
} |
240 |
|
} |
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
@param |
247 |
|
|
248 |
|
@param |
249 |
|
|
250 |
|
@return |
251 |
|
|
|
|
| 81.8% |
Uncovered Elements: 4 (22) |
Complexity: 5 |
Complexity Density: 0.36 |
|
252 |
649 |
private int[] updateStartEndSeq(int start, int end)... |
253 |
|
{ |
254 |
649 |
int oldstartseq = this.startSeq; |
255 |
649 |
int visibleHeight = getVisibleAlignmentHeight(); |
256 |
649 |
if (start > visibleHeight - 1) |
257 |
|
{ |
258 |
0 |
startSeq = Math.max(visibleHeight - 1, 0); |
259 |
|
} |
260 |
649 |
else if (start < 0) |
261 |
|
{ |
262 |
5 |
startSeq = 0; |
263 |
|
} |
264 |
|
else |
265 |
|
{ |
266 |
644 |
startSeq = start; |
267 |
|
} |
268 |
|
|
269 |
649 |
int oldendseq = this.endSeq; |
270 |
649 |
if (end >= visibleHeight) |
271 |
|
{ |
272 |
231 |
endSeq = Math.max(visibleHeight - 1, 0); |
273 |
|
} |
274 |
418 |
else if (end < 0) |
275 |
|
{ |
276 |
0 |
endSeq = 0; |
277 |
|
} |
278 |
|
else |
279 |
|
{ |
280 |
418 |
endSeq = end; |
281 |
|
} |
282 |
649 |
return new int[] { oldstartseq, oldendseq }; |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
@param |
290 |
|
|
291 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
292 |
13 |
public void setEndSeq(int seq)... |
293 |
|
{ |
294 |
|
|
295 |
13 |
setStartEndSeq(Math.max(0, seq + 1 - getViewportHeight()), seq); |
296 |
|
} |
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
|
|
303 |
|
@param |
304 |
|
|
305 |
|
@param |
306 |
|
|
307 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
308 |
0 |
public void setStartResAndSeq(int res, int seq)... |
309 |
|
{ |
310 |
0 |
int width = getViewportWidth(); |
311 |
0 |
int[] oldresvalues = updateStartEndRes(res, res + width - 1); |
312 |
|
|
313 |
0 |
int startseq = seq; |
314 |
0 |
int height = getViewportHeight(); |
315 |
0 |
if (startseq + height - 1 > getVisibleAlignmentHeight() - 1) |
316 |
|
{ |
317 |
0 |
startseq = getVisibleAlignmentHeight() - height; |
318 |
|
} |
319 |
0 |
int[] oldseqvalues = updateStartEndSeq(startseq, startseq + height - 1); |
320 |
|
|
321 |
0 |
int[] old = new int[] { oldresvalues[0], oldseqvalues[0] }; |
322 |
0 |
int[] newresseq = new int[] { startRes, startSeq }; |
323 |
0 |
changeSupport.firePropertyChange(STARTRESANDSEQ, old, newresseq); |
324 |
|
} |
325 |
|
|
326 |
|
|
327 |
|
|
328 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
329 |
4748 |
public int getStartRes()... |
330 |
|
{ |
331 |
4748 |
return startRes; |
332 |
|
} |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
337 |
4151 |
public int getEndRes()... |
338 |
|
{ |
339 |
4151 |
return endRes; |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
345 |
2684 |
public int getStartSeq()... |
346 |
|
{ |
347 |
2684 |
return startSeq; |
348 |
|
} |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
353 |
1556 |
public int getEndSeq()... |
354 |
|
{ |
355 |
1556 |
return endSeq; |
356 |
|
} |
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
@param |
364 |
|
|
365 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
366 |
208 |
public void setViewportWidth(int w)... |
367 |
|
{ |
368 |
208 |
setStartEndRes(startRes, startRes + w - 1); |
369 |
|
} |
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
@param |
377 |
|
|
378 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
379 |
196 |
public void setViewportHeight(int h)... |
380 |
|
{ |
381 |
196 |
setStartEndSeq(startSeq, startSeq + h - 1); |
382 |
|
} |
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
|
@param |
390 |
|
|
391 |
|
@param |
392 |
|
|
393 |
|
|
|
|
| 61.5% |
Uncovered Elements: 5 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
394 |
126 |
public void setViewportStartAndWidth(int start, int w)... |
395 |
|
{ |
396 |
126 |
int vpstart = start; |
397 |
126 |
if (vpstart < 0) |
398 |
|
{ |
399 |
0 |
vpstart = 0; |
400 |
|
} |
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
126 |
if (!wrappedMode) |
406 |
|
{ |
407 |
126 |
if ((w <= getVisibleAlignmentWidth()) |
408 |
|
&& (vpstart + w - 1 > getVisibleAlignmentWidth() - 1)) |
409 |
|
{ |
410 |
0 |
vpstart = getVisibleAlignmentWidth() - w; |
411 |
|
} |
412 |
|
|
413 |
|
} |
414 |
126 |
setStartEndRes(vpstart, vpstart + w - 1); |
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
|
|
421 |
|
|
422 |
|
@param |
423 |
|
|
424 |
|
@param |
425 |
|
|
426 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
427 |
150 |
public void setViewportStartAndHeight(int start, int h)... |
428 |
|
{ |
429 |
150 |
int vpstart = start; |
430 |
|
|
431 |
150 |
int visHeight = getVisibleAlignmentHeight(); |
432 |
150 |
if (vpstart < 0) |
433 |
|
{ |
434 |
0 |
vpstart = 0; |
435 |
|
} |
436 |
150 |
else if (h <= visHeight && vpstart + h > visHeight) |
437 |
|
|
438 |
|
|
439 |
|
{ |
440 |
1 |
vpstart = visHeight - h; |
441 |
|
} |
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
150 |
setStartEndSeq(vpstart, vpstart + h - 1); |
447 |
|
} |
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
@return |
453 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
454 |
232 |
public int getViewportWidth()... |
455 |
|
{ |
456 |
232 |
return (endRes - startRes + 1); |
457 |
|
} |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
@return |
463 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
464 |
465 |
public int getViewportHeight()... |
465 |
|
{ |
466 |
465 |
return (endSeq - startSeq + 1); |
467 |
|
} |
468 |
|
|
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
@param |
473 |
|
|
474 |
|
|
475 |
|
@return |
476 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 6 |
Complexity Density: 0.5 |
|
477 |
0 |
public boolean scrollUp(boolean up)... |
478 |
|
{ |
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
|
483 |
0 |
if (up) |
484 |
|
{ |
485 |
0 |
if (wrappedMode) |
486 |
|
{ |
487 |
0 |
pageUp(); |
488 |
|
} |
489 |
|
else |
490 |
|
{ |
491 |
0 |
if (startSeq < 1) |
492 |
|
{ |
493 |
0 |
return false; |
494 |
|
} |
495 |
0 |
setStartSeq(startSeq - 1); |
496 |
|
} |
497 |
|
} |
498 |
|
else |
499 |
|
{ |
500 |
0 |
if (wrappedMode) |
501 |
|
{ |
502 |
0 |
pageDown(); |
503 |
|
} |
504 |
|
else |
505 |
|
{ |
506 |
0 |
if (endSeq >= getVisibleAlignmentHeight() - 1) |
507 |
|
{ |
508 |
0 |
return false; |
509 |
|
} |
510 |
0 |
setStartSeq(startSeq + 1); |
511 |
|
} |
512 |
|
} |
513 |
0 |
return true; |
514 |
|
} |
515 |
|
|
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
@param |
520 |
|
|
521 |
|
|
522 |
|
@return |
523 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
524 |
0 |
public boolean scrollRight(boolean right)... |
525 |
|
{ |
526 |
0 |
if (!right) |
527 |
|
{ |
528 |
0 |
if (startRes < 1) |
529 |
|
{ |
530 |
0 |
return false; |
531 |
|
} |
532 |
|
|
533 |
0 |
setStartRes(startRes - 1); |
534 |
|
} |
535 |
|
else |
536 |
|
{ |
537 |
0 |
if (endRes >= getVisibleAlignmentWidth() - 1) |
538 |
|
{ |
539 |
0 |
return false; |
540 |
|
} |
541 |
|
|
542 |
0 |
setStartRes(startRes + 1); |
543 |
|
} |
544 |
|
|
545 |
0 |
return true; |
546 |
|
} |
547 |
|
|
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
|
@param |
554 |
|
|
555 |
|
|
556 |
|
@return |
557 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
558 |
1 |
public boolean scrollToWrappedVisible(int res)... |
559 |
|
{ |
560 |
1 |
int newStartRes = calcWrappedStartResidue(res); |
561 |
1 |
if (newStartRes == startRes) |
562 |
|
{ |
563 |
0 |
return false; |
564 |
|
} |
565 |
1 |
setStartRes(newStartRes); |
566 |
|
|
567 |
1 |
return true; |
568 |
|
} |
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
@param |
574 |
|
|
575 |
|
@return |
576 |
|
|
|
|
| 70.6% |
Uncovered Elements: 5 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
577 |
1 |
private int calcWrappedStartResidue(int res)... |
578 |
|
{ |
579 |
1 |
int oldStartRes = startRes; |
580 |
1 |
int width = getViewportWidth(); |
581 |
|
|
582 |
1 |
boolean up = res < oldStartRes; |
583 |
1 |
int widthsToScroll = Math.abs((res - oldStartRes) / width); |
584 |
1 |
if (up) |
585 |
|
{ |
586 |
0 |
widthsToScroll++; |
587 |
|
} |
588 |
|
|
589 |
1 |
int residuesToScroll = width * widthsToScroll; |
590 |
1 |
int newStartRes = up ? oldStartRes - residuesToScroll |
591 |
|
: oldStartRes + residuesToScroll; |
592 |
1 |
if (newStartRes < 0) |
593 |
|
{ |
594 |
0 |
newStartRes = 0; |
595 |
|
} |
596 |
1 |
return newStartRes; |
597 |
|
} |
598 |
|
|
599 |
|
|
600 |
|
|
601 |
|
|
602 |
|
@param |
603 |
|
|
604 |
|
@param |
605 |
|
|
606 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.64 |
|
607 |
0 |
public void scrollToVisible(int x, int y)... |
608 |
|
{ |
609 |
0 |
while (y < startSeq) |
610 |
|
{ |
611 |
0 |
scrollUp(true); |
612 |
|
} |
613 |
0 |
while (y > endSeq) |
614 |
|
{ |
615 |
0 |
scrollUp(false); |
616 |
|
} |
617 |
|
|
618 |
0 |
HiddenColumns hidden = al.getHiddenColumns(); |
619 |
0 |
while (x < hidden.visibleToAbsoluteColumn(startRes)) |
620 |
|
{ |
621 |
0 |
if (!scrollRight(false)) |
622 |
|
{ |
623 |
0 |
break; |
624 |
|
} |
625 |
|
} |
626 |
0 |
while (x > hidden.visibleToAbsoluteColumn(endRes)) |
627 |
|
{ |
628 |
0 |
if (!scrollRight(true)) |
629 |
|
{ |
630 |
0 |
break; |
631 |
|
} |
632 |
|
} |
633 |
|
} |
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
@param |
639 |
|
|
640 |
|
@param |
641 |
|
|
642 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 8 |
Complexity Density: 0.33 |
|
643 |
0 |
public boolean setViewportLocation(int x, int y)... |
644 |
|
{ |
645 |
0 |
boolean changedLocation = false; |
646 |
|
|
647 |
|
|
648 |
0 |
int visX = al.getHiddenColumns().absoluteToVisibleColumn(x); |
649 |
0 |
int visY = al.getHiddenSequences().findIndexWithoutHiddenSeqs(y); |
650 |
|
|
651 |
|
|
652 |
0 |
if (startRes > visX || visX > endRes |
653 |
|
|| startSeq > visY && visY > endSeq) |
654 |
|
{ |
655 |
0 |
int[] old = new int[] { startRes, startSeq }; |
656 |
0 |
int[] newresseq; |
657 |
0 |
if (wrappedMode) |
658 |
|
{ |
659 |
0 |
int newstartres = calcWrappedStartResidue(visX); |
660 |
0 |
setStartRes(newstartres); |
661 |
0 |
newresseq = new int[] { startRes, startSeq }; |
662 |
|
} |
663 |
|
else |
664 |
|
{ |
665 |
|
|
666 |
0 |
int newstartres = visX; |
667 |
0 |
int width = getViewportWidth(); |
668 |
0 |
if (newstartres + width - 1 > getVisibleAlignmentWidth() - 1) |
669 |
|
{ |
670 |
0 |
newstartres = getVisibleAlignmentWidth() - width; |
671 |
|
} |
672 |
0 |
updateStartEndRes(newstartres, newstartres + width - 1); |
673 |
|
|
674 |
|
|
675 |
0 |
int newstartseq = visY; |
676 |
0 |
int height = getViewportHeight(); |
677 |
0 |
if (newstartseq + height - 1 > getVisibleAlignmentHeight() - 1) |
678 |
|
{ |
679 |
0 |
newstartseq = getVisibleAlignmentHeight() - height; |
680 |
|
} |
681 |
0 |
updateStartEndSeq(newstartseq, newstartseq + height - 1); |
682 |
|
|
683 |
0 |
newresseq = new int[] { startRes, startSeq }; |
684 |
|
} |
685 |
0 |
changedLocation = true; |
686 |
0 |
changeSupport.firePropertyChange(MOVE_VIEWPORT, old, newresseq); |
687 |
|
} |
688 |
0 |
return changedLocation; |
689 |
|
} |
690 |
|
|
691 |
|
|
692 |
|
|
693 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
694 |
0 |
public void pageUp()... |
695 |
|
{ |
696 |
0 |
if (wrappedMode) |
697 |
|
{ |
698 |
0 |
setStartRes(Math.max(0, getStartRes() - getViewportWidth())); |
699 |
|
} |
700 |
|
else |
701 |
|
{ |
702 |
0 |
setViewportStartAndHeight(startSeq - (endSeq - startSeq), |
703 |
|
getViewportHeight()); |
704 |
|
} |
705 |
|
} |
706 |
|
|
707 |
|
|
708 |
|
|
709 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
710 |
0 |
public void pageDown()... |
711 |
|
{ |
712 |
0 |
if (wrappedMode) |
713 |
|
{ |
714 |
|
|
715 |
|
|
716 |
|
|
717 |
|
|
718 |
0 |
int newStart = getStartRes() |
719 |
|
+ Math.max(getViewportHeight(), getViewportWidth()); |
720 |
|
|
721 |
|
|
722 |
|
|
723 |
|
|
724 |
|
|
725 |
0 |
if (newStart < getVisibleAlignmentWidth()) |
726 |
|
{ |
727 |
0 |
setStartRes(newStart); |
728 |
|
} |
729 |
|
} |
730 |
|
else |
731 |
|
{ |
732 |
0 |
setViewportStartAndHeight(endSeq, getViewportHeight()); |
733 |
|
} |
734 |
|
} |
735 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
736 |
16 |
public void setWrappedMode(boolean wrapped)... |
737 |
|
{ |
738 |
16 |
wrappedMode = wrapped; |
739 |
|
} |
740 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
741 |
0 |
public boolean isWrappedMode()... |
742 |
|
{ |
743 |
0 |
return wrappedMode; |
744 |
|
} |
745 |
|
|
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
|
750 |
|
|
751 |
|
|
752 |
|
|
753 |
|
|
754 |
|
|
755 |
|
|
756 |
|
|
757 |
|
|
758 |
|
|
759 |
|
@param |
760 |
|
|
761 |
|
@return |
762 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
763 |
46 |
public int getWrappedScrollPosition(final int topLeftColumn)... |
764 |
|
{ |
765 |
46 |
int w = getViewportWidth(); |
766 |
|
|
767 |
|
|
768 |
|
|
769 |
|
|
770 |
46 |
int scroll = topLeftColumn / w; |
771 |
|
|
772 |
|
|
773 |
|
|
774 |
|
|
775 |
46 |
scroll += topLeftColumn % w > 0 ? 1 : 0; |
776 |
|
|
777 |
46 |
return scroll; |
778 |
|
} |
779 |
|
|
780 |
|
|
781 |
|
|
782 |
|
|
783 |
|
|
784 |
|
@param |
785 |
|
@return |
786 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
787 |
19 |
public int getWrappedMaxScroll(int topLeftColumn)... |
788 |
|
{ |
789 |
19 |
int scrollPosition = getWrappedScrollPosition(topLeftColumn); |
790 |
|
|
791 |
|
|
792 |
|
|
793 |
|
|
794 |
19 |
int columnsRemaining = getVisibleAlignmentWidth() - topLeftColumn; |
795 |
19 |
int width = getViewportWidth(); |
796 |
19 |
int widthsRemaining = columnsRemaining / width |
797 |
19 |
+ (columnsRemaining % width > 0 ? 1 : 0) - 1; |
798 |
19 |
int maxScroll = scrollPosition + widthsRemaining; |
799 |
|
|
800 |
19 |
return maxScroll; |
801 |
|
} |
802 |
|
} |