307 |
{ |
{ |
308 |
copy.setBounds(inside); |
copy.setBounds(inside); |
309 |
childAllocation(i, copy); |
childAllocation(i, copy); |
310 |
if (!copy.isEmpty()) |
if (!copy.isEmpty() |
311 |
|
&& g.hitClip(copy.x, copy.y, copy.width, copy.height)) |
312 |
paintChild(g, copy, i); |
paintChild(g, copy, i); |
313 |
} |
} |
314 |
} |
} |
476 |
protected View getViewAtPoint(int x, int y, Rectangle r) |
protected View getViewAtPoint(int x, int y, Rectangle r) |
477 |
{ |
{ |
478 |
View result = null; |
View result = null; |
|
|
|
479 |
int count = getViewCount(); |
int count = getViewCount(); |
480 |
Rectangle copy = new Rectangle(r); |
Rectangle copy = new Rectangle(r); |
481 |
|
|
489 |
break; |
break; |
490 |
} |
} |
491 |
} |
} |
492 |
|
|
493 |
|
if (result == null && count > 0) |
494 |
|
return getView(count - 1); |
495 |
return result; |
return result; |
496 |
} |
} |
497 |
|
|
499 |
* Computes the allocation for a child <code>View</code>. The parameter |
* Computes the allocation for a child <code>View</code>. The parameter |
500 |
* <code>a</code> stores the allocation of this <code>CompositeView</code> |
* <code>a</code> stores the allocation of this <code>CompositeView</code> |
501 |
* and is then adjusted to hold the allocation of the child view. |
* and is then adjusted to hold the allocation of the child view. |
502 |
* |
* |
503 |
* @param index the index of the child <code>View</code> |
* @param index |
504 |
* @param a the allocation of this <code>CompositeView</code> before the |
* the index of the child <code>View</code> |
505 |
* call, the allocation of the child on exit |
* @param a |
506 |
|
* the allocation of this <code>CompositeView</code> before the |
507 |
|
* call, the allocation of the child on exit |
508 |
*/ |
*/ |
509 |
protected void childAllocation(int index, Rectangle a) |
protected void childAllocation(int index, Rectangle a) |
510 |
{ |
{ |
740 |
yLayoutValid = false; |
yLayoutValid = false; |
741 |
super.preferenceChanged(child, width, height); |
super.preferenceChanged(child, width, height); |
742 |
} |
} |
743 |
|
|
744 |
|
/** |
745 |
|
* Maps the document model position <code>pos</code> to a Shape |
746 |
|
* in the view coordinate space. This method overrides CompositeView's |
747 |
|
* method to make sure the children are allocated properly before |
748 |
|
* calling the super's behaviour. |
749 |
|
*/ |
750 |
|
public Shape modelToView(int pos, Shape a, Position.Bias bias) |
751 |
|
throws BadLocationException |
752 |
|
{ |
753 |
|
// Make sure everything is allocated properly and then call super |
754 |
|
if (!isAllocationValid()) |
755 |
|
{ |
756 |
|
Rectangle bounds = a.getBounds(); |
757 |
|
setSize(bounds.width, bounds.height); |
758 |
|
} |
759 |
|
return super.modelToView(pos, a, bias); |
760 |
|
} |
761 |
} |
} |