The last missing 1.1 method! ;)
AFAICT, all it does is the adjusting for insets. If someone finds
anything else they can of course file a bug report, although it seems
pretty unlikely.
2006-06-18 Sven de Marothy <[EMAIL PROTECTED]>
* java/awt/GridBagLayout.java (AdjustForGravity): Implement.
* java/awt/font/TextMeasurer.java: Fix copyright date,
remove commented-out code.
Index: java/awt/GridBagLayout.java
===================================================================
RCS file: /sources/classpath/classpath/java/awt/GridBagLayout.java,v
retrieving revision 1.28
diff -U3 -r1.28 GridBagLayout.java
--- java/awt/GridBagLayout.java 22 Mar 2006 19:15:24 -0000 1.28
+++ java/awt/GridBagLayout.java 18 Jun 2006 02:19:46 -0000
@@ -321,15 +321,21 @@
return new Point (col, row);
}
- /**
- * Obsolete.
- */
- protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect)
- throws NotImplementedException
- {
- // FIXME
- throw new Error ("Not implemented");
- }
+ /**
+ * Obsolete.
+ */
+ protected void AdjustForGravity (GridBagConstraints constraints,
+ Rectangle rect)
+ {
+ Insets insets = constraints.insets;
+ if (insets != null)
+ {
+ rect.x += insets.left;
+ rect.y += insets.top;
+ rect.width -= insets.left + insets.right;
+ rect.height -= insets.top + insets.bottom;
+ }
+ }
/**
* Obsolete.
@@ -353,10 +359,9 @@
// layoutInfo. So we wait until after this for loop to set
// layoutInfo.
Component lastComp = null;
- int cellx = 0;
- int celly = 0;
- int cellw = 0;
- int cellh = 0;
+
+ Rectangle cell = new Rectangle();
+
for (int i = 0; i < components.length; i++)
{
Component component = components[i];
@@ -370,29 +375,23 @@
if (lastComp != null
&& constraints.gridheight == GridBagConstraints.REMAINDER)
- celly += cellh;
+ cell.y += cell.height;
else
- celly = sumIntArray(info.rowHeights, constraints.gridy);
+ cell.y = sumIntArray(info.rowHeights, constraints.gridy);
if (lastComp != null
&& constraints.gridwidth == GridBagConstraints.REMAINDER)
- cellx += cellw;
+ cell.x += cell.width;
else
- cellx = sumIntArray(info.colWidths, constraints.gridx);
+ cell.x = sumIntArray(info.colWidths, constraints.gridx);
- cellw = sumIntArray(info.colWidths, constraints.gridx
- + constraints.gridwidth) - cellx;
- cellh = sumIntArray(info.rowHeights, constraints.gridy
- + constraints.gridheight) - celly;
-
- Insets insets = constraints.insets;
- if (insets != null)
- {
- cellx += insets.left;
- celly += insets.top;
- cellw -= insets.left + insets.right;
- cellh -= insets.top + insets.bottom;
- }
+ cell.width = sumIntArray(info.colWidths, constraints.gridx
+ + constraints.gridwidth) - cell.x;
+ cell.height = sumIntArray(info.rowHeights, constraints.gridy
+ + constraints.gridheight) -
cell.y;
+
+ // Adjust for insets.
+ AdjustForGravity( constraints, cell );
// Note: Documentation says that padding is added on both sides, but
// visual inspection shows that the Sun implementation only adds it
@@ -403,14 +402,14 @@
switch (constraints.fill)
{
case GridBagConstraints.HORIZONTAL:
- dim.width = cellw;
+ dim.width = cell.width;
break;
case GridBagConstraints.VERTICAL:
- dim.height = cellh;
+ dim.height = cell.height;
break;
case GridBagConstraints.BOTH:
- dim.width = cellw;
- dim.height = cellh;
+ dim.width = cell.width;
+ dim.height = cell.height;
break;
}
@@ -420,40 +419,40 @@
switch (constraints.anchor)
{
case GridBagConstraints.NORTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly;
+ x = cell.x + (cell.width - dim.width) / 2;
+ y = cell.y;
break;
case GridBagConstraints.SOUTH:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + cellh - dim.height;
+ x = cell.x + (cell.width - dim.width) / 2;
+ y = cell.y + cell.height - dim.height;
break;
case GridBagConstraints.WEST:
- x = cellx;
- y = celly + (cellh - dim.height) / 2;
+ x = cell.x;
+ y = cell.y + (cell.height - dim.height) / 2;
break;
case GridBagConstraints.EAST:
- x = cellx + cellw - dim.width;
- y = celly + (cellh - dim.height) / 2;
+ x = cell.x + cell.width - dim.width;
+ y = cell.y + (cell.height - dim.height) / 2;
break;
case GridBagConstraints.NORTHEAST:
- x = cellx + cellw - dim.width;
- y = celly;
+ x = cell.x + cell.width - dim.width;
+ y = cell.y;
break;
case GridBagConstraints.NORTHWEST:
- x = cellx;
- y = celly;
+ x = cell.x;
+ y = cell.y;
break;
case GridBagConstraints.SOUTHEAST:
- x = cellx + cellw - dim.width;
- y = celly + cellh - dim.height;
+ x = cell.x + cell.width - dim.width;
+ y = cell.y + cell.height - dim.height;
break;
case GridBagConstraints.SOUTHWEST:
- x = cellx;
- y = celly + cellh - dim.height;
+ x = cell.x;
+ y = cell.y + cell.height - dim.height;
break;
default:
- x = cellx + (cellw - dim.width) / 2;
- y = celly + (cellh - dim.height) / 2;
+ x = cell.x + (cell.width - dim.width) / 2;
+ y = cell.y + (cell.height - dim.height) / 2;
break;
}
component.setBounds(info.pos_x + x, info.pos_y + y, dim.width,
Index: java/awt/font/TextMeasurer.java
===================================================================
RCS file: /sources/classpath/classpath/java/awt/font/TextMeasurer.java,v
retrieving revision 1.4
diff -U3 -r1.4 TextMeasurer.java
--- java/awt/font/TextMeasurer.java 18 Jun 2006 00:54:47 -0000 1.4
+++ java/awt/font/TextMeasurer.java 18 Jun 2006 02:19:46 -0000
@@ -1,5 +1,5 @@
/* TextMeasurer.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -128,10 +128,6 @@
*/
public TextLayout getLayout (int start, int limit)
{
-// AttributedCharacterIterator aci = (new AttributedString( text,
-// start, limit
-// ) ).getIterator();
-// return new TextLayout( aci, frc );
return new TextLayout( totalLayout, start, limit );
}