List of usage examples for com.vaadin.ui MenuBar.MenuItem addItem
public MenuBar.MenuItem addItem(String caption, MenuBar.Command command)
From source file:de.fzi.fhemapi.view.vaadin.ui.HWindow.java
License:Apache License
private MenuBar buildMenuBar() { MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); MenuBar.MenuItem file = menubar.addItem("Neu..", null); file.addItem("Neue Struktur", menuCommand); file.addItem("Neues Gert", menuCommand); MenuBar.MenuItem data = menubar.addItem("Dateien", null); data.addItem("ffne Config", menuCommand); data.addItem("Autocreate an", menuCommand); data.addItem("Autocreate aus", menuCommand); MenuBar.MenuItem save = menubar.addItem("Speichern", null); return menubar; }
From source file:de.gedoplan.webclients.vaadin.VaadinDemoUi.java
public MenuBar createMenu() { User user = userProvider.get();/*from ww w .j a v a 2s . c om*/ MenuBar mainMenu = new MenuBar(); mainMenu.setWidth(100, Unit.PERCENTAGE); mainMenu.setStyleName("main"); mainMenu.addItem("", new ThemeResource("images/vaadin-logo.png"), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_INDEX)).setStyleName("logo"); if (user.isInRole(User.UserRole.ADMIN)) { mainMenu.addItem(Messages.menu_customer.value(), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_CUSTOMERS)); } mainMenu.addItem(Messages.menu_orders.value(), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_ORDERS)); if (user.isInRole(User.UserRole.CUSTOMER)) { mainMenu.addItem(Messages.menu_customerdetails.value(), e -> navigator .navigateTo(Konstanten.VAADIN_VIEW_CUSTOMER_DETAILS + "/" + user.getCustomerID())); } MenuBar.MenuItem userMenu = mainMenu.addItem(user.getLogin(), null); userMenu.setStyleName("align-right"); userMenu.addItem(Messages.logout.value(), e -> { try { JaasAccessControl.logout(); VaadinSession.getCurrent().close(); Page.getCurrent().setLocation(Konstanten.VAADIN_LOGIN_PATH); } catch (ServletException ex) { Logger.getLogger(VaadinDemoUi.class.getName()).log(Level.SEVERE, null, ex); } }); return mainMenu; }
From source file:de.lmu.ifi.dbs.knowing.vaadin.MainApplication.java
License:Apache License
@SuppressWarnings("serial") private MenuBar getMenu() { MenuBar menubar = new MenuBar(); menubar.setWidth("100%"); homeMenu = menubar.addItem("Home", null); homeMenu.addItem("Run Process", new Command() { @Override/* w w w . j a va 2 s . co m*/ public void menuSelected(MenuItem selectedItem) { contentPanel.removeAllComponents(); contentPanel.addComponent(new DPUSelection()); } }); homeMenu.addItem("Show Services", new Command() { @Override public void menuSelected(MenuItem selectedItem) { contentPanel.removeAllComponents(); contentPanel.addComponent(ComponentFactory.processorTable()); } }); homeMenu.addSeparator(); homeMenu.addItem("Logout", new Command() { @Override public void menuSelected(MenuItem selectedItem) { main.showNotification("Run your own DPU soon!"); } }); final MenuBar.MenuItem viewMenu = menubar.addItem("Help", null); viewMenu.addItem("About...", new Command() { @Override public void menuSelected(MenuItem selectedItem) { main.addWindow(getAboutDialog()); } }); return menubar; }
From source file:edu.nps.moves.mmowgli.components.AppMenuBar.java
License:Open Source License
private MenuBar.MenuItem buildGameMasterMenu() { MenuBar.MenuItem ret = menubar.addItem("Game Master", null); ret.setIcon(VaadinIcons.GAVEL);//from ww w.j a va2 s. c o m ret.addItem("Monitor Game Master Events Log", new MCommand(MENUGAMEMASTERMONITOREVENTS)) .setIcon(VaadinIcons.LINES); ret.addItem("Post comment to Game Master Event Log", new MCommand(MENUGAMEMASTERPOSTCOMMENT)) .setIcon(VaadinIcons.COMMENT_O); ret.addSeparator(); ret.addItem("Broadcast message to game masters", new MCommand(MENUGAMEMASTERBROADCASTTOGMS)) .setIcon(VaadinIcons.MEGAFONE); ret.addItem("Broadcast message to all players", new MCommand(MENUGAMEMASTERBROADCAST)) .setIcon(VaadinIcons.MEGAFONE); ret.addItem("Edit blog headline", new MCommand(MENUGAMEMASTERBLOGHEADLINE)) .setIcon(VaadinIcons.EXCLAMATION_CIRCLE); ret.addSeparator(); if (Game.getTL().isActionPlansEnabled()) { ret.addItem("Create Action Plan", new MCommand(MENUGAMEMASTERCREATEACTIONPLAN)) .setIcon(VaadinIcons.FILE_TEXT_O); ret.addItem("Invite additional players to be Action Plan authors", new MCommand(MENUGAMEMASTERINVITEAUTHORSCLICK)).setIcon(VaadinIcons.USERS); } ret.addSeparator(); ret.addItem("Show active players", new MCommand(MENUGAMEMASTERACTIVEPLAYERREPORTCLICK)) .setIcon(VaadinIcons.USERS); //ret.addItem("Show active player count overall", new MCommand(MENUGAMEMASTERACTIVECOUNTCLICK)).setIcon(VaadinIcons.USERS); //ret.addItem("Show active player count by server", new MCommand(MENUGAMEMASTERACTIVECOUNTBYSERVERCLICK)).setIcon(VaadinIcons.USERS); // this is non functional ret.addItem("Show user polling data for this server", new MCommand(MENUGAMEMASTERUSERPOLLINGCLICK)).setIcon(VaadinIcons.USERS); ret.addItem("Show registered user counts", new MCommand(MENUGAMEMASTERTOTALREGISTEREDUSERS)) .setIcon(VaadinIcons.USERS); ret.addItem("Show card count", new MCommand(MENUGAMEMASTERCARDCOUNTCLICK)).setIcon(VaadinIcons.HASH); ret.addItem("View game login permissions buttons", viewGamePermissionsClicked).setIcon(VaadinIcons.SIGN_IN); ret.addSeparator(); if (Game.getTL().isActionPlansEnabled()) ret.addItem("Show displayed Action Plan as html", new MCommand(MENUGAMEMASTER_EXPORT_SELECTED_ACTIONPLAN)).setIcon(VaadinIcons.FILE_TEXT_O); ret.addItem("Show displayed Idea Card tree as html", new MCommand(MENUGAMEMASTER_EXPORT_SELECTED_CARD)) .setIcon(VaadinIcons.LIGHTBULB); ret.addItem("Open game Reports Index page", new MCommand(MENUGAMEMASTEROPENREPORTSPAGE)) .setIcon(VaadinIcons.FILE_TEXT_O); ret.addSeparator(); ret.addItem("View (read-only) game designer values", new MCommand(MENUGAMEADMIN_BUILDGAMECLICK_READONLY)) .setIcon(VaadinIcons.EYE); ret.addSeparator(); ret.addItem("About this Mmowgli", new MCommand(MENUGAMEMASTERABOUTMMOWGLI)) .setIcon(VaadinIcons.INFO_CIRCLE); return ret; }
From source file:edu.nps.moves.mmowgli.components.AppMenuBar.java
License:Open Source License
private MenuBar.MenuItem buildDesignerMenu() { MenuBar.MenuItem ret = menubar.addItem("<span style='width:100px'>Game Designer</span>", null); ret.setIcon(VaadinIcons.PENCIL);//from w ww. j a v a 2 s . c o m ret.addItem("Customize game", new MCommand(MENUGAMEADMIN_BUILDGAMECLICK)).setIcon(VaadinIcons.PENCIL); ret.addItem("Publish updated game design report ", new MCommand(MENUGAMEADMIN_EXPORTGAMESETTINGS)) .setIcon(VaadinIcons.FILE_TEXT_O); ret.addItem("Show signup email addresses and feedback", new MCommand(MENUGAMEADMINDUMPSIGNUPS)) .setIcon(VaadinIcons.CHECK); return ret; }
From source file:edu.nps.moves.mmowgli.components.AppMenuBar.java
License:Open Source License
private MenuBar.MenuItem buildAdminMenu() { Game game = Game.getTL();/*from ww w. j a v a 2 s . c om*/ MenuBar.MenuItem ret = menubar.addItem("Game Administrator", null); ret.setIcon(VaadinIcons.COG); ret.addItem("Player administration", new MCommand(MENUGAMEMASTERUSERADMIN)).setIcon(VaadinIcons.USERS); maxUsersMI = ret.addItem("null text", new MCommand(MENUGAMEADMINLOGINLIMIT)); maxUsersMI.setIcon(VaadinIcons.BAN); setMaxUsersMIText(game); ret.addItem("<a href='" + CLUSTERMONITORURL + "' target='" + CLUSTERMONITORTARGETWINDOWNAME + "'>Open cluster monitor</a>", new NullMCommand()).setIcon(VaadinIcons.WRENCH); ret.addSeparator(); ret.addItem("Dump player emails in plain text", new MCommand(MENUGAMEADMINDUMPEMAILS)) .setIcon(VaadinIcons.USERS); ret.addItem("Dump game master emails in plain text", new MCommand(MENUGAMEADMINDUMPGAMEMASTERS)) .setIcon(VaadinIcons.USERS); ret.addSeparator(); topCardsRoMI = ret.addItem("Top idea cards read-only", topCardsReadOnlyChecked); topCardsRoMI.setIcon(VaadinIcons.LOCK); topCardsRoMI.setCheckable(true); topCardsRoMI.setChecked(game.isTopCardsReadonly()); cardsRoMI = ret.addItem("Card-play read-only", cardsReadOnlyChecked); cardsRoMI.setIcon(VaadinIcons.LOCK); cardsRoMI.setCheckable(true); cardsRoMI.setChecked(game.isCardsReadonly()); gameRoMI = ret.addItem("Entire game read-only", gameReadOnlyChecked); gameRoMI.setIcon(VaadinIcons.LOCK); gameRoMI.setCheckable(true); gameRoMI.setChecked(game.isReadonly()); ret.addSeparator(); ret.addItem("Game login button displays and permissions", gamePermissionsClicked) .setIcon(VaadinIcons.SIGN_IN); emailConfirmationMI = ret.addItem("Require new signup email confirmation", emailConfirmationChecked); emailConfirmationMI.setIcon(VaadinIcons.USER_CHECK); emailConfirmationMI.setCheckable(true); emailConfirmationMI.setChecked(game.isEmailConfirmation()); ret.addSeparator(); ret.addItem("Manage signups", new MCommand(MENUGAMEADMINMANAGESIGNUPS)).setIcon(VaadinIcons.USERS); ret.addItem("Add to VIP list", new MCommand(MENUGAMEMASTERADDTOVIPLIST)).setIcon(VaadinIcons.USERS); ret.addItem("View and/or delete from VIP list", new MCommand(MENUGAMEMASTERVIEWVIPLIST)) .setIcon(VaadinIcons.USERS); ret.addSeparator(); String gameReports = Game.getTL().isActionPlansEnabled() ? "Publish Action Plan, Idea Card and Game Design reports now" : "Publish Idea Card and Game Design reports now"; ret.addItem(gameReports, new MCommand(MENUGAMEADMINPUBLISHREPORTS)).setIcon(VaadinIcons.FILE_TEXT_O); if (Game.getTL().isActionPlansEnabled()) { ret.addItem("Create and show Action Plans report in browser", new MCommand(MENUGAMEADMINEXPORTACTIONPLANS)).setIcon(VaadinIcons.FILE_TEXT_O); } ret.addItem("Create and show Cards report in browser", new MCommand(MENUGAMEADMINEXPORTCARDS)) .setIcon(VaadinIcons.FILE_TEXT_O); ret.addSeparator(); ret.addItem("Advance game round and/or phase", advanceRoundClicked).setIcon(VaadinIcons.ARROW_RIGHT); ret.addItem("Kill all player sessions", new MCommand(MENUGAMEADMINKILLALLSESSIONS)) .setIcon(VaadinIcons.STOP_COG); ret.addSeparator(); ret.addItem("(Dev only) Add Image to database", addImageClicked).setIcon(VaadinIcons.TOOLS); ret.addItem("(Dev only) Display card cache counts", showCardCacheCounts).setIcon(VaadinIcons.TOOLS); ret.addItem("(Dev only) Rebuild card caches", rebuildCardCaches).setIcon(VaadinIcons.TOOLS); ret.addSeparator(); ret.addItem("Begin resource load-time logging", new ResourceLogging(true)).setIcon(VaadinIcons.TOOLS); ret.addItem("Stop resource load-time logging", new ResourceLogging(false)).setIcon(VaadinIcons.TOOLS); return ret; }
From source file:es.mdef.clientmanager.ui.GestionClientesUI.java
License:Apache License
CssLayout buildMenu() { // Add items/*from w ww. jav a 2 s. com*/ menuItems.put("common", "Common UI Elements"); menu.setSizeFull(); menu.addComponent(getMenuTitleComponent()); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); // TODO Actualizar nombre de usuario cuando se logee con exito final MenuBar.MenuItem userMenuItem = settings.addItem(getNombreUsuario(), new ThemeResource("icons/usuario.svg"), null); userMenuItem.addItem("Cambiar contrasea", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { ChangePasswordWindow changePasswordWindow = new ChangePasswordWindow(); changePasswordWindow.center(); addWindow(changePasswordWindow); } }); userMenuItem.addSeparator(); userMenuItem.addItem("Salir", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { SecurityContextHolder.clearContext(); //UI.getCurrent().close(); Navigator navigator = UI.getCurrent().getNavigator(); navigator.navigateTo(""); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); final Button clientesButton = new Button("Clientes", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { navigator.navigateTo(CLIENT_LIST_VIEW); } }); clientesButton.setHtmlContentAllowed(true); clientesButton.setPrimaryStyleName("valo-menu-item"); clientesButton.setIcon(new ThemeResource("icons/clientes2.svg")); menuItemsLayout.addComponent(clientesButton); final Button budgetButton = new Button("Presupuesto", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { navigator.navigateTo(BUDGETS_VIEW); } }); budgetButton.setHtmlContentAllowed(true); budgetButton.setPrimaryStyleName("valo-menu-item"); budgetButton.setIcon(new ThemeResource("icons/money.svg")); menuItemsLayout.addComponent(budgetButton); final Button subscripcionButton = new Button("Suscripciones", new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { navigator.navigateTo(PROVIDERS_VIEW); } }); subscripcionButton.setHtmlContentAllowed(true); subscripcionButton.setPrimaryStyleName("valo-menu-item"); subscripcionButton.setIcon(new ThemeResource("icons/suscripciones.svg")); menuItemsLayout.addComponent(subscripcionButton); return menu; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
Layout getMenuBarPreviews() { Layout grid = getPreviewLayout("Menu bars"); MenuBar menubar = new MenuBar(); final MenuBar.MenuItem file = menubar.addItem("File", null); final MenuBar.MenuItem newItem = file.addItem("New", null); file.addItem("Open file...", null); file.addSeparator();/*from ww w . jav a2s.com*/ newItem.addItem("File", null); newItem.addItem("Folder", null); newItem.addItem("Project...", null); file.addItem("Close", null); file.addItem("Close All", null); file.addSeparator(); file.addItem("Save", null); file.addItem("Save As...", null); file.addItem("Save All", null); final MenuBar.MenuItem edit = menubar.addItem("Edit", null); edit.addItem("Undo", null); edit.addItem("Redo", null).setEnabled(false); edit.addSeparator(); edit.addItem("Cut", null); edit.addItem("Copy", null); edit.addItem("Paste", null); edit.addSeparator(); final MenuBar.MenuItem find = edit.addItem("Find/Replace", null); // Actions can be added inline as well, of course find.addItem("Google Search", null); find.addSeparator(); find.addItem("Find/Replace...", null); find.addItem("Find Next", null); find.addItem("Find Previous", null); final MenuBar.MenuItem view = menubar.addItem("View", null); view.addItem("Show/Hide Status Bar", null); view.addItem("Customize Toolbar...", null); view.addSeparator(); view.addItem("Actual Size", null); view.addItem("Zoom In", null); view.addItem("Zoom Out", null); grid.addComponent(menubar); return grid; }
From source file:nz.co.senanque.bundle1.AppFactoryImpl.java
License:Apache License
@Override public App createApp(Blackboard blackboard) { App ret = new App(); final Layout layout = new Layout(); layout.setBlackboard(blackboard);// ww w .j av a 2s .c o m ret.setComponentContainer(layout); MenuBar menuBar = new MenuBar(); final MenuBar.MenuItem file = menuBar.addItem("File", null); file.addItem("Close", new Command() { private static final long serialVersionUID = -1L; public void menuSelected(MenuItem selectedItem) { layout.close(); } }); final MenuBar.MenuItem save = menuBar.addItem("Edit", null); save.addItem("Save", new Command() { private static final long serialVersionUID = -1L; public void menuSelected(MenuItem selectedItem) { layout.close(); } }); ret.setMenuBar(menuBar); return ret; }
From source file:nz.co.senanque.perspectivemanager.MenuCloner.java
License:Apache License
private static void merge(MenuBar.MenuItem target, MenuBar.MenuItem source, List<MenuBar.MenuItem> added) { if (source.hasChildren()) { List<MenuBar.MenuItem> targetItems = target.getChildren(); for (MenuBar.MenuItem sourceItem : source.getChildren()) { if (sourceItem.isSeparator()) { target.addSeparator();//from w ww. j a va 2 s . c om } else { MenuBar.MenuItem targetItem = findItem(sourceItem.getText(), targetItems); if (targetItem == null) { targetItem = target.addItem(sourceItem.getText(), sourceItem.getCommand()); fixMenuItem(targetItem, sourceItem); added.add(targetItem); } merge(targetItem, sourceItem, added); } } } }