]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added a minor hack to fix sampler scrollbar issues
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Fri, 6 Feb 2009 15:41:28 +0000 (15:41 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Fri, 6 Feb 2009 15:41:28 +0000 (15:41 +0000)
svn changeset:6759/svn branch:trunk

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

index 70a0a18e575348d09336c3b0f6bef3edab109ac7..9f3b96eac2f28bcb987b7fb6177abc3a03c3f73a 100644 (file)
@@ -6,6 +6,8 @@ package com.itmill.toolkit.terminal.gwt.client.ui;
 
 import java.util.Set;
 
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
 import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
@@ -29,7 +31,7 @@ public class ICustomComponent extends SimplePanel implements Container {
         setStyleName(CLASSNAME);
     }
 
-    public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+    public void updateFromUIDL(UIDL uidl, final ApplicationConnection client) {
         rendering = true;
         if (client.updateComponent(this, uidl, true)) {
             rendering = false;
@@ -50,11 +52,22 @@ public class ICustomComponent extends SimplePanel implements Container {
             p.updateFromUIDL(child, client);
         }
 
+        boolean updateDynamicSize = updateDynamicSize();
+        if (updateDynamicSize && width != null && width.contains("%")) {
+            DeferredCommand.addCommand(new Command() {
+                public void execute() {
+                    // FIXME deferred relative size update needed to fix some
+                    // scrollbar issues in sampler. This must be the wrong way
+                    // to do it. Might be that some other component is broken.
+                    client.handleComponentRelativeSize(ICustomComponent.this);
+
+                }
+            });
+        }
+
         renderSpace.setWidth(getElement().getOffsetWidth());
         renderSpace.setHeight(getElement().getOffsetHeight());
 
-        updateDynamicSize();
-
         rendering = false;
     }