]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6205 - Too many items are collapsed in certain cases
authorArtur Signell <artur.signell@itmill.com>
Mon, 27 Dec 2010 14:24:52 +0000 (14:24 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 27 Dec 2010 14:24:52 +0000 (14:24 +0000)
svn changeset:16661/svn branch:6.5

src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java

index 6a71c0229667616f7e0971ab25958ca03d395c5e..3ad7b7e0570437b15fb7d0716b272d1cb34f2145 100644 (file)
@@ -959,13 +959,18 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable,
                 // overflow:hidden
                 getElement().getStyle().setProperty("overflow", overflow);
             }
-            int diff = availableWidth - getConsumedWidth();
 
+            // Used width includes the "more" item if present
+            int usedWidth = getConsumedWidth();
+            int diff = availableWidth - usedWidth;
             removeItem(moreItem);
 
             if (diff < 0) {
                 // Too many items: collapse last items from root menu
-                final int widthNeeded = moreItemWidth - diff;
+                int widthNeeded = usedWidth - availableWidth;
+                if (!morePresent) {
+                    widthNeeded += moreItemWidth;
+                }
                 int widthReduced = 0;
 
                 while (widthReduced < widthNeeded && getItems().size() > 0) {