]> source.dussan.org Git - vaadin-framework.git/commitdiff
Update MenuBar to work with MeasureManager (#8313)
authorLeif Åstrand <leif@vaadin.com>
Thu, 16 Feb 2012 10:25:51 +0000 (12:25 +0200)
committerLeif Åstrand <leif@vaadin.com>
Thu, 16 Feb 2012 10:25:51 +0000 (12:25 +0200)
src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java
src/com/vaadin/terminal/gwt/client/ui/VMenuBarPaintable.java

index c39155d032f8f5a76cc5a91d5d28bc57a3e79053..5fa7420150850f847aafd29e85296882164dfedc 100644 (file)
@@ -32,15 +32,14 @@ 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.ContainerResizedListener;
 import com.vaadin.terminal.gwt.client.TooltipInfo;
 import com.vaadin.terminal.gwt.client.UIDL;
 import com.vaadin.terminal.gwt.client.Util;
 import com.vaadin.terminal.gwt.client.VTooltip;
 
 public class VMenuBar extends SimpleFocusablePanel implements
-        CloseHandler<PopupPanel>, ContainerResizedListener, KeyPressHandler,
-        KeyDownHandler, FocusHandler, SubPartAware {
+        CloseHandler<PopupPanel>, KeyPressHandler, KeyDownHandler,
+        FocusHandler, SubPartAware {
 
     // The hierarchy of VMenuBar is a bit weird as VMenuBar is the Paintable,
     // used for the root menu but also used for the sub menus.
@@ -145,16 +144,8 @@ public class VMenuBar extends SimpleFocusablePanel implements
         }
     }
 
-    @Override
-    public void setWidth(String width) {
-        if (Util.equals(this.width, width)) {
-            return;
-        }
-
-        this.width = width;
-
-        Util.setWidthExcludingPaddingAndBorder(this, width, 0);
-
+    void updateSize() {
+        // Take from setWidth
         if (!subMenu) {
             // Only needed for root level menu
             hideChildren();
@@ -952,6 +943,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
 
     public void iLayout() {
         iLayout(false);
+        updateSize();
     }
 
     public void iLayout(boolean iconLoadEvent) {
index f3e4609540a4bb9a9b97ad0e70f266553ef677a1..87c7a6c145ee382e94b6f178a7abc29b6bb8b91d 100644 (file)
@@ -14,7 +14,8 @@ import com.vaadin.terminal.gwt.client.UIDL;
 import com.vaadin.terminal.gwt.client.Util;
 import com.vaadin.terminal.gwt.client.ui.VMenuBar.CustomMenuItem;
 
-public class VMenuBarPaintable extends VAbstractPaintableWidget {
+public class VMenuBarPaintable extends VAbstractPaintableWidget implements
+        ResizeRequired {
     /**
      * This method must be implemented to update the client-side component from
      * UIDL data received from server.
@@ -160,4 +161,7 @@ public class VMenuBarPaintable extends VAbstractPaintableWidget {
         return (VMenuBar) super.getWidgetForPaintable();
     }
 
+    public void onResize() {
+        getWidgetForPaintable().iLayout();
+    }
 }