]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix some small layout bugs (#8313)
authorLeif Åstrand <leif@vaadin.com>
Thu, 22 Mar 2012 11:07:40 +0000 (13:07 +0200)
committerLeif Åstrand <leif@vaadin.com>
Thu, 22 Mar 2012 11:07:40 +0000 (13:07 +0200)
src/com/vaadin/terminal/gwt/client/ui/MenuBarConnector.java
src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java

index da7ad0265b65be6ecf40859e9bc01bb669a2e6cb..3a2a7a7292d90cadefbd93424385bcd9aee35f9d 100644 (file)
@@ -146,7 +146,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements
             }
         }// while
 
-        getWidget().iLayout(false);
+        getLayoutManager().setWidthNeedsUpdate(this);
 
     }// updateFromUIDL
 
index 2276320cbbea4f3bb69279449564ea0fad71cd19..c375648bedc3ce34a1e086953a0e3031f499ee51 100644 (file)
@@ -32,6 +32,7 @@ import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.ApplicationConnection;
 import com.vaadin.terminal.gwt.client.BrowserInfo;
+import com.vaadin.terminal.gwt.client.LayoutManager;
 import com.vaadin.terminal.gwt.client.TooltipInfo;
 import com.vaadin.terminal.gwt.client.UIDL;
 import com.vaadin.terminal.gwt.client.Util;
@@ -945,8 +946,6 @@ public class VMenuBar extends SimpleFocusablePanel implements
     /**
      * @author Jouni Koivuviita / Vaadin Ltd.
      */
-    private int paddingWidth = -1;
-
     public void iLayout() {
         iLayout(false);
         updateSize();
@@ -968,15 +967,8 @@ public class VMenuBar extends SimpleFocusablePanel implements
                 removeItem(moreItem);
             }
 
-            // Measure available space
-            if (paddingWidth == -1) {
-                int widthBefore = getElement().getClientWidth();
-                getElement().getStyle().setProperty("padding", "0");
-                paddingWidth = widthBefore - getElement().getClientWidth();
-                getElement().getStyle().setProperty("padding", "");
-            }
-
-            int availableWidth = getElement().getClientWidth() - paddingWidth;
+            int availableWidth = LayoutManager.get(client).getInnerWidth(
+                    getElement());
 
             // Used width includes the "more" item if present
             int usedWidth = getConsumedWidth();
@@ -1020,7 +1012,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
                         removeItem(expand);
                         collapsedRootItems.addItem(expand, 0);
                     } else {
-                        widthAvailable = diff;
+                        widthAvailable = diff + moreItemWidth;
                     }
                 }
             }