]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #2270 - TabSheet content height
authorArtur Signell <artur.signell@itmill.com>
Tue, 2 Dec 2008 14:26:24 +0000 (14:26 +0000)
committerArtur Signell <artur.signell@itmill.com>
Tue, 2 Dec 2008 14:26:24 +0000 (14:26 +0000)
svn changeset:6072/svn branch:trunk

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

index 7972fa6034ddd10eecd0ecb7df7f1cf26b0ff793..f78c2ca63899e163d8315008afd1abdeb3eaffa8 100644 (file)
@@ -309,6 +309,12 @@ public class ITabsheet extends ITabsheetBase {
             updateDynamicWidth();
         }
 
+        if (!isDynamicHeight()) {
+            // Must update height after the styles have been set
+            updateContentNodeHeight();
+            updateOpenTabSize();
+        }
+
         iLayout();
 
         // Re run relative size update to ensure optimal scrollbars
@@ -450,10 +456,21 @@ public class ITabsheet extends ITabsheetBase {
     public void setHeight(String height) {
         super.setHeight(height);
         this.height = height;
+        updateContentNodeHeight();
+
+        if (!rendering) {
+            updateOpenTabSize();
+            iLayout();
+            // TODO Check if this is needed
+            client.runDescendentsLayout(this);
+        }
+    }
+
+    private void updateContentNodeHeight() {
         if (height != null && !"".equals(height)) {
-            int contentHeight = getOffsetHeight()
-                    - DOM.getElementPropertyInt(deco, "offsetHeight")
-                    - tb.getOffsetHeight() - 5;
+            int contentHeight = getOffsetHeight();
+            contentHeight -= DOM.getElementPropertyInt(deco, "offsetHeight");
+            contentHeight -= tb.getOffsetHeight();
             if (contentHeight < 0) {
                 contentHeight = 0;
             }
@@ -465,12 +482,6 @@ public class ITabsheet extends ITabsheetBase {
             DOM.setStyleAttribute(contentNode, "height", "");
             renderSpace.setHeight(0);
         }
-        if (!rendering) {
-            updateOpenTabSize();
-            iLayout();
-            // TODO Check if this is needed
-            client.runDescendentsLayout(this);
-        }
     }
 
     @Override