Menu mDepartment = new Menu();
mDepartment.setCanSelectParentItems(true);
mDepartment.setData(getLocalItemsAsArray());
mDepartment.setWidth(130);
mDepartment.addItemClickHandler(new ItemClickHandler() {
public void onItemClick(ItemClickEvent event) {
SC.say("You picked the \"" + event.getItem().getTitle()
+ "\" department.");
}
});
IMenuButton bDepartment = new IMenuButton("Go to department", mDepartment);
bDepartment.setWidth(130);
main.addChild(bDepartment);
Menu mCategory = new Menu();
mCategory.setCanSelectParentItems(true);
mCategory.setDataSource(SupplyCategoryXmlDS.getInstance());
mCategory.setWidth(130);
mCategory.addItemClickHandler(new ItemClickHandler() {
public void onItemClick(ItemClickEvent event) {
MenuItem item = event.getItem();
SC.say("You picked the \""
+ item.getAttributeAsString("categoryName")
+ "\" category.");