List of usage examples for com.vaadin.ui MenuBar.MenuItem setIcon
@Override public void setIcon(Resource icon)
From source file:com.parship.roperty.ui.NavigationViewUI.java
License:Apache License
/** * The constructor should first build the main layout, set the * composition root and then do any custom initialization. * The constructor will not be automatically regenerated by the * visual editor./*from w w w.j a v a 2s. co m*/ */ public NavigationViewUI() { buildMainLayout(); setCompositionRoot(mainLayout); /* Menu Bar */ // User Menu User currentUser = UserManager.getCurrentUser(); if (currentUser != null) { String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath(); FileResource resourceCloudIcon = new FileResource( new File(basepath + "/WEB-INF/images/icons/111-user.png")); MenuBar.MenuItem userMenu = mainMenuBar.addItem(currentUser.getFullName(), null); userMenu.setIcon(resourceCloudIcon); userMenu.addItem("Logout", new LogoutCommand()); } }
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); 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();/*from w w w . ja v a2 s . c om*/ 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); 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 w w w . j av a2s .c om*/ }
From source file:edu.nps.moves.mmowgli.components.AppMenuBar.java
License:Open Source License
private MenuBar.MenuItem buildAdminMenu() { Game game = Game.getTL();// w w w.j ava 2 s.c o m 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:org.jpos.qi.Header.java
License:Open Source License
private void decorate(MenuBar.MenuItem mi, Element e) { String style = e.getAttributeValue("style"); if (style != null) mi.setStyleName(e.getAttributeValue("style")); String iconName = e.getAttributeValue("icon"); if (iconName != null) { try {/*from w w w . j a v a 2 s . c o m*/ mi.setIcon(VaadinIcons.valueOf(iconName)); } catch (IllegalArgumentException ex) { mi.setIcon(VaadinIcons.EXCLAMATION); mi.setEnabled(false); } } }
From source file:org.jumpmind.vaadin.ui.sqlexplorer.TabularResultLayout.java
License:Open Source License
private void createMenuBar() { HorizontalLayout resultBar = new HorizontalLayout(); resultBar.setWidth(100, Unit.PERCENTAGE); resultBar.setMargin(new MarginInfo(false, true, false, true)); HorizontalLayout leftBar = new HorizontalLayout(); leftBar.setSpacing(true);//from ww w .j av a2s. c o m resultLabel = new Label("", ContentMode.HTML); leftBar.addComponent(resultLabel); final Label sqlLabel = new Label("", ContentMode.TEXT); sqlLabel.setWidth(800, Unit.PIXELS); leftBar.addComponent(sqlLabel); resultBar.addComponent(leftBar); resultBar.setComponentAlignment(leftBar, Alignment.MIDDLE_LEFT); resultBar.setExpandRatio(leftBar, 1); MenuBar rightBar = new MenuBar(); rightBar.addStyleName(ValoTheme.MENUBAR_BORDERLESS); rightBar.addStyleName(ValoTheme.MENUBAR_SMALL); MenuBar.MenuItem refreshButton = rightBar.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuBar.MenuItem selectedItem) { listener.reExecute(sql); } }); refreshButton.setIcon(FontAwesome.REFRESH); MenuBar.MenuItem exportButton = rightBar.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuBar.MenuItem selectedItem) { new ExportDialog(grid, db.getName(), sql).show(); } }); exportButton.setIcon(FontAwesome.UPLOAD); if (isInQueryGeneralResults) { MenuBar.MenuItem keepResultsButton = rightBar.addItem("", new Command() { private static final long serialVersionUID = 1L; @Override public void menuSelected(com.vaadin.ui.MenuBar.MenuItem selectedItem) { queryPanel.addResultsTab(refreshWithoutSaveButton(), StringUtils.abbreviate(sql, 20), queryPanel.getGeneralResultsTab().getIcon()); queryPanel.resetGeneralResultsTab(); } }); keepResultsButton.setIcon(FontAwesome.CLONE); keepResultsButton.setDescription("Save these results to a new tab"); } if (showSql) { sqlLabel.setValue(StringUtils.abbreviate(sql, 200)); } resultBar.addComponent(rightBar); resultBar.setComponentAlignment(rightBar, Alignment.MIDDLE_RIGHT); this.addComponent(resultBar, 0); }