]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed Panel border detection
authorArtur Signell <artur.signell@itmill.com>
Tue, 21 Oct 2008 12:14:59 +0000 (12:14 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 21 Oct 2008 12:14:59 +0000 (12:14 +0000)
svn changeset:5684/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java

index 546d481ec54d538225698311978dc7e5cec4d7bb..7302724899b1be711d1bb411335e70a097d48027 100644 (file)
@@ -453,32 +453,19 @@ public class IPanel extends SimplePanel implements Container,
         // TODO
     }
 
-    private RenderSpace contentNodeSize;
-
     public RenderSpace getAllocatedSpace(Widget child) {
-        if (contentNodeSize == null) {
-            contentNodeSize = new RenderSpace(-1, -1) {
-
-                @Override
-                public int getHeight() {
-                    return contentNode.getOffsetHeight()
-                            - getContainerBorderHeight();
-                }
+        int w = 0;
+        int h = 0;
 
-                @Override
-                public int getWidth() {
-                    return contentNode.getOffsetWidth()
-                            - getContainerBorderWidth();
-                }
-
-                @Override
-                public int getScrollbarSize() {
-                    return Util.getNativeScrollbarSize();
-                }
+        if (width != null && !width.equals("")) {
+            w = getOffsetWidth() - getContainerBorderWidth();
+        }
 
-            };
+        if (height != null && !height.equals("")) {
+            w = getOffsetHeight() - getContainerBorderHeight();
         }
-        return contentNodeSize;
+
+        return new RenderSpace(w, h);
     }
 
     public boolean requestLayout(Set<Paintable> child) {
@@ -497,4 +484,10 @@ public class IPanel extends SimplePanel implements Container,
         // NOP: layouts caption, errors etc not rendered in Panel
     }
 
+    @Override
+    protected void onAttach() {
+        super.onAttach();
+        detectContainerBorders();
+    }
+
 }