List of usage examples for com.vaadin.ui Button setIcon
@Override public void setIcon(Resource icon)
From source file:fr.amapj.view.engine.menu.MenuPart.java
License:Open Source License
private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus, Navigator navigator, AmapUI ui) { final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top);/*from www . j av a 2s . c om*/ final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); String nomAmap = new ParametresService().getParametres().nomAmap; Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); SessionParameters p = SessionManager.getSessionParameters(); MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null); settingsItem.addItem("Se dconnecter", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { new PasswordManager().disconnect(); ui.buildLoginView(null, null, null); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); boolean first = true; String firstEntry = null; Button firstButton = null; for (MenuDescription menuDescription : allMenus) { final String view = menuDescription.getMenuName().name().toLowerCase(); final String titleView = menuDescription.getMenuName().getTitle(); if (menuDescription.getCategorie() != null) { Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML); l.setPrimaryStyleName("valo-menu-subtitle"); l.addStyleName("h4"); l.setSizeUndefined(); menuItemsLayout.addComponent(l); } final Button b = new Button(titleView, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { setSelected(event.getButton(), menuItemsLayout); navigator.navigateTo("/" + view); } }); b.setId("amapj.menu." + view); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(menuDescription.getMenuName().getFont()); menuItemsLayout.addComponent(b); viewNameToMenuButton.put("/" + view, b); if (first) { first = false; firstButton = b; firstEntry = view; } } // Gestion de l'url String f = Page.getCurrent().getUriFragment(); if (f != null && f.startsWith("!")) { f = f.substring(1); } if (f == null || f.equals("") || f.equals("/")) { navigateWithProtect(navigator, "/" + firstEntry); setSelected(firstButton, menuItemsLayout); } else { navigateWithProtect(navigator, f); setSelected(viewNameToMenuButton.get(f), menuItemsLayout); } return menu; }
From source file:fr.amapj.view.engine.popup.formpopup.AbstractFormPopup.java
License:Open Source License
protected TextField addIntegerField(String title, String propertyId, String helpContent) { TextField f = BaseUiTools.createIntegerField(null); binder.bind(f, propertyId);//from ww w. ja v a 2 s . c o m Button aide = new Button(); aide.setIcon(FontAwesome.QUESTION_CIRCLE); aide.addStyleName("borderless-colored"); aide.addStyleName("question-mark"); aide.addClickListener(e -> handleAide(helpContent)); HorizontalLayout hl = new HorizontalLayout(); hl.setCaption(title); hl.addComponent(f); hl.addComponent(aide); form.addComponent(hl); return f; }
From source file:fr.amapj.view.engine.popup.formpopup.AbstractFormPopup.java
License:Open Source License
protected Button addHelpButton(String title, String helpContent) { Button aide = new Button(title); aide.setIcon(FontAwesome.QUESTION_CIRCLE); aide.addStyleName("borderless-colored"); aide.addStyleName("question-mark"); aide.addClickListener(e -> handleAide(helpContent)); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth(100, Unit.PERCENTAGE);/*from ww w. j a va2 s.co m*/ hl.addComponent(aide); hl.setComponentAlignment(aide, Alignment.MIDDLE_RIGHT); form.addComponent(hl); return aide; }
From source file:fr.amapj.view.views.common.gapviewer.DatePerDateViewer.java
License:Open Source License
private Button addButton(boolean toRight, HorizontalLayout layout, ClickListener listener) { String str;// w w w . java 2 s .com if (toRight) { str = "SUIVANT"; } else { str = "PRECEDENT"; } Button b = new Button(str); b.addClickListener(listener); if (toRight) { b.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); b.addStyleName("icon-align-right"); b.addStyleName("large"); } else { b.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); b.addStyleName("large"); } b.addStyleName("fleche"); layout.addComponent(b); return b; }
From source file:fr.amapj.view.views.common.gapviewer.MonthViewer.java
License:Open Source License
private void addButton(boolean toRight, HorizontalLayout layout, ClickListener listener) { String str;/*from w w w .j ava2 s. c o m*/ if (BaseUiTools.isWidthBelow(480)) { if (toRight) { str = "SUIVANT"; } else { str = "PRECEDENT"; } } else { if (toRight) { str = "MOIS SUIVANT"; } else { str = "MOIS PRECEDENT"; } } Button b = new Button(str); b.addClickListener(listener); if (toRight) { b.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); b.addStyleName("icon-align-right"); b.addStyleName("large"); } else { b.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); b.addStyleName("large"); } b.addStyleName("fleche"); layout.addComponent(b); }
From source file:fr.amapj.view.views.common.gapviewer.WeekViewer.java
License:Open Source License
private void addButton(boolean toRight, HorizontalLayout layout, ClickListener listener) { String str;//from ww w . j a v a 2 s. c om if (BaseUiTools.isWidthBelow(480)) { if (toRight) { str = "SUIVANT"; } else { str = "PRECEDENT"; } } else { if (toRight) { str = "SEMAINE SUIVANTE"; } else { str = "SEMAINE PRECEDENTE"; } } Button b = new Button(str); b.addClickListener(listener); if (toRight) { b.setIcon(FontAwesome.ANGLE_DOUBLE_RIGHT); b.addStyleName("icon-align-right"); b.addStyleName("large"); } else { b.setIcon(FontAwesome.ANGLE_DOUBLE_LEFT); b.addStyleName("large"); } b.addStyleName("fleche"); layout.addComponent(b); }
From source file:fr.amapj.view.views.mescontrats.MesContratsView.java
License:Open Source License
public void refresh() { mesContratsDTO = new MesContratsService().getMesContrats(SessionManager.getUserId()); layout = this; layout.removeAllComponents();/*from www . j a v a 2s . c o m*/ // Information sur le renouvellement de l'adhsion adhesionPart.addAhesionInfo(layout); // Le titre addLabel(layout, "Les nouveaux contrats disponibles"); // la liste des nouveaux contrats List<ContratDTO> newContrats = mesContratsDTO.getNewContrats(); for (ContratDTO c : newContrats) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, true); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); Button b = addButtonInscription("S'inscrire", c); b.setWidth("100%"); b.addStyleName(BUTTON_PRINCIPAL); vl2.addComponent(b); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } // Le titre addLabel(layout, "Mes contrats existants"); // la liste des contrats existants List<ContratDTO> existingContrats = mesContratsDTO.getExistingContrats(); for (ContratDTO c : existingContrats) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, false); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); if (c.isModifiable) { Button b = addButtonInscription("Modifier", c); b.setWidth("100%"); vl2.addComponent(b); } if (c.isSupprimable) { Button b = addButtonSupprimer("Supprimer", c); b.setWidth("100%"); vl2.addComponent(b); } if (c.isJoker) { Button b = addButtonJoker("Grer jokers", c); b.setWidth("100%"); vl2.addComponent(b); } Button v = addButtonVoir("Voir", c); v.addStyleName(BUTTON_PRINCIPAL); v.setWidth("100%"); vl2.addComponent(v); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } // Le bouton pour tlcharger les contrats if (existingContrats.size() > 0) { Button telechargerButton = new Button("Imprimer mes contrats ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); layout.addComponent(telechargerButton); layout.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); } }
From source file:fr.amapj.view.views.meslivraisons.MesLivraisonsView.java
License:Open Source License
/** * /*from w ww. j av a2s. c o m*/ */ @Override public void enter() { PEMesLivraisons peMesLivraisons = (PEMesLivraisons) new ParametresService() .loadParamEcran(MenuList.MES_LIVRAISONS); semaineViewer = GapViewerUtil.createGapWiever(peMesLivraisons.modeAffichage, this); addComponent(semaineViewer.getComponent()); VerticalLayout central = new VerticalLayout(); addComponent(central); planning = new VerticalLayout(); central.addComponent(planning); livraison = new VerticalLayout(); central.addComponent(livraison); // Le bouton pour tlcharger les livraisons Button telechargerButton = new Button("Imprimer mes livraisons ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); addComponent(telechargerButton); setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); onPopupClose(); }
From source file:fr.amapj.view.views.permanence.mespermanences.MesPermanencesView.java
License:Open Source License
public void refresh() { mesContratsDTO = new MesPermanencesService().getMesPermanenceDTO(SessionManager.getUserId()); layout = this; layout.removeAllComponents();//from w w w . j a v a 2 s .co m if (mesContratsDTO.mesPeriodesPermanences.size() > 0) { // Le titre addLabel(layout, "S'inscrire aux permanences"); // la liste des inscriptions possibles for (UnePeriodePermanenceDTO c : mesContratsDTO.mesPeriodesPermanences) { Panel p = new Panel(); p.addStyleName(PANEL_UNCONTRAT); HorizontalLayout hl = new HorizontalLayout(); hl.setMargin(true); hl.setSpacing(true); hl.setWidth("100%"); VerticalLayout vl = new VerticalLayout(); Label lab = new Label(c.nom); lab.addStyleName(LABEL_TITRECONTRAT); vl.addComponent(lab); String str = formatLibelleContrat(c, true); BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat"); hl.addComponent(vl); hl.setExpandRatio(vl, 1); VerticalLayout vl2 = new VerticalLayout(); vl2.setWidth("115px"); vl2.setSpacing(true); String libButton = getLibButton(c); Button b = addButtonInscription(libButton, c); b.setWidth("100%"); b.addStyleName(BUTTON_PRINCIPAL); vl2.addComponent(b); hl.addComponent(vl2); hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER); p.setContent(hl); layout.addComponent(p); } } // addLabel(layout, "Les dates de mes permanences"); VerticalLayout vl1 = BaseUiTools.addPanel(this, "mes-permanences"); String mesPermanences = getLibMesPermanences(); BaseUiTools.addHtmlLabel(vl1, mesPermanences, "ligne"); addLabel(layout, "Consulter les plannings de permanence"); VerticalLayout vl2 = BaseUiTools.addPanel(this, "mes-permanences"); // Le bouton pour visualiser les permanences en ligne Button onLineButton = new Button("Visualiser les plannings de permanence ..."); onLineButton.setIcon(FontAwesome.EYE); onLineButton.addStyleName("borderless"); onLineButton.addStyleName("large"); onLineButton.addClickListener(e -> handleVisualiser()); vl2.addComponent(onLineButton); vl2.setComponentAlignment(onLineButton, Alignment.MIDDLE_LEFT); // Le bouton pour tlcharger les permanences Button telechargerButton = new Button("Tlcharger les plannings de permanence au format tableur ..."); telechargerButton.setIcon(FontAwesome.PRINT); telechargerButton.addStyleName("borderless"); telechargerButton.addStyleName("large"); telechargerButton.addClickListener(e -> handleTelecharger()); vl2.addComponent(telechargerButton); vl2.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT); }
From source file:fr.amapj.view.views.producteur.livraison.ProducteurLivraisonsView.java
License:Open Source License
@Override public void onPopupClose() { Long idProducteur = producteurSelector.getProducteurId(); if (idProducteur == null) { central.removeAllComponents();/*from w ww . j ava 2s. c om*/ return; } // MesLivraisonsDTO res = new MesLivraisonsService().getLivraisonProducteur(gapViewer.getDateDebut(), gapViewer.getDateFin(), idProducteur); central.removeAllComponents(); // Pour chaque jour, ajout des produits livrer for (JourLivraisonsDTO jour : res.jours) { VerticalLayout vl = BaseUiTools.addPanel(central, PANEL_UNJOUR); String dateMessage = df1.format(jour.date); BaseUiTools.addStdLabel(vl, dateMessage, LABEL_DATEJOURLIV); for (ProducteurLivraisonsDTO producteurLiv : jour.producteurs) { BaseUiTools.addBandeau(vl, producteurLiv.modeleContrat, "nomcontrat"); String msg = "<b>Quantits totales livrer :</b><ul>"; for (QteProdDTO cell : producteurLiv.produits) { msg += "<li>" + cell.qte + " " + cell.nomProduit + " , " + cell.conditionnementProduit + "</li>"; } msg += "</ul>"; BaseUiTools.addHtmlLabel(vl, msg, LABEL_QTEPRODUIT); Button b = new Button("Voir le dtail par amapien"); b.setIcon(FontAwesome.CHEVRON_DOWN); vl.addComponent(b); Label detail = BaseUiTools.addHtmlLabel(vl, "", LABEL_QTEPRODUIT); b.addStyleName("icon-align-right"); b.addStyleName("large"); b.addClickListener(e -> buttonClick(detail, b, producteurLiv.idModeleContratDate)); b.setData(new Boolean(false)); // Link extractFile = LinkCreator.createLink(new EGFeuilleDistributionProducteur( producteurLiv.idModeleContrat, producteurLiv.idModeleContratDate)); vl.addComponent(extractFile); } } }