From: Leif Åstrand Date: Thu, 22 Mar 2012 11:07:40 +0000 (+0200) Subject: Fix some small layout bugs (#8313) X-Git-Tag: 7.0.0.alpha2~249 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=70f793bfb001075a4b68edbe0e7c383bdbf80fb1;p=vaadin-framework.git Fix some small layout bugs (#8313) --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/MenuBarConnector.java b/src/com/vaadin/terminal/gwt/client/ui/MenuBarConnector.java index da7ad0265b..3a2a7a7292 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/MenuBarConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/MenuBarConnector.java @@ -146,7 +146,7 @@ public class MenuBarConnector extends AbstractComponentConnector implements } }// while - getWidget().iLayout(false); + getLayoutManager().setWidthNeedsUpdate(this); }// updateFromUIDL diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 2276320cbb..c375648bed 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -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; } } }