List of usage examples for com.vaadin.ui MenuBar MenuBar
public MenuBar()
From source file:rs.co.micro.bwNet.navigationMenu.java
public navigationMenu() { //Main Panel/*from w w w. j a v a2 s. c o m*/ setResponsive(true); setSpacing(true); setMargin(false); HorizontalLayout topMenu = new HorizontalLayout(); topMenu.setSizeFull(); //Logout Dugme MenuBar logout = new MenuBar(); logout.setId("logoutDugme"); logout.setSizeFull(); logout.setResponsive(true); logout.setDescription("Izadjite iz programa"); MenuBar.MenuItem logoutDugme = logout.addItem("Logout", FontAwesome.SIGN_OUT, new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { getUI().getSession().close(); navigator.addView("login", new login()); navigator.navigateTo("login"); } }); //Navigacioni meni MenuBar navMeni = new MenuBar(); navMeni.setId("navMeni"); navMeni.setSizeFull(); navMeni.setResponsive(true); // A top-level menu item that opens a submenu MenuBar.MenuItem uvidi = navMeni.addItem("Uvidi", null, null); //Nesto poput click listenera MenuBar.Command mycommand = new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { Notification.show("radi"); } }; // karticaPartnera.addItem("Tea", // FontAwesome.DROPBOX, mycommand); // karticaPartnera.addItem("Coffee", // FontAwesome.COFFEE, mycommand); // Another top-level item MenuBar.MenuItem snacks = navMeni.addItem("Snacks", null, null); snacks.addItem("Weisswurst", null, mycommand); snacks.addItem("Bratwurst", null, mycommand); snacks.addItem("Currywurst", null, mycommand); snacks.addItem("Test1", null, mycommand); snacks.addItem("test2", null, mycommand); // Yet another top-level item MenuBar.MenuItem servs = navMeni.addItem("Services", null, null); servs.addItem("Car Service", null, mycommand); topMenu.addComponents(navMeni, logout); addComponents(topMenu); // Kreira Kartica Partnera submeni i pokazuje Karticu MenuBar.MenuItem karticaPartnera; karticaPartnera = uvidi.addItem("Kartica Partnera", null, new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { try { navigator.addView("BWKarticaPartnera", new BWkarticaPartnera()); } catch (SQLException ex) { System.out.println("Greska (BWnFinex klasa)" + SQLException.class); } navigator.navigateTo("BWKarticaPartnera"); } }); System.out.println("ubacen meni"); }
From source file:rs.pupin.jpo.esta_ld.DSDRepoComponent.java
public DSDRepoComponent(Repository repository, String dataGraph, String repoGraph) { this.repository = repository; this.dataGraph = dataGraph; this.repoGraph = repoGraph; initializeRepoGraph();//from www . j a v a 2 s.co m dcRepo = new SparqlDCRepository(repository); graph = new SparqlDCGraph(repository, dataGraph); VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setWidth("100%"); rootLayout.setSpacing(true); mainLayout = new VerticalLayout(); mainLayout.setWidth("100%"); mainLayout.setSpacing(true); HorizontalLayout menuLayout = new HorizontalLayout(); menuLayout.setSpacing(true); menuLayout.setWidth("100%"); rootLayout.addComponent(menuLayout); final MenuBar menu = new MenuBar(); menu.addStyleName("dsd"); cmdFindDSD = new MenuBar.Command() { public void menuSelected(MenuBar.MenuItem selectedItem) { for (MenuBar.MenuItem item : menu.getItems()) { if (item == selectedItem) { if (!item.getStyleName().contains("selected")) { if (ds != null) item.setStyleName("selected"); findDSDs(); } } else item.setStyleName("bleja"); } } }; menu.addItem("Find Suitable DSDs", cmdFindDSD).setStyleName("bleja"); cmdCreateDSD = new MenuBar.Command() { public void menuSelected(MenuBar.MenuItem selectedItem) { for (MenuBar.MenuItem item : menu.getItems()) { if (item == selectedItem) { if (!item.getStyleName().contains("selected")) { if (ds != null) item.setStyleName("selected"); createDSD(); } } else item.setStyleName("bleja"); } } }; menu.addItem("Create DSD", cmdCreateDSD).setStyleName("bleja"); cmdStoreDSD = new MenuBar.Command() { public void menuSelected(MenuBar.MenuItem selectedItem) { for (MenuBar.MenuItem item : menu.getItems()) { if (item == selectedItem) { if (!item.getStyleName().contains("selected")) { if (ds != null) item.setStyleName("selected"); storeDSD(); } } else item.setStyleName("bleja"); } } }; menu.addItem("Store DSD", cmdStoreDSD).setStyleName("bleja"); menuLayout.addComponent(menu); Label spaceLbl = new Label(""); menuLayout.addComponent(spaceLbl); menuLayout.setExpandRatio(spaceLbl, 2.0f); Label lbl = new Label("Choose dataset: "); lbl.setSizeUndefined(); menuLayout.addComponent(lbl); selectDataSet = new ComboBox(null, graph.getDataSets()); selectDataSet.setImmediate(true); selectDataSet.setNewItemsAllowed(false); selectDataSet.setNullSelectionAllowed(false); selectDataSet.setWidth("300px"); selectDataSet.addListener(new Property.ValueChangeListener() { public void valueChange(Property.ValueChangeEvent event) { ds = (DataSet) event.getProperty().getValue(); } }); menuLayout.addComponent(selectDataSet); rootLayout.addComponent(new Label("<hr/>", Label.CONTENT_XHTML)); rootLayout.addComponent(mainLayout); setCompositionRoot(rootLayout); }
From source file:ru.codeinside.gses.webui.manager.ManagerWorkplace.java
License:Mozilla Public License
public ManagerWorkplace() { setSizeFull();//from w w w . ja v a2 s . c o m servicePanel = createServicePanel(); procedurePanel = createProcedurePanel1(); directoryPanel = DirectoryPanel.createDirectoryPanel(); final MenuBar menu = new MenuBar(); menu.setWidth("100%"); menu.addStyleName("submenu"); MenuBar.MenuItem servicesItem = menu.addItem("?", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { chooseTab(selectedItem, menu, servicePanel, procedurePanel, directoryPanel); } }); MenuBar.MenuItem administrativeProceduresItem = menu .addItem("?? ", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { chooseTab(selectedItem, menu, procedurePanel, servicePanel, directoryPanel); activateApInterface(); } }); menu.addItem("? ", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { chooseTab(selectedItem, menu, procedurePanel, servicePanel, directoryPanel); activateMpInterface(); } }); menu.addItem(" ?", new MenuBar.Command() { @Override public void menuSelected(MenuBar.MenuItem selectedItem) { chooseTab(selectedItem, menu, directoryPanel, servicePanel, procedurePanel); activateMpInterface(); } }); addComponent(menu); setExpandRatio(menu, 0.01f); administrativeProceduresItem.getCommand().menuSelected(administrativeProceduresItem); }
From source file:songstock.web.client.MenuPanel.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from w w w . j a va 2s .c o m mainLayout.setWidth("100%"); mainLayout.setHeight("23px"); // top-level component properties setWidth("100.0%"); setHeight("23px"); // menuBar menuBar = new MenuBar(); menuBar.setImmediate(false); menuBar.setWidth("100.0%"); menuBar.setHeight("-1px"); mainLayout.addComponent(menuBar, "top:0.0px;left:0.0px;"); return mainLayout; }
From source file:uk.co.intec.keyDatesApp.components.HeaderComponent.java
License:Apache License
/** * Constructor, passing the Vaadin application page * * @param ui//w w w . j a v a2 s .c o m * MainUI application page */ public HeaderComponent(MainUI ui) { setHeight("50px"); setStyleName("header"); final HorizontalLayout bannerArea = new HorizontalLayout(); bannerArea.setStyleName("menuArea"); bannerArea.setSizeFull(); final ThemeResource resource = new ThemeResource("img/intec-logo.gif.png"); final Image bannerImg = new Image(); bannerImg.setAlternateText("Intec"); bannerImg.setHeight("50px"); bannerImg.setDescription("Intec Logo"); bannerImg.setSource(resource); bannerImg.setWidth(null); bannerImg.setStyleName("bannerImg"); setMenubar(new MenuBar()); getMenubar().setStyleName(ValoTheme.MENU_SUBTITLE); getMenubar().addStyleName("valo-menu-subtitle-indent"); getMenubar().setWidth(100, Unit.PERCENTAGE); if (!"Anonymous".equals(getUserName())) { final MenuItem logout = menubar.addItem("Logout", null); logout.setStyleName("menuRight"); } final MenuItem userItem = menubar.addItem(getUserName(), null); userItem.setStyleName("menuRight"); bannerArea.addComponents(bannerImg, menubar); bannerArea.setExpandRatio(menubar, 1); addComponent(bannerArea); setExpandRatio(bannerArea, 1); setSizeFull(); }