From: Risto Yrjänä Date: Wed, 6 Aug 2008 07:45:13 +0000 (+0000) Subject: New addItem method X-Git-Tag: 6.7.0.beta1~4396 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f0570111014e9013b96ac80a4d2e16e182a7aa14;p=vaadin-framework.git New addItem method svn changeset:5144/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/ui/MenuBar.java b/src/com/itmill/toolkit/ui/MenuBar.java index 0b137d7484..38162cf6fd 100644 --- a/src/com/itmill/toolkit/ui/MenuBar.java +++ b/src/com/itmill/toolkit/ui/MenuBar.java @@ -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.