List of usage examples for com.vaadin.ui MenuBar.MenuItem getStyleName
@Override
public String getStyleName()
From source file:com.haulmont.cuba.web.gui.components.presentations.TablePresentations.java
License:Apache License
protected void addStyleForItem(com.vaadin.ui.MenuBar.MenuItem item, String styleName) { List<String> styles = new ArrayList<>(); String style = item.getStyleName(); if (style != null) { CollectionUtils.addAll(styles, style.split(" ")); }//from w ww . j a va 2 s . com if (!styles.contains(styleName)) { styles.add(styleName); } applyStylesForItem(item, styles); }
From source file:com.haulmont.cuba.web.gui.components.presentations.TablePresentations.java
License:Apache License
protected void removeStyleForItem(com.vaadin.ui.MenuBar.MenuItem item, String styleName) { String style = item.getStyleName(); if (style != null) { List<String> styles = new ArrayList<>(); CollectionUtils.addAll(styles, style.split(" ")); styles.remove(styleName);/*from ww w . j a va 2s . c o m*/ applyStylesForItem(item, styles); } }
From source file:eu.lod2.stat.dsdrepo.DSDRepoComponent.java
public DSDRepoComponent(Repository repository, String dataGraph, String repoGraph) { this.repository = repository; this.dataGraph = dataGraph; this.repoGraph = repoGraph; initializeRepoGraph();/*from w w w . j ava 2 s. c om*/ dcRepo = new SparqlDCRepository(repository); graph = new SparqlDCGraph(repository, dataGraph); setSizeFull(); VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull(); rootLayout.setSpacing(true); setDebugId("dsd-repo"); mainLayout = new VerticalLayout(); mainLayout.setSizeUndefined(); mainLayout.setWidth("100%"); // mainLayout.setHeight("800px"); mainLayout.setSpacing(true); HorizontalLayout menuLayout = new HorizontalLayout(); menuLayout.setSpacing(true); menuLayout.setWidth("100%"); rootLayout.addComponent(menuLayout); rootLayout.setExpandRatio(menuLayout, 0.0f); 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); Collection<DataSet> colDataSets = graph.getDataSets(); if (colDataSets == null) colDataSets = new LinkedList<DataSet>(); selectDataSet = new ComboBox(null, colDataSets); 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); Panel mainPanel = new Panel(mainLayout); mainPanel.setSizeFull(); mainPanel.setScrollable(true); mainPanel.setStyleName(Reindeer.PANEL_LIGHT); Label hrLabel = new Label("<hr/>", Label.CONTENT_XHTML); rootLayout.addComponent(hrLabel); rootLayout.setExpandRatio(hrLabel, 0.0f); rootLayout.addComponent(mainPanel); rootLayout.setExpandRatio(mainPanel, 2.0f); rootLayout.setMargin(true, false, true, false); setCompositionRoot(rootLayout); }
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();// w w w.ja v a 2 s. c om 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); }