529 for (int i = 0; i < ncols; i++) {
530 SizeRequirements req = reqs[i];
531 req.preferred = Math.max(spans[i], req.preferred);
532 req.maximum = Math.max(req.preferred, req.maximum);
533 }
534 }
535
536 }
537
538 /**
539 * Fetches the child view that represents the given position in
540 * the model. This is implemented to walk through the children
541 * looking for a range that contains the given position. In this
542 * view the children do not necessarily have a one to one mapping
543 * with the child elements.
544 *
545 * @param pos the search position >= 0
546 * @param a the allocation to the table on entry, and the
547 * allocation of the view containing the position on exit
548 * @return the view representing the given position, or
549 * <code>null</code> if there isn't one
550 */
551 protected View getViewAtPosition(int pos, Rectangle a) {
552 int n = getViewCount();
553 for (int i = 0; i < n; i++) {
554 View v = getView(i);
555 int p0 = v.getStartOffset();
556 int p1 = v.getEndOffset();
557 if ((pos >= p0) && (pos < p1)) {
558 // it's in this view.
559 if (a != null) {
560 childAllocation(i, a);
561 }
562 return v;
563 }
564 }
565 if (pos == getEndOffset()) {
566 View v = getView(n - 1);
567 if (a != null) {
568 this.childAllocation(n - 1, a);
569 }
742 *
743 * @param axis may be either View.X_AXIS or View.Y_AXIS
744 * @return the resize weight
745 * @exception IllegalArgumentException for an invalid axis
746 */
747 public int getResizeWeight(int axis) {
748 return 1;
749 }
750
751 /**
752 * Fetches the child view that represents the given position in
753 * the model. This is implemented to walk through the children
754 * looking for a range that contains the given position. In this
755 * view the children do not necessarily have a one to one mapping
756 * with the child elements.
757 *
758 * @param pos the search position >= 0
759 * @param a the allocation to the table on entry, and the
760 * allocation of the view containing the position on exit
761 * @return the view representing the given position, or
762 * <code>null</code> if there isn't one
763 */
764 protected View getViewAtPosition(int pos, Rectangle a) {
765 int n = getViewCount();
766 for (int i = 0; i < n; i++) {
767 View v = getView(i);
768 int p0 = v.getStartOffset();
769 int p1 = v.getEndOffset();
770 if ((pos >= p0) && (pos < p1)) {
771 // it's in this view.
772 if (a != null) {
773 childAllocation(i, a);
774 }
775 return v;
776 }
777 }
778 if (pos == getEndOffset()) {
779 View v = getView(n - 1);
780 if (a != null) {
781 this.childAllocation(n - 1, a);
782 }
|
529 for (int i = 0; i < ncols; i++) {
530 SizeRequirements req = reqs[i];
531 req.preferred = Math.max(spans[i], req.preferred);
532 req.maximum = Math.max(req.preferred, req.maximum);
533 }
534 }
535
536 }
537
538 /**
539 * Fetches the child view that represents the given position in
540 * the model. This is implemented to walk through the children
541 * looking for a range that contains the given position. In this
542 * view the children do not necessarily have a one to one mapping
543 * with the child elements.
544 *
545 * @param pos the search position >= 0
546 * @param a the allocation to the table on entry, and the
547 * allocation of the view containing the position on exit
548 * @return the view representing the given position, or
549 * {@code null} if there isn't one
550 */
551 protected View getViewAtPosition(int pos, Rectangle a) {
552 int n = getViewCount();
553 for (int i = 0; i < n; i++) {
554 View v = getView(i);
555 int p0 = v.getStartOffset();
556 int p1 = v.getEndOffset();
557 if ((pos >= p0) && (pos < p1)) {
558 // it's in this view.
559 if (a != null) {
560 childAllocation(i, a);
561 }
562 return v;
563 }
564 }
565 if (pos == getEndOffset()) {
566 View v = getView(n - 1);
567 if (a != null) {
568 this.childAllocation(n - 1, a);
569 }
742 *
743 * @param axis may be either View.X_AXIS or View.Y_AXIS
744 * @return the resize weight
745 * @exception IllegalArgumentException for an invalid axis
746 */
747 public int getResizeWeight(int axis) {
748 return 1;
749 }
750
751 /**
752 * Fetches the child view that represents the given position in
753 * the model. This is implemented to walk through the children
754 * looking for a range that contains the given position. In this
755 * view the children do not necessarily have a one to one mapping
756 * with the child elements.
757 *
758 * @param pos the search position >= 0
759 * @param a the allocation to the table on entry, and the
760 * allocation of the view containing the position on exit
761 * @return the view representing the given position, or
762 * {@code null} if there isn't one
763 */
764 protected View getViewAtPosition(int pos, Rectangle a) {
765 int n = getViewCount();
766 for (int i = 0; i < n; i++) {
767 View v = getView(i);
768 int p0 = v.getStartOffset();
769 int p1 = v.getEndOffset();
770 if ((pos >= p0) && (pos < p1)) {
771 // it's in this view.
772 if (a != null) {
773 childAllocation(i, a);
774 }
775 return v;
776 }
777 }
778 if (pos == getEndOffset()) {
779 View v = getView(n - 1);
780 if (a != null) {
781 this.childAllocation(n - 1, a);
782 }
|