Hi Tom, On Thu, 2006-07-13 at 15:30 -0400, Thomas Fitzsimmons wrote: > Darn, I didn't realize this was actually called from within GridBagLayout. > For > now, let's revert to Sven's version of the patch (to the detriment of the > Mauve > results, but to the benefit of JDialog) since I may not have time to look at > this soon. Likely the problem is duplication of logic in AdjustForGravity > and > ArrangeGrid.
OK, I reverted the implementation for now:
2006-07-14 Mark Wielaard <[EMAIL PROTECTED]>
Revert to previous implementation.
* java/awt/GridBagLayout.java (AdjustForGravity): Only adjust for
constraints insets.
This was one of the showstoppers for creating a release branch. If I
don't find anything else really bad I hope to create that this weekend.
Cheers,
Mark
Index: java/awt/GridBagLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/GridBagLayout.java,v
retrieving revision 1.30
diff -u -r1.30 GridBagLayout.java
--- java/awt/GridBagLayout.java 18 Jun 2006 18:56:44 -0000 1.30
+++ java/awt/GridBagLayout.java 14 Jul 2006 21:54:52 -0000
@@ -1,5 +1,5 @@
/* GridBagLayout - Layout manager for components according to GridBagConstraints
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -330,117 +330,14 @@
protected void AdjustForGravity (GridBagConstraints constraints,
Rectangle r)
{
- Rectangle result = new Rectangle (0, 0, 0, 0);
-
- // Calculate width and height.
-
- // Adjust width and height for fill value.
- switch (constraints.fill)
- {
- case GridBagConstraints.NONE:
- result.width = 0;
- result.height = 0;
- break;
- case GridBagConstraints.BOTH:
- result.width = r.width;
- result.height = r.height;
- break;
- case GridBagConstraints.HORIZONTAL:
- result.width = r.width;
- result.height = 0;
- break;
- case GridBagConstraints.VERTICAL:
- result.width = 0;
- result.height = r.height;
- break;
- }
-
- // Adjust width and height for insets, and clamp to minimum
- // values of ipadx and ipady.
- result.width = Math.max(result.width
- - constraints.insets.left
- - constraints.insets.right,
- constraints.ipadx);
- result.height = Math.max(result.height
- - constraints.insets.top
- - constraints.insets.bottom,
- constraints.ipady);
-
- // Calculate x and y.
-
- // Do not account for the internal padding when setting the
- // result rectangle's x and y co-ordinates.
- int rect_width = r.width - constraints.ipadx;
- int rect_height = r.height - constraints.ipady;
-
- int half_width = (rect_width + constraints.insets.left
- - constraints.insets.right) / 2;
- int half_height = (rect_height + constraints.insets.top
- - constraints.insets.bottom) / 2;
-
- // Adjust x and y for anchor value.
- switch (constraints.anchor)
- {
- case GridBagConstraints.CENTER:
- result.x = r.x + half_width;
- result.y = r.y + half_height;
- break;
- case GridBagConstraints.NORTH:
- result.x = r.x + half_width;
- result.y = r.y + constraints.insets.top;
- break;
- case GridBagConstraints.NORTHEAST:
- result.x = r.x + rect_width - constraints.insets.right;
- result.y = r.y + constraints.insets.top;
- break;
- case GridBagConstraints.EAST:
- result.x = r.x + rect_width - constraints.insets.right;
- result.y = r.y + half_height;
- break;
- case GridBagConstraints.SOUTHEAST:
- result.x = r.x + rect_width - constraints.insets.right;
- result.y = r.y + rect_height - constraints.insets.bottom;
- break;
- case GridBagConstraints.SOUTH:
- result.x = r.x + half_width;
- result.y = r.y + rect_height - constraints.insets.bottom;
- break;
- case GridBagConstraints.SOUTHWEST:
- result.x = r.x + constraints.insets.left;
- result.y = r.y + rect_height - constraints.insets.bottom;
- break;
- case GridBagConstraints.WEST:
- result.x = r.x + constraints.insets.left;
- result.y = r.y + half_height;
- break;
- case GridBagConstraints.NORTHWEST:
- result.x = r.x + constraints.insets.left;
- result.y = r.y + constraints.insets.top;
- break;
- }
-
- // Adjust x and y for fill, clamping values to the external
- // padding boundaries where necessary.
- switch (constraints.fill)
- {
- case GridBagConstraints.NONE:
- break;
- case GridBagConstraints.BOTH:
- result.x = r.x + constraints.insets.left;
- result.y = r.y + constraints.insets.top;
- break;
- case GridBagConstraints.HORIZONTAL:
- result.x = r.x + constraints.insets.left;
- break;
- case GridBagConstraints.VERTICAL:
- result.y = r.y + constraints.insets.top;
- break;
- }
-
- r.x = result.x;
- r.y = result.y;
- r.width = result.width;
- r.height = result.height;
+ Insets insets = constraints.insets;
+ if (insets != null)
+ {
+ r.x += insets.left;
+ r.y += insets.top;
+ r.width -= insets.left + insets.right;
+ r.height -= insets.top + insets.bottom;
+ }
}
/**
signature.asc
Description: This is a digitally signed message part
