diff options
author | Leif Åstrand <leif@vaadin.com> | 2011-09-21 10:38:13 +0000 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2011-09-21 10:38:13 +0000 |
commit | d0f60a2c01506f256d1a0adb39c120f0b49f1791 (patch) | |
tree | a8cbe1e99f6f21304a9b63feac3a49fc37eda22e | |
parent | a98cc714e557d9925388817cc127f5d4567a9739 (diff) | |
download | vaadin-framework-d0f60a2c01506f256d1a0adb39c120f0b49f1791.tar.gz vaadin-framework-d0f60a2c01506f256d1a0adb39c120f0b49f1791.zip |
Refactored based on review (#6420)
svn changeset:21204/svn branch:6.6
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 694e16ec34..51b9abdb0b 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -718,6 +718,34 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, } } + top = adjustPopupHeight(top, shadowSpace); + + popup.setPopupPosition(left, top); + + // IE7 really tests one's patience sometimes + // Part of a fix to correct #3850 + if (BrowserInfo.get().isIE7()) { + popup.getElement().getStyle().setProperty("zoom", ""); + Scheduler.get().scheduleDeferred(new Command() { + public void execute() { + if (popup == null) { + // The child menu can be hidden before this command is + // run. + return; + } + + if (popup.getElement().getStyle().getProperty("width") == null + || popup.getElement().getStyle() + .getProperty("width") == "") { + popup.setWidth(popup.getOffsetWidth() + "px"); + } + popup.getElement().getStyle().setProperty("zoom", "1"); + } + }); + } + } + + private int adjustPopupHeight(int top, final int shadowSpace) { // Check that the popup will fit the screen int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - top - shadowSpace; @@ -757,30 +785,7 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, popup.updateShadowSizeAndPosition(); } } - - popup.setPopupPosition(left, top); - - // IE7 really tests one's patience sometimes - // Part of a fix to correct #3850 - if (BrowserInfo.get().isIE7()) { - popup.getElement().getStyle().setProperty("zoom", ""); - Scheduler.get().scheduleDeferred(new Command() { - public void execute() { - if (popup == null) { - // The child menu can be hidden before this command is - // run. - return; - } - - if (popup.getElement().getStyle().getProperty("width") == null - || popup.getElement().getStyle() - .getProperty("width") == "") { - popup.setWidth(popup.getOffsetWidth() + "px"); - } - popup.getElement().getStyle().setProperty("zoom", "1"); - } - }); - } + return top; } /** |