diff options
| author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-18 00:59:33 +0000 |
|---|---|---|
| committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-18 00:59:33 +0000 |
| commit | 15d27402f51cf831d82aa31271f5c01855b4f2cf (patch) | |
| tree | 4c44aaa3ed1ee1b4f15732664c05cfc9214e1fa9 /libjava/classpath/javax/swing/text/BoxView.java | |
| parent | 820206ad46c6fc0131d5771ec1051267022e875d (diff) | |
| download | gcc-15d27402f51cf831d82aa31271f5c01855b4f2cf.tar.gz | |
Imported GNU Classpath gcj-import-20051117.
* gnu/java/net/protocol/file/Connection.java: Removed, fully merged.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107153 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/swing/text/BoxView.java')
| -rw-r--r-- | libjava/classpath/javax/swing/text/BoxView.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/libjava/classpath/javax/swing/text/BoxView.java b/libjava/classpath/javax/swing/text/BoxView.java index f201045dbdb..5c9587dfe5d 100644 --- a/libjava/classpath/javax/swing/text/BoxView.java +++ b/libjava/classpath/javax/swing/text/BoxView.java @@ -476,7 +476,6 @@ public class BoxView protected View getViewAtPoint(int x, int y, Rectangle r) { View result = null; - int count = getViewCount(); Rectangle copy = new Rectangle(r); @@ -490,7 +489,9 @@ public class BoxView break; } } - + + if (result == null && count > 0) + return getView(count - 1); return result; } @@ -498,10 +499,12 @@ public class BoxView * Computes the allocation for a child <code>View</code>. The parameter * <code>a</code> stores the allocation of this <code>CompositeView</code> * and is then adjusted to hold the allocation of the child view. - * - * @param index the index of the child <code>View</code> - * @param a the allocation of this <code>CompositeView</code> before the - * call, the allocation of the child on exit + * + * @param index + * the index of the child <code>View</code> + * @param a + * the allocation of this <code>CompositeView</code> before the + * call, the allocation of the child on exit */ protected void childAllocation(int index, Rectangle a) { @@ -737,4 +740,22 @@ public class BoxView 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); + } } |
