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