From 08e616ae50b5cf0e809be84d27d5d407ef9257bc Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Fri, 25 Feb 2011 13:59:33 +0000 Subject: [PATCH] #6509 Make subclassing VMenuBar possible by making CustomMenuItem protected and static and make it possible to modify popup location. Note that the API of VMenuBar is subject to change in the future. svn changeset:17468/svn branch:6.5 --- .../terminal/gwt/client/ui/VMenuBar.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java index 60610556c9..2b996d5792 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java @@ -77,8 +77,8 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, private String width = "notinited"; - private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor( - 100, new ScheduledCommand() { + private VLazyExecutor iconLoadedExecutioner = new VLazyExecutor(100, + new ScheduledCommand() { public void execute() { iLayout(true); @@ -578,13 +578,6 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, * @param item */ public void showChildMenu(CustomMenuItem item) { - final int shadowSpace = 10; - - popup = new VOverlay(true, false, true); - popup.setStyleName(CLASSNAME + "-popup"); - popup.setWidget(item.getSubMenu()); - popup.addCloseHandler(this); - popup.addAutoHidePartner(item.getElement()); int left = 0; int top = 0; @@ -597,6 +590,18 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, top = item.getParentMenu().getAbsoluteTop() + item.getParentMenu().getOffsetHeight(); } + showChildMenuAt(item, top, left); + } + + protected void showChildMenuAt(CustomMenuItem item, int top, int left) { + final int shadowSpace = 10; + + popup = new VOverlay(true, false, true); + popup.setStyleName(CLASSNAME + "-popup"); + popup.setWidget(item.getSubMenu()); + popup.addCloseHandler(this); + popup.addAutoHidePartner(item.getElement()); + popup.setPopupPosition(left, top); item.getSubMenu().onShow(); @@ -758,7 +763,7 @@ public class VMenuBar extends SimpleFocusablePanel implements Paintable, * A class to hold information on menu items * */ - private class CustomMenuItem extends Widget implements HasHTML { + protected static class CustomMenuItem extends Widget implements HasHTML { private ApplicationConnection client; -- 2.39.5