Your example translates roughly to the following in Java:
MenuButton menuButton = new MenuButton();
Menu menu = new Menu();
menuButton.setMenu(menu);
Menu.Section menuSection = new Menu.Section();
menu.getSections().add(menuSection);
Menu.Item menuItem = new Menu.Item();
menuSection.add(menuItem);
menuItem.setButtonData("XXXX");
menuItem.setAction("myaction");
So, you can basically duplicate the last section to dynamically add items to
the menu section.
In case you are not familiar with it, you can give the <Menu.Section> element
an ID and map it into your Java code using the @WTKX annotation. That way, you
don't need to create the menu section in code - you can still declare it in
your WTKX.
On Apr 9, 2010, at 2:59 PM, Shahzad Bhatti wrote:
> I need to create menu buttons that I can populate dynamically. How would I
> change menu buttons from static definition such as:
> <MenuButton>
> <menu>
> <Menu>
> <sections>
> <Menu.Section>
> <Menu.Item buttonData="XXXX"
> action="myaction"/>
> </Menu.Section>
> </sections>
> </Menu>
> </menu>
> </MenuButton>
>
>
> so that I can add start with empty Menu.Section and add Menu.Item
> programmatically. Thanks.
>
>
> ______________________________________________
>
> See http://www.peak6.com/email_disclaimer.php
> for terms and conditions related to this email