From 70f793bfb001075a4b68edbe0e7c383bdbf80fb1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Thu, 22 Mar 2012 13:07:40 +0200 Subject: [PATCH] Fix some small layout bugs (#8313) --- .../terminal/gwt/client/ui/MenuBarConnector.java | 2 +- .../vaadin/terminal/gwt/client/ui/VMenuBar.java | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) 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; } } } -- 2.39.5