]> source.dussan.org Git - vaadin-framework.git/commitdiff
New addItem method
authorRisto Yrjänä <risto.yrjana@itmill.com>
Wed, 6 Aug 2008 07:45:13 +0000 (07:45 +0000)
committerRisto Yrjänä <risto.yrjana@itmill.com>
Wed, 6 Aug 2008 07:45:13 +0000 (07:45 +0000)
svn changeset:5144/svn branch:trunk

src/com/itmill/toolkit/ui/MenuBar.java

index 0b137d7484c0d31344ef309094db9777e6e7015d..38162cf6fdf7b4abde8985892032478e3e5b4a08 100644 (file)
@@ -153,6 +153,20 @@ public class MenuBar extends AbstractComponent {
         setMoreMenuItem(null);
     }
 
+    /**
+     * Add a new item to the menubar. Command can be null, but a caption must be
+     * given.
+     * 
+     * @param caption
+     *            the text for the menu item
+     * @param command
+     *            the command for the menu item
+     * @throws IllegalArgumentException
+     */
+    public MenuBar.MenuItem addItem(String caption, MenuBar.Command command) {
+        return addItem(caption, null, command);
+    }
+
     /**
      * Add a new item to the menubar. Icon and command can be null, but a
      * caption must be given.
@@ -395,6 +409,19 @@ public class MenuBar extends AbstractComponent {
             return itsChildren != null;
         }
 
+        /**
+         * Add a new item inside this item, thus creating a submenu. Command can
+         * be null, but a caption must be given.
+         * 
+         * @param caption
+         *            the text for the menu item
+         * @param command
+         *            the command for the menu item
+         */
+        public MenuBar.MenuItem addItem(String caption, MenuBar.Command command) {
+            return addItem(caption, null, command);
+        }
+
         /**
          * Add a new item inside this item, thus creating a submenu. Icon and
          * command can be null, but a caption must be given.