[kaffe] CVS kaffe (robilad): resynced with gnu classpath: swing fix
Kaffe CVS
cvs-commits at kaffe.org
Sun May 15 10:48:59 PDT 2005
PatchSet 6516
Date: 2005/05/15 17:30:08
Author: robilad
Branch: HEAD
Tag: (none)
Log:
resynced with gnu classpath: swing fix
2005-05-15 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-05-06 Roman Kennke <roman at kennke.org>
* javax/swing/text/PlainView.java
(getPreferredSpan): Corrected the calculation of the span of
the view.
Members:
ChangeLog:1.4042->1.4043
libraries/javalib/javax/swing/text/PlainView.java:1.6->1.7
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4042 kaffe/ChangeLog:1.4043
--- kaffe/ChangeLog:1.4042 Sun May 15 17:25:03 2005
+++ kaffe/ChangeLog Sun May 15 17:30:08 2005
@@ -2,6 +2,16 @@
Resynced with GNU Classpath.
+ 2005-05-06 Roman Kennke <roman at kennke.org>
+
+ * javax/swing/text/PlainView.java
+ (getPreferredSpan): Corrected the calculation of the span of
+ the view.
+
+2005-05-15 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
+
2005-05-04 Mark Wielaard <mark at klomp.org>
* java/awt/BufferCapabilities.java (BufferCapabilities): Make
Index: kaffe/libraries/javalib/javax/swing/text/PlainView.java
diff -u kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.6 kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.7
--- kaffe/libraries/javalib/javax/swing/text/PlainView.java:1.6 Sun May 15 17:16:05 2005
+++ kaffe/libraries/javalib/javax/swing/text/PlainView.java Sun May 15 17:30:12 2005
@@ -200,7 +200,42 @@
if (axis != X_AXIS && axis != Y_AXIS)
throw new IllegalArgumentException();
- return 10;
+ // make sure we have the metrics
+ updateMetrics();
+
+ float span = 0;
+ Element el = getElement();
+ Document doc = el.getDocument();
+ Segment seg = new Segment();
+
+ switch (axis)
+ {
+ case X_AXIS:
+ // calculate the maximum of the line's widths
+ for (int i = 0; i < el.getElementCount(); i++)
+ {
+ Element child = el.getElement(i);
+ int start = child.getStartOffset();
+ int end = child.getEndOffset();
+ try {
+ doc.getText(start, start + end, seg);
+ }
+ catch (BadLocationException ex)
+ {
+ // throw new ClasspathAssertionError
+ // ("no BadLocationException should be thrown here");
+ }
+ int width = metrics.charsWidth(seg.array, seg.offset, seg.count);
+ span = Math.max(span, width);
+ }
+ break;
+ case Y_AXIS:
+ default:
+ span = metrics.getHeight() * el.getElementCount();
+ break;
+ }
+
+ return span;
}
}
More information about the kaffe
mailing list