This fixes the maximumSize regression from yesterday, and cleans up the validateTree() method a little.

2006-08-23  Roman Kennke  <[EMAIL PROTECTED]>

        * java/awt/Container.java
        (maxSize): Removed field. This is already declared in Component.
        (validateTree): Check for ContainerPeer. Don't addNotify here.
        Only validate Component instances if they are invalid.

/Roman
Index: java/awt/Container.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.103
diff -u -1 -2 -r1.103 Container.java
--- java/awt/Container.java	28 Jul 2006 10:07:39 -0000	1.103
+++ java/awt/Container.java	23 Aug 2006 14:22:46 -0000
@@ -77,26 +77,24 @@
 public class Container extends Component
 {
   /**
    * Compatible with JDK 1.0+.
    */
   private static final long serialVersionUID = 4613797578919906343L;
 
   /* Serialized fields from the serialization spec. */
   int ncomponents;
   Component[] component;
   LayoutManager layoutMgr;
 
-  Dimension maxSize;
-
   /**
    * @since 1.4
    */
   boolean focusCycleRoot;
 
   /**
    * Indicates if this container provides a focus traversal policy.
    *
    * @since 1.5
    */
   private boolean focusTraversalPolicyProvider;
 
@@ -643,63 +641,57 @@
   }
 
   /**
    * Recursively validates the container tree, recomputing any invalid
    * layouts.
    */
   protected void validateTree()
   {
     if (valid)
       return;
 
     ContainerPeer cPeer = null;
-    if (peer != null && ! (peer instanceof LightweightPeer))
+    if (peer instanceof ContainerPeer)
       {
         cPeer = (ContainerPeer) peer;
         cPeer.beginValidate();
       }
 
-    for (int i = 0; i < ncomponents; ++i)
-      {
-        Component comp = component[i];
-
-        if (comp.getPeer () == null)
-          comp.addNotify();
-      }
-
     doLayout ();
     for (int i = 0; i < ncomponents; ++i)
       {
         Component comp = component[i];
 
-        if (! comp.isValid())
+        if (comp instanceof Container && ! (comp instanceof Window)
+            && ! comp.valid)
           {
-            if (comp instanceof Container)
-              {
-                ((Container) comp).validateTree();
-              }
-            else
-              {
-                component[i].validate();
-              }
+            ((Container) comp).validateTree();
+          }
+        else
+          {
+            comp.validate();
           }
       }
 
+    if (peer instanceof ContainerPeer)
+      {
+        cPeer = (ContainerPeer) peer;
+        cPeer.endValidate();
+      }
+
     /* children will call invalidate() when they are layed out. It
        is therefore important that valid is not set to true
        until after the children have been layed out. */
     valid = true;
 
-    if (cPeer != null)
-      cPeer.endValidate();
   }
 
   public void setFont(Font f)
   {
     if( (f != null && (font == null || !font.equals(f)))
         || f == null)
       {
         super.setFont(f);
         // FIXME: Although it might make more sense to invalidate only
         // those children whose font == null, Sun invalidates all children.
         // So we'll do the same.
         invalidateTree();

Reply via email to