@Before public void setUp() { menuBar = new MenuBar(); menuFile = menuBar.addItem("File", this); menuEdit = menuBar.addItem("Edit", this); menuEditCopy = menuEdit.addItem("Copy", this); menuEditCut = menuEdit.addItem("Cut", this); menuEditPaste = menuEdit.addItem("Paste", this); menuEdit.addSeparator(); menuEditFind = menuEdit.addItem("Find...", this); menuFileOpen = menuFile.addItem("Open", this); menuFileSave = menuFile.addItem("Save", this); menuFile.addSeparator(); menuFileExit = menuFile.addItem("Exit", this); menuItems.add(menuFile); menuItems.add(menuEdit); menuItems.add(menuEditCopy); menuItems.add(menuEditCut); menuItems.add(menuEditPaste); menuItems.add(menuEditFind); menuItems.add(menuFileOpen); menuItems.add(menuFileSave); menuItems.add(menuFileExit); }
private void BuildSettings(String user) { Command cmd = new Command() { @Override public void menuSelected(MenuItem selectedItem) { Notification.show("Não implementado nesta versão."); } }; MenuBar menubar = new MenuBar(); MenuItem settingsMenu = menubar.addItem(user, new ThemeResource("img/profile-pic.png"), null); settingsMenu.addItem("Configurações", cmd); settingsMenu.addItem("Preferências", cmd); settingsMenu.addSeparator(); settingsMenu.addItem("Minha conta", cmd); settingsMenu.addItem("Sair", cmd); settings.addComponent(menubar); settings.setMargin(true); }
private Component createContentWrapper(final Component content) { final CssLayout slot = new CssLayout(); slot.setWidth("100%"); slot.addStyleName("dashboard-panel-slot"); CssLayout card = new CssLayout(); card.setWidth("100%"); card.addStyleName(ValoTheme.LAYOUT_CARD); HorizontalLayout toolbar = new HorizontalLayout(); toolbar.addStyleName("dashboard-panel-toolbar"); toolbar.setWidth("100%"); toolbar.setSpacing(false); Label caption = new Label(content.getCaption()); caption.addStyleName(ValoTheme.LABEL_H4); caption.addStyleName(ValoTheme.LABEL_COLORED); caption.addStyleName(ValoTheme.LABEL_NO_MARGIN); content.setCaption(null); MenuBar tools = new MenuBar(); tools.addStyleName(ValoTheme.MENUBAR_BORDERLESS); MenuItem max = tools.addItem( "", FontAwesome.EXPAND, new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (!slot.getStyleName().contains("max")) { selectedItem.setIcon(FontAwesome.COMPRESS); toggleMaximized(slot, true); } else { slot.removeStyleName("max"); selectedItem.setIcon(FontAwesome.EXPAND); toggleMaximized(slot, false); } } }); max.setStyleName("icon-only"); MenuItem root = tools.addItem("", FontAwesome.COG, null); root.addItem( "Configure", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); root.addSeparator(); root.addItem( "Close", new Command() { @Override public void menuSelected(final MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }); toolbar.addComponents(caption, tools); toolbar.setExpandRatio(caption, 1); toolbar.setComponentAlignment(caption, Alignment.MIDDLE_LEFT); card.addComponents(toolbar, content); slot.addComponent(card); return slot; }