BoxView was using CompositeView's modelToView method, but it really should override it and make sure the children are allocated first, otherwise you'll get BadLocationError. This matches what the docs say to do and it eliminates a bunch of AssertionErrors.
2005-11-17 Anthony Balkissoon <[EMAIL PROTECTED]> * javax/swing/text/BoxView.java: (modelToView): New API method. --Tony
Index: javax/swing/text/BoxView.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/text/BoxView.java,v retrieving revision 1.11 diff -u -r1.11 BoxView.java --- javax/swing/text/BoxView.java 17 Nov 2005 20:45:13 -0000 1.11 +++ javax/swing/text/BoxView.java 17 Nov 2005 20:55:10 -0000 @@ -740,4 +740,22 @@ yLayoutValid = false; super.preferenceChanged(child, width, height); } + + /** + * Maps the document model position <code>pos</code> to a Shape + * in the view coordinate space. This method overrides CompositeView's + * method to make sure the children are allocated properly before + * calling the super's behaviour. + */ + public Shape modelToView(int pos, Shape a, Position.Bias bias) + throws BadLocationException + { + // Make sure everything is allocated properly and then call super + if (!isAllocationValid()) + { + Rectangle bounds = a.getBounds(); + setSize(bounds.width, bounds.height); + } + return super.modelToView(pos, a, bias); + } }
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches