List of usage examples for com.vaadin.ui.themes ValoTheme MENU_ITEM
String MENU_ITEM
To view the source code for com.vaadin.ui.themes ValoTheme MENU_ITEM.
Click Source Link
Set the primary style name of a Button to this style name to create a clickable menu item in the menu.
From source file:fr.univlorraine.mondossierweb.MainUI.java
License:Apache License
/** * Ajout d'un item dans le menu tudiant//from w w w . j a v a2 s . co m * @param caption * @param viewName * @param icon */ private void addItemMenu(String caption, String viewName, com.vaadin.server.Resource icon) { //Cration du bouton Button itemBtn = new Button(caption, icon); itemBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM); //Gestion du clic sur le bouton itemBtn.addClickListener(e -> navigator.navigateTo(viewName)); viewButtons.put(viewName, itemBtn); //Ajout du bouton au menu mainMenu.addComponent(itemBtn); }
From source file:io.mateu.ui.vaadin.framework.MyUI.java
License:Apache License
/** * construye una opcin del men// w w w.java2s . co m * */ private void addMenu(AbstractArea area, MenuEntry e) { Button b = null; if (e instanceof AbstractMenu) { b = new Button(e.getName(), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setAreaActual(area); setMenuActual(e); Page.getCurrent().open("#!" + getApp().getAreaId(area) + "/" + getApp().getMenuId(e) + "/menu", (event.isAltKey() || event.isCtrlKey()) ? "_blank" : Page.getCurrent().getWindowName()); } }); b.setCaption(b.getCaption() + " <span class=\"valo-menu-badge\">" + ((AbstractMenu) e).getEntries().size() + "</span>"); } if (e instanceof AbstractAction) { b = new Button(e.getName(), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { setAreaActual(area); setMenuActual(e); ((AbstractAction) e).setModifierPressed(event.isAltKey() || event.isCtrlKey()).run(); } }); } if (b != null) { b.setCaptionAsHtml(true); b.setPrimaryStyleName(ValoTheme.MENU_ITEM); //b.setIcon(testIcon.get()); // sin iconos en el men menuItemsLayout.addComponent(b); botonesMenu.put(e, b); } }
From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java
License:Open Source License
/** * Creates the wrapper which contains the menu item and the adjacent label * for displaying the occurred events//from w ww . j a va2 s . c o m * * @param menuItemButton * the menu item * @param notificationLabel * the label for displaying the occurred events * @return Component of type CssLayout */ private static Component buildLabelWrapper(final ValoMenuItemButton menuItemButton, final Component notificationLabel) { final CssLayout dashboardWrapper = new CssLayout(menuItemButton); dashboardWrapper.addStyleName("labelwrapper"); dashboardWrapper.addStyleName(ValoTheme.MENU_ITEM); notificationLabel.addStyleName(ValoTheme.MENU_BADGE); notificationLabel.setWidthUndefined(); notificationLabel.setVisible(false); notificationLabel .setId(UIComponentIdProvider.NOTIFICATION_MENU_ID + menuItemButton.getCaption().toLowerCase()); dashboardWrapper.addComponent(notificationLabel); return dashboardWrapper; }
From source file:org.geant.sat.ui.MainView.java
License:BSD License
/** * Create button for menu./* ww w . ja v a 2 s .c o m*/ * * @param caption * for the button. * @param menuListenerName * listener for button. * @return Button as Component. */ private Component createMenuButton(String caption, String menuListenerName) { Button button = new Button(caption, new ButtonListener(menuListenerName)); button.setPrimaryStyleName(ValoTheme.MENU_ITEM); return (Component) button; }
From source file:org.jpos.qi.Sidebar.java
License:Open Source License
@SuppressWarnings("unchecked") private void loadSideBarOptions(String id) { if (id != null && id.equals(currentSidebarId)) return;/*ww w .j a v a 2 s. c o m*/ options = new LinkedHashMap<>(); if (menuItems != null) removeComponent(menuItems); currentSidebarId = id; menuItems = new CssLayout(); menuItems.setPrimaryStyleName("valo-menuitems"); Element cfg = app.getXmlConfiguration(); for (Element sb : cfg.getChildren("sidebar")) { String eid = sb.getAttributeValue("id"); if (id == eid || (eid != null && eid.equals(id))) { for (Element e : sb.getChildren()) { if ("section".equals(e.getName())) { Label l = new Label(e.getAttributeValue("name")); l.setStyleName(ValoTheme.MENU_SUBTITLE); l.setSizeUndefined(); menuItems.addComponent(l); } else if ("option".equals(e.getName())) { if (((QINavigator) QI.getQI().getNavigator()) .hasAccessToRoute(e.getAttributeValue("action"))) { Button b = new Button(e.getAttributeValue("name")); b.setPrimaryStyleName(ValoTheme.MENU_ITEM); String iconName = e.getAttributeValue("icon"); if (iconName != null) { try { b.setIcon(FontAwesome.valueOf(iconName)); } catch (IllegalArgumentException ex) { b.setIcon(FontAwesome.EXCLAMATION_TRIANGLE); b.setEnabled(false); } } String action = e.getAttributeValue("action"); options.put(action, b); if (action != null) b.addClickListener((Button.ClickListener) event -> app.getNavigator() .navigateTo("/" + action)); menuItems.addComponent(b); } } } addComponent(menuItems); } } }