]> source.dussan.org Git - vaadin-framework.git/commitdiff
Update test and code to handle nested coordinatelayouts
authorRisto Yrjänä <risto.yrjana@itmill.com>
Thu, 2 Oct 2008 12:31:24 +0000 (12:31 +0000)
committerRisto Yrjänä <risto.yrjana@itmill.com>
Thu, 2 Oct 2008 12:31:24 +0000 (12:31 +0000)
svn changeset:5585/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/ICoordinateLayout.java
src/com/itmill/toolkit/tests/tickets/Ticket1267.java

index 233f30f5a2dde0403bcb690bc3b114ae3ada096c..3588333dc4f57eb93ed7e59ad3687de2b567947d 100644 (file)
@@ -192,7 +192,7 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
         componentList.addAll(newComponents);
 
         // Make sure coordinateLayout gets done every time
-        iLayout(-1, -1);
+        iLayout();
 
     }// updateFromUIDL
 
@@ -200,10 +200,9 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
      * (non-Javadoc)
      * 
      * @see
-     * com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener#iLayout
-     * (int, int)
+     * com.itmill.toolkit.terminal.gwt.client.ContainerResizedListener#iLayout()
      */
-    public void iLayout(int availableWidth, int availableHeight) {
+    public void iLayout() {
         // shake
         // TODO is this necessary?
         getOffsetWidth();
@@ -221,9 +220,6 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
 
         if (!toUpdate.isEmpty()) {
 
-            // Run layout functions for children
-            client.runDescendentsLayout(this);
-
             // Go over all children and calculate their positions
             for (Iterator<Widget> componentIterator = toUpdate.iterator(); componentIterator
                     .hasNext();) {
@@ -342,6 +338,9 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
                     updateCaptionPosition(componentMarker, componentWidget);
                 }
             }
+
+            // Run layout functions for children
+            client.runDescendentsLayout(this);
         }
 
         toUpdate.clear();
@@ -869,8 +868,8 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
      * @return
      */
     protected native String getMargin(Element e, String CSSProp)/*-{
-                                                                                                                                                                                                                                                                                                                                                                                                                            return $wnd.getComputedStyle(e,null).getPropertyValue(CSSProp);
-                                                                                                                                                                                                                                                                                                                                                                                                                            }-*/;
+                                                                                                                                                                                                                                                                                                                                                                                                                                                    return $wnd.getComputedStyle(e,null).getPropertyValue(CSSProp);
+                                                                                                                                                                                                                                                                                                                                                                                                                                                    }-*/;
 
     /**
      * Retrieves margin info in IE
@@ -879,8 +878,8 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
      * @return
      */
     protected native String getIEMargin(Element e)/*-{ 
-                                                                                                                                                                                                                                                                                                                                                                                                                            return e.currentStyle.margin;
-                                                                                                                                                                                                                                                                                                                                                                                                                            }-*/;
+                                                                                                                                                                                                                                                                                                                                                                                                                                                    return e.currentStyle.margin;
+                                                                                                                                                                                                                                                                                                                                                                                                                                                    }-*/;
 
     /**
      * @return all components that are not captions
@@ -895,6 +894,19 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
         return list;
     }
 
+    public boolean requestLayout(Set<Paintable> child) {
+        return true;
+    }
+
+    public Size getAllocatedSpace(Widget child) {
+        Element area = componentToArea.get(child);
+        if (area != null) {
+            return new Size(area.getOffsetWidth(), area.getOffsetHeight());
+        } else {
+            return new Size(layout[WIDTH], layout[HEIGHT]);
+        }
+    }
+
     /*
      * Widget methods
      */
@@ -1143,23 +1155,4 @@ public class ICoordinateLayout extends ComplexPanel implements Container,
         }
     }
 
-    public Size getAllocatedSpace(Widget child) {
-        Element area = componentToArea.get(child);
-        if (area != null) {
-            return new Size(area.getOffsetWidth(), area.getOffsetHeight());
-        } else {
-            return new Size(layout[WIDTH], layout[HEIGHT]);
-        }
-    }
-
-    public boolean requestLayout(Set<Paintable> child) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    public void iLayout() {
-        // TODO Auto-generated method stub
-
-    }
-
 }// class ICoordinateLayout
index 4c022b71552962fb22d9d9dd361d153609d57bad..8df45709b63979ba8c9eec8f84fce507aa9db973 100644 (file)
@@ -89,14 +89,6 @@ public class Ticket1267 extends Application {
         final Coordinates xy = new Coordinates("0,0");
 
         testField.addListener(new ValueChangeListener() {
-
-            /*
-             * (non-Javadoc)
-             * 
-             * @see
-             * com.itmill.toolkit.data.Property.ValueChangeListener#valueChange
-             * (com.itmill.toolkit.data.Property.ValueChangeEvent)
-             */
             public void valueChange(ValueChangeEvent event) {
                 String str = (String) event.getProperty().getValue();
                 try {