594 |
for (int i = 0; i < count; ++i) |
for (int i = 0; i < count; ++i) |
595 |
getView(i).dump(indent + 1); |
getView(i).dump(indent + 1); |
596 |
} |
} |
597 |
|
|
598 |
|
/** |
599 |
|
* Returns the document position that is (visually) nearest to the given |
600 |
|
* document position <code>pos</code> in the given direction <code>d</code>. |
601 |
|
* |
602 |
|
* @param pos the document position |
603 |
|
* @param b the bias for <code>pos</code> |
604 |
|
* @param a the allocation for this view |
605 |
|
* @param d the direction, must be either {@link SwingConstants#NORTH}, |
606 |
|
* {@link SwingConstants#SOUTH}, {@link SwingConstants#WEST} or |
607 |
|
* {@link SwingConstants#EAST} |
608 |
|
* @param biasRet an array of {@link Position.Bias} that can hold at least |
609 |
|
* one element, which is filled with the bias of the return position |
610 |
|
* on method exit |
611 |
|
* |
612 |
|
* @return the document position that is (visually) nearest to the given |
613 |
|
* document position <code>pos</code> in the given direction |
614 |
|
* <code>d</code> |
615 |
|
* |
616 |
|
* @throws BadLocationException if <code>pos</code> is not a valid offset in |
617 |
|
* the document model |
618 |
|
* @throws IllegalArgumentException if <code>d</code> is not a valid direction |
619 |
|
*/ |
620 |
|
public int getNextVisualPositionFrom(int pos, Position.Bias b, |
621 |
|
Shape a, int d, |
622 |
|
Position.Bias[] biasRet) |
623 |
|
throws BadLocationException |
624 |
|
{ |
625 |
|
int ret = pos; |
626 |
|
switch (d) |
627 |
|
{ |
628 |
|
case WEST: |
629 |
|
ret = pos - 1; |
630 |
|
break; |
631 |
|
case EAST: |
632 |
|
ret = pos + 1; |
633 |
|
break; |
634 |
|
case NORTH: |
635 |
|
// TODO: Implement this |
636 |
|
break; |
637 |
|
case SOUTH: |
638 |
|
// TODO: Implement this |
639 |
|
break; |
640 |
|
default: |
641 |
|
throw new IllegalArgumentException("Illegal value for d"); |
642 |
|
} |
643 |
|
return ret; |
644 |
|
} |
645 |
} |
} |