]> source.dussan.org Git - vaadin-framework.git/commitdiff
iscrolltable fix for scrollbars on size change
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 29 Apr 2009 09:15:20 +0000 (09:15 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 29 Apr 2009 09:15:20 +0000 (09:15 +0000)
svn changeset:7568/svn branch:6.0

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

index 596b47a1919a27a6f314941b402ce82ac1e3a2e8..96d10fa7c35296da637e401d3c32951191d191b4 100644 (file)
@@ -578,19 +578,7 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
 
         tHead.disableBrowserIntelligence();
 
-        boolean willHaveScrollbarz = false;
-        if (!(height != null && !height.equals(""))) {
-            if (pageLength < totalRows) {
-                willHaveScrollbarz = true;
-            }
-        } else {
-            int fakeheight = tBody.getRowHeight() * totalRows;
-            int availableHeight = bodyContainer.getElement().getPropertyInt(
-                    "clientHeight");
-            if (fakeheight > availableHeight) {
-                willHaveScrollbarz = true;
-            }
-        }
+        boolean willHaveScrollbarz = willHaveScrollbars();
 
         // fix "natural" width if width not set
         if (width == null || "".equals(width)) {
@@ -731,6 +719,22 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
         initializedAndAttached = true;
     }
 
+    private boolean willHaveScrollbars() {
+        if (!(height != null && !height.equals(""))) {
+            if (pageLength < totalRows) {
+                return true;
+            }
+        } else {
+            int fakeheight = tBody.getRowHeight() * totalRows;
+            int availableHeight = bodyContainer.getElement().getPropertyInt(
+                    "clientHeight");
+            if (fakeheight > availableHeight) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     /**
      * This method has logic which rows needs to be requested from server when
      * user scrolls
@@ -2708,6 +2712,9 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
             // Hey IE, are you really sure about this?
             availW = tBody.getAvailableWidth();
             availW -= tBody.getCellExtraWidth() * visibleColOrder.length;
+            if (willHaveScrollbars()) {
+                availW -= Util.getNativeScrollbarSize();
+            }
 
             int extraSpace = availW - usedMinimumWidth;
             if (extraSpace < 0) {