public MenuWidget(Widget topWidget) throws Exception {
super(topWidget);
}
protected MenuItem buildMenu() throws Exception {
MenuItem result = new MenuItem();
result.addMenuItem(null, new MenuItem("Management")); {
result.addMenuItem("Management", new MenuItem("Persons"));
result.addMenuItem("Management.Persons", new MenuItem("View", PersonChooseAndViewWidget.class));
result.addMenuItem("Management.Persons", new MenuItem("Add", PersonEditWidget.class));
result.addMenuItem("Management.Persons", new MenuItem("Edit", PersonChooseAndEditWidget.class));
result.addMenuItem("Management.Persons", new MenuItem("Editable_List_Memory", PersonEditableListWidget.Memory.class));
result.addMenuItem("Management.Persons", new MenuItem("Editable_List_Backend", PersonEditableListWidget.Backend.class));
result.addMenuItem("Management", new MenuItem("Companies"));
result.addMenuItem("Management.Companies", new MenuItem("View", CompanyChooseAndViewWidget.class));
result.addMenuItem("Management.Companies", new MenuItem("Add", CompanyEditWidget.class));
result.addMenuItem("Management.Companies", new MenuItem("Edit", CompanyChooseAndEditWidget.class));
result.addMenuItem("Management", new MenuItem("Contracts"));
result.addMenuItem("Management.Contracts", new MenuItem("View", ContractChooseAndViewWidget.class));
result.addMenuItem("Management.Contracts", new MenuItem("Add", ContractEditWidget.class));
result.addMenuItem("Management.Contracts", new MenuItem("Edit", ContractChooseAndEditWidget.class));
}
// Another way of adding menuitems is available
MenuItem sampleMenu = result.addMenuItem(new MenuItem("Samples")); {
sampleMenu.addMenuItem(new MenuItem("Simple_Form", SimpleFormWidget.class));
sampleMenu.addMenuItem(new MenuItem("Simple_List", SimpleListWidget.class));
sampleMenu.addMenuItem(new MenuItem("Search_Form", FormComplexConstraintDemoWidget.class));
}
result.addMenuItem(null, new MenuItem("Demos")); {
result.addMenuItem("Demos", new MenuItem("Display_Form", DemoDisplayForm.class));
result.addMenuItem("Demos", new MenuItem("Editable_List", DemoFormList.class));
result.addMenuItem("Demos", new MenuItem("In_memory_editable_list", DemoInMemoryEditableList.class));
result.addMenuItem("Demos", new MenuItem("Editable_checkbox_list", DemoCheckboxList.class));
result.addMenuItem("Demos", new MenuItem("Displayable_editable_list", DemoDisplayableEditableList.class));
}
result.addMenuItem(null, new MenuItem("Lists")); {
result.addMenuItem("Lists", new MenuItem("Contacts_SubBeanList", SimpleSubBeanListWidget.class));
}
return result;
}