public class HeaderMenu extends menubar implements View {
public HeaderMenu() {
Command menucommand = this::menuSelected;
MenuItem Accounts = menubar.addItem("Accounts", null);
MenuItem Plans = menubar.addItem("Plans", menucommand);
MenuItem Billing = menubar.addItem("Billing", null);
MenuItem Invoices = menubar.addItem("Invoices", null);
MenuItem Payments = menubar.addItem("Payments", null);
MenuItem Reports = menubar.addItem("Reports", null);
MenuItem MyAccount = menubar.addItem("MyAccount", null);
MenuItem SubMyAccount = MyAccount.addItem("My Account", menucommand); //binding events
MenuItem MyRates = MyAccount.addItem("My Rates", menucommand);
MenuItem MyInvoices = MyAccount.addItem("My Invoices", menucommand);
MenuItem MyPayments = MyAccount.addItem("My Payments", menucommand);
MenuItem Settings = menubar.addItem("Settings", null);
MenuItem Help = menubar.addItem("Help", null);
SubMyAccount.setChecked(true);
}
private void menuSelected(MenuItem item) { // getting events on particular
Menu Items
String menuItem=item.getText();
if (item.getParent() != null)
item.getParent().setText(item.getText());
if (menuItem.contains("My Account")) {
Notification.show("NO Such Wiew Exists", Notification.TYPE_WARNING_MESSAGE);
UI.getCurrent().getNavigator().navigateTo("nop");
}
else if (menuItem.contains("Plans")) {
UI.getCurrent().getNavigator().navigateTo("plan");
}
}
}
Comments
Post a Comment