]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #3264, enabled automatic scrollbars in Vaadin
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 2 Sep 2009 12:41:14 +0000 (12:41 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 2 Sep 2009 12:41:14 +0000 (12:41 +0000)
svn changeset:8637/svn branch:6.1

src/com/vaadin/terminal/gwt/client/ui/VGridLayout.java
src/com/vaadin/terminal/gwt/client/ui/VPanel.java
src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
src/com/vaadin/terminal/gwt/client/ui/VTabsheet.java
src/com/vaadin/terminal/gwt/client/ui/VView.java
src/com/vaadin/terminal/gwt/client/ui/VWindow.java

index 2e4ba2586bce61e71884b404e6b25f8bd74a2d2e..f52b6fc7e2bf7a0ed236796ae9f55f70d63de308 100644 (file)
@@ -87,14 +87,6 @@ public class VGridLayout extends SimplePanel implements Paintable, Container {
             return;
         }
 
-        boolean mightToggleVScrollBar = "".equals(height) && !"".equals(width);
-        boolean mightToggleHScrollBar = "".equals(width) && !"".equals(height);
-        int wBeforeRender = 0;
-        int hBeforeRender = 0;
-        if (mightToggleHScrollBar || mightToggleVScrollBar) {
-            wBeforeRender = canvas.getOffsetWidth();
-            hBeforeRender = getOffsetHeight();
-        }
         canvas.setWidth("0px");
 
         handleMargins(uidl);
@@ -201,15 +193,6 @@ public class VGridLayout extends SimplePanel implements Paintable, Container {
 
         boolean needsRelativeSizeCheck = false;
 
-        if (mightToggleHScrollBar && wBeforeRender != canvas.getOffsetWidth()) {
-            needsRelativeSizeCheck = true;
-        }
-        if (mightToggleVScrollBar && hBeforeRender != getOffsetHeight()) {
-            needsRelativeSizeCheck = true;
-        }
-        if (needsRelativeSizeCheck) {
-            client.handleComponentRelativeSize(this);
-        }
     }
 
     private static int[] cloneArray(int[] toBeCloned) {
index d1790bf71037ed32c0c68ccd72a2f96ff7430495..ec4acf2e4da1baccd275e3892adc04ed64ad440e 100644 (file)
@@ -492,6 +492,9 @@ public class VPanel extends SimplePanel implements Container {
     }
 
     public boolean requestLayout(Set<Paintable> child) {
+        // content size change might cause change to its available space
+        // (scrollbars)
+        client.handleComponentRelativeSize((Widget) layout);
         if (height != null && height != "" && width != null && width != "") {
             /*
              * If the height and width has been specified the child components
index 59015a9606e37a040c6288c7d825862d64b1509d..688283e61d6e7a70e44783e4b252791e7840013b 100644 (file)
@@ -522,6 +522,11 @@ public class VSplitPanel extends ComplexPanel implements Container,
     }
 
     public boolean requestLayout(Set<Paintable> child) {
+        // content size change might cause change to its available space
+        // (scrollbars)
+        for (Paintable paintable : child) {
+            client.handleComponentRelativeSize((Widget) paintable);
+        }
         if (height != null && width != null) {
             /*
              * If the height and width has been specified the child components
index 879d8c403a2226f37719a69db796b13a02ae3d17..3949b0d32eec7eebee8f900b57a7571737b3cdba 100644 (file)
@@ -822,7 +822,10 @@ public class VTabsheet extends VTabsheetBase {
              * If the height and width has been specified for this container the
              * child components cannot make the size of the layout change
              */
-
+            // layout size change may affect its available space (scrollbars)
+            for (Paintable paintable : child) {
+                client.handleComponentRelativeSize((Widget) paintable);
+            }
             return true;
         }
 
index 3ea6531b43af0b24c74b67dc684daf98c62fabdc..95e85aaa1f37b48946e969fd855b2f096f07c036 100644 (file)
@@ -36,8 +36,8 @@ import com.vaadin.terminal.gwt.client.Util;
 /**
  *
  */
-public class VView extends SimplePanel implements Container,
-        ResizeHandler, Window.ClosingHandler {
+public class VView extends SimplePanel implements Container, ResizeHandler,
+        Window.ClosingHandler {
 
     private static final String CLASSNAME = "v-view";
 
@@ -561,6 +561,9 @@ public class VView extends SimplePanel implements Container,
          */
         updateParentFrameSize();
 
+        // layout size change may affect its available space (scrollbars)
+        connection.handleComponentRelativeSize((Widget) layout);
+
         return true;
 
     }
@@ -599,7 +602,7 @@ public class VView extends SimplePanel implements Container,
     /**
      * Return an iterator for current subwindows. This method is meant for
      * testing purposes only.
-     *
+     * 
      * @return
      */
     public ArrayList<VWindow> getSubWindowList() {
index 900d49e214b3d11d5b1897a5aeaf6645039f1c2f..5cb93795b35e4e652e8702bbd5c08bf1311c8b27 100644 (file)
@@ -966,6 +966,8 @@ public class VWindow extends VOverlay implements Container, ScrollListener {
             center();
         }
         updateShadowSizeAndPosition();
+        // layout size change may affect its available space (scrollbars)
+        client.handleComponentRelativeSize((Widget) layout);
         return true;
     }