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 |
|
|
|
|
| 0% |
Uncovered Elements: 303 (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 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
69 |
0 |
public ViewportRanges(AlignmentI alignment)... |
70 |
|
{ |
71 |
|
|
72 |
0 |
this.startRes = 0; |
73 |
0 |
this.endRes = alignment.getWidth() - 1; |
74 |
0 |
this.startSeq = 0; |
75 |
0 |
this.endSeq = alignment.getHeight() - 1; |
76 |
0 |
this.al = alignment; |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
82 |
0 |
public int getAbsoluteAlignmentWidth()... |
83 |
|
{ |
84 |
0 |
return al.getWidth(); |
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
0 |
public int getAbsoluteAlignmentHeight()... |
91 |
|
{ |
92 |
0 |
return al.getHeight() + al.getHiddenSequences().getSize(); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
0 |
public int getVisibleAlignmentWidth()... |
99 |
|
{ |
100 |
0 |
return al.getVisibleWidth(); |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
106 |
0 |
public int getVisibleAlignmentHeight()... |
107 |
|
{ |
108 |
0 |
return al.getHeight(); |
109 |
|
} |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
|
117 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
118 |
0 |
public void setStartRes(int res)... |
119 |
|
{ |
120 |
0 |
int width = getViewportWidth(); |
121 |
0 |
setStartEndRes(res, res + width - 1); |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
@param |
130 |
|
|
131 |
|
@param |
132 |
|
|
133 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
134 |
0 |
public void setStartEndRes(int start, int end)... |
135 |
|
{ |
136 |
0 |
int[] oldvalues = updateStartEndRes(start, end); |
137 |
0 |
int oldstartres = oldvalues[0]; |
138 |
0 |
int oldendres = oldvalues[1]; |
139 |
|
|
140 |
0 |
changeSupport.firePropertyChange(STARTRES, oldstartres, startRes); |
141 |
0 |
if (oldstartres == startRes) |
142 |
|
{ |
143 |
|
|
144 |
|
|
145 |
0 |
changeSupport.firePropertyChange(ENDRES, oldendres, endRes); |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
@param |
154 |
|
|
155 |
|
@param |
156 |
|
|
157 |
|
@return |
158 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 7 |
Complexity Density: 0.5 |
|
159 |
0 |
private int[] updateStartEndRes(int start, int end)... |
160 |
|
{ |
161 |
0 |
int oldstartres = this.startRes; |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
0 |
int lastColumn = getVisibleAlignmentWidth() - 1; |
167 |
0 |
if (!wrappedMode && (start > lastColumn)) |
168 |
|
{ |
169 |
0 |
startRes = Math.max(lastColumn, 0); |
170 |
|
} |
171 |
0 |
else if (start < 0) |
172 |
|
{ |
173 |
0 |
startRes = 0; |
174 |
|
} |
175 |
|
else |
176 |
|
{ |
177 |
0 |
startRes = start; |
178 |
|
} |
179 |
|
|
180 |
0 |
int oldendres = this.endRes; |
181 |
0 |
if (end < 0) |
182 |
|
{ |
183 |
0 |
endRes = 0; |
184 |
|
} |
185 |
0 |
else if (!wrappedMode && (end > lastColumn)) |
186 |
|
{ |
187 |
0 |
endRes = Math.max(lastColumn, 0); |
188 |
|
} |
189 |
|
else |
190 |
|
{ |
191 |
0 |
endRes = end; |
192 |
|
} |
193 |
0 |
return new int[] { oldstartres, oldendres }; |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
@param |
202 |
|
|
203 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
204 |
0 |
public void setStartSeq(int seq)... |
205 |
|
{ |
206 |
0 |
int startseq = seq; |
207 |
0 |
int height = getViewportHeight(); |
208 |
0 |
if (startseq + height - 1 > getVisibleAlignmentHeight() - 1) |
209 |
|
{ |
210 |
0 |
startseq = getVisibleAlignmentHeight() - height; |
211 |
|
} |
212 |
0 |
setStartEndSeq(startseq, startseq + height - 1); |
213 |
|
} |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@param |
221 |
|
|
222 |
|
@param |
223 |
|
|
224 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
225 |
0 |
public void setStartEndSeq(int start, int end)... |
226 |
|
{ |
227 |
|
|
228 |
|
|
229 |
0 |
int[] oldvalues = updateStartEndSeq(start, end); |
230 |
0 |
int oldstartseq = oldvalues[0]; |
231 |
0 |
int oldendseq = oldvalues[1]; |
232 |
|
|
233 |
0 |
changeSupport.firePropertyChange(STARTSEQ, oldstartseq, startSeq); |
234 |
0 |
if (oldstartseq == startSeq) |
235 |
|
{ |
236 |
|
|
237 |
|
|
238 |
0 |
changeSupport.firePropertyChange(ENDSEQ, oldendseq, endSeq); |
239 |
|
} |
240 |
|
} |
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
@param |
247 |
|
|
248 |
|
@param |
249 |
|
|
250 |
|
@return |
251 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 5 |
Complexity Density: 0.36 |
|
252 |
0 |
private int[] updateStartEndSeq(int start, int end)... |
253 |
|
{ |
254 |
0 |
int oldstartseq = this.startSeq; |
255 |
0 |
int visibleHeight = getVisibleAlignmentHeight(); |
256 |
0 |
if (start > visibleHeight - 1) |
257 |
|
{ |
258 |
0 |
startSeq = Math.max(visibleHeight - 1, 0); |
259 |
|
} |
260 |
0 |
else if (start < 0) |
261 |
|
{ |
262 |
0 |
startSeq = 0; |
263 |
|
} |
264 |
|
else |
265 |
|
{ |
266 |
0 |
startSeq = start; |
267 |
|
} |
268 |
|
|
269 |
0 |
int oldendseq = this.endSeq; |
270 |
0 |
if (end >= visibleHeight) |
271 |
|
{ |
272 |
0 |
endSeq = Math.max(visibleHeight - 1, 0); |
273 |
|
} |
274 |
0 |
else if (end < 0) |
275 |
|
{ |
276 |
0 |
endSeq = 0; |
277 |
|
} |
278 |
|
else |
279 |
|
{ |
280 |
0 |
endSeq = end; |
281 |
|
} |
282 |
0 |
return new int[] { oldstartseq, oldendseq }; |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
|
|
287 |
|
|
288 |
|
|
289 |
|
@param |
290 |
|
|
291 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
292 |
0 |
public void setEndSeq(int seq)... |
293 |
|
{ |
294 |
|
|
295 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
329 |
0 |
public int getStartRes()... |
330 |
|
{ |
331 |
0 |
return startRes; |
332 |
|
} |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
337 |
0 |
public int getEndRes()... |
338 |
|
{ |
339 |
0 |
return endRes; |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
345 |
0 |
public int getStartSeq()... |
346 |
|
{ |
347 |
0 |
return startSeq; |
348 |
|
} |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
353 |
0 |
public int getEndSeq()... |
354 |
|
{ |
355 |
0 |
return endSeq; |
356 |
|
} |
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
@param |
364 |
|
|
365 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
366 |
0 |
public void setViewportWidth(int w)... |
367 |
|
{ |
368 |
0 |
setStartEndRes(startRes, startRes + w - 1); |
369 |
|
} |
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
|
|
375 |
|
|
376 |
|
@param |
377 |
|
|
378 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
379 |
0 |
public void setViewportHeight(int h)... |
380 |
|
{ |
381 |
0 |
setStartEndSeq(startSeq, startSeq + h - 1); |
382 |
|
} |
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
|
@param |
390 |
|
|
391 |
|
@param |
392 |
|
|
393 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
394 |
0 |
public void setViewportStartAndWidth(int start, int w)... |
395 |
|
{ |
396 |
0 |
int vpstart = start; |
397 |
0 |
if (vpstart < 0) |
398 |
|
{ |
399 |
0 |
vpstart = 0; |
400 |
|
} |
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
0 |
if (!wrappedMode) |
406 |
|
{ |
407 |
0 |
if ((w <= getVisibleAlignmentWidth()) |
408 |
|
&& (vpstart + w - 1 > getVisibleAlignmentWidth() - 1)) |
409 |
|
{ |
410 |
0 |
vpstart = getVisibleAlignmentWidth() - w; |
411 |
|
} |
412 |
|
|
413 |
|
} |
414 |
0 |
setStartEndRes(vpstart, vpstart + w - 1); |
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
|
|
421 |
|
|
422 |
|
@param |
423 |
|
|
424 |
|
@param |
425 |
|
|
426 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
427 |
0 |
public void setViewportStartAndHeight(int start, int h)... |
428 |
|
{ |
429 |
0 |
int vpstart = start; |
430 |
|
|
431 |
0 |
int visHeight = getVisibleAlignmentHeight(); |
432 |
0 |
if (vpstart < 0) |
433 |
|
{ |
434 |
0 |
vpstart = 0; |
435 |
|
} |
436 |
0 |
else if (h <= visHeight && vpstart + h > visHeight) |
437 |
|
|
438 |
|
|
439 |
|
{ |
440 |
0 |
vpstart = visHeight - h; |
441 |
|
} |
442 |
|
|
443 |
|
|
444 |
|
|
445 |
|
|
446 |
0 |
setStartEndSeq(vpstart, vpstart + h - 1); |
447 |
|
} |
448 |
|
|
449 |
|
|
450 |
|
|
451 |
|
|
452 |
|
@return |
453 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
454 |
0 |
public int getViewportWidth()... |
455 |
|
{ |
456 |
0 |
return (endRes - startRes + 1); |
457 |
|
} |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
@return |
463 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
464 |
0 |
public int getViewportHeight()... |
465 |
|
{ |
466 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
558 |
0 |
public boolean scrollToWrappedVisible(int res)... |
559 |
|
{ |
560 |
0 |
int newStartRes = calcWrappedStartResidue(res); |
561 |
0 |
if (newStartRes == startRes) |
562 |
|
{ |
563 |
0 |
return false; |
564 |
|
} |
565 |
0 |
setStartRes(newStartRes); |
566 |
|
|
567 |
0 |
return true; |
568 |
|
} |
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
@param |
574 |
|
|
575 |
|
@return |
576 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
577 |
0 |
private int calcWrappedStartResidue(int res)... |
578 |
|
{ |
579 |
0 |
int oldStartRes = startRes; |
580 |
0 |
int width = getViewportWidth(); |
581 |
|
|
582 |
0 |
boolean up = res < oldStartRes; |
583 |
0 |
int widthsToScroll = Math.abs((res - oldStartRes) / width); |
584 |
0 |
if (up) |
585 |
|
{ |
586 |
0 |
widthsToScroll++; |
587 |
|
} |
588 |
|
|
589 |
0 |
int residuesToScroll = width * widthsToScroll; |
590 |
0 |
int newStartRes = up ? oldStartRes - residuesToScroll |
591 |
|
: oldStartRes + residuesToScroll; |
592 |
0 |
if (newStartRes < 0) |
593 |
|
{ |
594 |
0 |
newStartRes = 0; |
595 |
|
} |
596 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
736 |
0 |
public void setWrappedMode(boolean wrapped)... |
737 |
|
{ |
738 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
763 |
0 |
public int getWrappedScrollPosition(final int topLeftColumn)... |
764 |
|
{ |
765 |
0 |
int w = getViewportWidth(); |
766 |
|
|
767 |
|
|
768 |
|
|
769 |
|
|
770 |
0 |
int scroll = topLeftColumn / w; |
771 |
|
|
772 |
|
|
773 |
|
|
774 |
|
|
775 |
0 |
scroll += topLeftColumn % w > 0 ? 1 : 0; |
776 |
|
|
777 |
0 |
return scroll; |
778 |
|
} |
779 |
|
|
780 |
|
|
781 |
|
|
782 |
|
|
783 |
|
|
784 |
|
@param |
785 |
|
@return |
786 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
787 |
0 |
public int getWrappedMaxScroll(int topLeftColumn)... |
788 |
|
{ |
789 |
0 |
int scrollPosition = getWrappedScrollPosition(topLeftColumn); |
790 |
|
|
791 |
|
|
792 |
|
|
793 |
|
|
794 |
0 |
int columnsRemaining = getVisibleAlignmentWidth() - topLeftColumn; |
795 |
0 |
int width = getViewportWidth(); |
796 |
0 |
int widthsRemaining = columnsRemaining / width |
797 |
0 |
+ (columnsRemaining % width > 0 ? 1 : 0) - 1; |
798 |
0 |
int maxScroll = scrollPosition + widthsRemaining; |
799 |
|
|
800 |
0 |
return maxScroll; |
801 |
|
} |
802 |
|
} |