]> source.dussan.org Git - vaadin-framework.git/commitdiff
#6509 Make subclassing VMenuBar possible by making CustomMenuItem protected and stati...
authorHenri Sara <henri.sara@itmill.com>
Fri, 25 Feb 2011 13:59:33 +0000 (13:59 +0000)
committerHenri Sara <henri.sara@itmill.com>
Fri, 25 Feb 2011 13:59:33 +0000 (13:59 +0000)
Note that the API of VMenuBar is subject to change in the future.

svn changeset:17468/svn branch:6.5

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

index 60610556c92600c2d3ddbd9f6565645241f15d2d..2b996d57922f03b0444b16051bfde21b98c1e90d 100644 (file)
@@ -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;