List of usage examples for com.vaadin.server FontAwesome STAR_O
FontAwesome STAR_O
To view the source code for com.vaadin.server FontAwesome STAR_O.
Click Source Link
From source file:com.dungnv.streetfood.ui.DishItemUI.java
private void buildAction() { if ("1".equals(item.getDishStatus())) { lbTitle.addStyleName("lb-status-active"); } else {/* ww w . ja v a 2 s .c o m*/ lbTitle.addStyleName("lb-status-inActive"); } String info = !StringUtils.isNullOrEmpty(item.getId()) ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId() + "</b>" : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>"; info += !StringUtils.isNullOrEmpty(item.getRating()) ? " |" + FontAwesome.STAR_O.getHtml() + "  :  " + item.getRating() : " |" + FontAwesome.STAR_O.getHtml() + "  :  --"; info += !StringUtils.isNullOrEmpty(item.getViewCount()) ? " |" + FontAwesome.EYE.getHtml() + "  :  " + item.getViewCount() : " |" + FontAwesome.EYE.getHtml() + "  :  --"; info += !StringUtils.isNullOrEmpty(item.getCommentCount()) ? " |" + FontAwesome.COMMENTS.getHtml() + "  :  " + item.getCommentCount() : " |" + FontAwesome.COMMENTS.getHtml() + "  :  --"; info += !StringUtils.isNullOrEmpty(item.getShareCount()) ? " |" + FontAwesome.SHARE_ALT.getHtml() + "  :  " + item.getShareCount() : " |" + FontAwesome.SHARE_ALT.getHtml() + "  :  --"; if (!StringUtils.isNullOrEmpty(info)) { lbInfo.setCaption(info); } btnEdit.addClickListener((Button.ClickEvent event) -> { if (item != null) { DishInsert dishInsert = new DishInsert(item// , event.getButton().findAncestor(DishView.class)// , Constants.ACTION.UPDATE); dishInsert.setWidth("80%"); dishInsert.setHeight("90%"); dishInsert.setModal(true); FWUtils.reloadWindow(dishInsert); UI.getCurrent().addWindow(dishInsert); } }); btnLink.addClickListener((Button.ClickEvent event) -> { if (item != null) { DishLink dishLink = new DishLink(item); dishLink.setWidth("80%"); dishLink.setHeight("75%"); dishLink.setModal(true); FWUtils.reloadWindow(dishLink); UI.getCurrent().addWindow(dishLink); } }); btnDelete.addClickListener((Button.ClickEvent event) -> { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getLanguage("lbl.confirm")// , BundleUtils.getLanguage("message.category.delete.confirm")// , BundleUtils.getLanguage("lbl.yes")// , BundleUtils.getLanguage("lbl.no")// , (ConfirmDialog cd) -> { if (cd.isConfirmed()) { UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName()); ResultDTO result = ClientServiceImpl.getInstance().deleteDish(user.getUsername()// , getLocale().getLanguage(), getLocale().getCountry(), null, Long.valueOf(itemId)); if (result != null && Constants.SUCCESS.equals(result.getMessage())) { mainView.onSearch(Boolean.TRUE); UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class)); } else { Notification.show( result == null || result.getKey() == null ? Constants.FAIL : result.getKey(), Notification.Type.ERROR_MESSAGE); } } }); }); }
From source file:com.dungnv.streetfood.ui.RestaurantItemUI.java
private void buildAction() { if ("1".equals(item.getRestaurantStatus())) { lbTitle.addStyleName("lb-status-active"); } else {/*from www .ja va 2 s .co m*/ lbTitle.addStyleName("lb-status-inActive"); } String info = !StringUtils.isNullOrEmpty(item.getId()) ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId() + "</b>" : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>"; info += !StringUtils.isNullOrEmpty(item.getRating()) ? " |" + FontAwesome.STAR_O.getHtml() + "  :  " + item.getRating() : " |" + FontAwesome.STAR_O.getHtml() + "  :  --"; info += !StringUtils.isNullOrEmpty(item.getViewCount()) ? " |" + FontAwesome.EYE.getHtml() + "  :  " + item.getViewCount() : " |" + FontAwesome.EYE.getHtml() + "  :  --"; info += !StringUtils.isNullOrEmpty(item.getCommentCount()) ? " |" + FontAwesome.COMMENTS.getHtml() + "  :  " + item.getCommentCount() : " |" + FontAwesome.COMMENTS.getHtml() + "  :  --"; info += !StringUtils.isNullOrEmpty(item.getShareCount()) ? " |" + FontAwesome.SHARE_ALT.getHtml() + "  :  " + item.getShareCount() : " |" + FontAwesome.SHARE_ALT.getHtml() + "  :  --"; // // info += !StringUtils.isNullOrEmpty(item.getOperatingTimeStart()) // ? " |" + FontAwesome.CLOCK_O.getHtml() + "  :  " + item.getOperatingTimeStart() + " / " // : " |" + FontAwesome.CLOCK_O.getHtml() + "  :  --:--" + " / "; // // info += !StringUtils.isNullOrEmpty(item.getOperatingTimeEnd()) // ? item.getOperatingTimeEnd() : "--:--" ; if (!StringUtils.isNullOrEmpty(info)) { lbInfo.setCaption(info); } btnEdit.addClickListener((Button.ClickEvent event) -> { if (item != null) { RestaurantInsert restaurantInsert = new RestaurantInsert(item// , event.getButton().findAncestor(RestaurantView.class)// , Constants.ACTION.UPDATE); restaurantInsert.setWidth("80%"); restaurantInsert.setHeight("90%"); restaurantInsert.setModal(true); FWUtils.reloadWindow(restaurantInsert); UI.getCurrent().addWindow(restaurantInsert); } }); btnLink.addClickListener((Button.ClickEvent event) -> { if (item != null) { RestaurantLink restaurantLink = new RestaurantLink(item); restaurantLink.setWidth("80%"); restaurantLink.setHeight("75%"); restaurantLink.setModal(true); FWUtils.reloadWindow(restaurantLink); UI.getCurrent().addWindow(restaurantLink); } }); btnDelete.addClickListener((Button.ClickEvent event) -> { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getLanguage("lbl.confirm")// , BundleUtils.getLanguage("message.category.delete.confirm")// , BundleUtils.getLanguage("lbl.yes")// , BundleUtils.getLanguage("lbl.no")// , (ConfirmDialog cd) -> { if (cd.isConfirmed()) { UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName()); ResultDTO result = ClientServiceImpl.getInstance().deleteRestaurant(user.getUsername()// , getLocale().getLanguage(), getLocale().getCountry(), null, Long.valueOf(itemId)); if (result != null && Constants.SUCCESS.equals(result.getMessage())) { mainView.onSearch(Boolean.TRUE); UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class)); } else { Notification.show( result == null || result.getKey() == null ? Constants.FAIL : result.getKey(), Notification.Type.ERROR_MESSAGE); } } }); }); }
From source file:de.fatalix.bookery.view.common.BookDetailLayout.java
License:Open Source License
private HorizontalLayout createImageLayout() { image = new Image(); image.setImmediate(true);/*from w w w . j av a 2 s . c om*/ image.setHeight("200px"); image.setWidth("130px"); downloadButton = new Button("download", FontAwesome.DOWNLOAD); downloadButton.addStyleName(ValoTheme.BUTTON_FRIENDLY); downloadButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { loadData(presenter.updateShared(bookEntry, SecurityUtils.getSubject().getPrincipal().toString())); } catch (SolrServerException | IOException ex) { Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); logger.error(ex, ex); } } }); fileDownloader = new FileDownloader(new StreamResource(new BookStreamSource(null), "blbla.epub")); fileDownloader.extend(downloadButton); sendToKindleButton = new Button("Kindle", FontAwesome.BOOK); sendToKindleButton.addStyleName(ValoTheme.BUTTON_FRIENDLY); sendToKindleButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.shareBookWithKindle(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); Notification.show("Book is sent to kindle", Notification.Type.HUMANIZED_MESSAGE); loadData(presenter.updateShared(bookEntry, SecurityUtils.getSubject().getPrincipal().toString())); } catch (SolrServerException | IOException | MessagingException ex) { Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); logger.error(ex, ex); } } }); likeButton = new Button("0 likes", FontAwesome.THUMBS_O_UP); likeButton.addStyleName(ValoTheme.BUTTON_LINK); likeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { BookEntry updatedEntry = presenter.updateLike(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); loadData(updatedEntry); } catch (SolrServerException | IOException ex) { Notification.show("Unexpected Error!\n" + ex.getMessage(), Notification.Type.ERROR_MESSAGE); logger.error(ex, ex); } } }); watchListButton = new Button("merken", FontAwesome.STAR_O); watchListButton.addStyleName(ValoTheme.BUTTON_LINK); watchListButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { presenter.addRemoveFromWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); loadData(bookEntry); } }); downloadCount = new Label("0 downloads"); VerticalLayout rightLayout = new VerticalLayout(sendToKindleButton, downloadButton, watchListButton, likeButton, downloadCount); rightLayout.setComponentAlignment(downloadCount, Alignment.MIDDLE_CENTER); rightLayout.setSpacing(true); HorizontalLayout layout = new HorizontalLayout(image, rightLayout); layout.setSpacing(true); return layout; }
From source file:de.fatalix.bookery.view.common.BookDetailLayout.java
License:Open Source License
public void loadData(BookEntry bookEntry) { this.bookEntry = bookEntry; titleLabel.setValue(bookEntry.getTitle() + "-" + bookEntry.getAuthor()); descriptionLabel.setValue(bookEntry.getDescription()); StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover()); image.setSource(new StreamResource(source, bookEntry.getId() + ".png")); likeButton.setCaption(bookEntry.getLikes() + " likes"); downloadCount.setValue(bookEntry.getDownloads() + " downloads"); try {/* w ww . j a va2 s. c o m*/ byte[] data = presenter.getEbookFile(bookEntry.getId()); fileDownloader.setFileDownloadResource(new StreamResource(new BookStreamSource(data), bookEntry.getTitle() + "-" + bookEntry.getAuthor() + ".epub")); } catch (SolrServerException ex) { logger.error(ex, ex); } if (presenter.isOnWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString())) { watchListButton.setCaption("vergessen"); watchListButton.setIcon(FontAwesome.STAR); } else { watchListButton.setCaption("merken"); watchListButton.setIcon(FontAwesome.STAR_O); } }
From source file:de.fatalix.bookery.view.common.BookSearchLayout.java
License:Open Source License
private VerticalLayout createBookCoverLayout(final BookEntry bookEntry) { Image image = new Image(); image.setDescription(bookEntry.getTitle() + " von " + bookEntry.getAuthor()); image.setHeight("200px"); image.setWidth("130px"); image.setImmediate(true);/*w ww . j av a 2 s . c o m*/ if (bookEntry.getThumbnail() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getThumbnail()); image.setSource(new StreamResource(source, bookEntry.getId() + "_thumb.png")); } else if (bookEntry.getCover() != null) { StreamResource.StreamSource source = new ByteStreamResource(bookEntry.getCover()); image.setSource(new StreamResource(source, bookEntry.getId() + ".png")); } final MButton watchListButton = new MButton() .withIcon(presenter.isOnWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR : FontAwesome.STAR_O) .withStyleName(ValoTheme.BUTTON_LINK); watchListButton.addStyleName("quick-action"); watchListButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { watchListButton.setIcon(presenter.addRemoveFromWatchList(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()) ? FontAwesome.STAR : FontAwesome.STAR_O); } }); final MButton likeButton = new MButton().withCaption("" + bookEntry.getLikes()) .withIcon(FontAwesome.THUMBS_O_UP).withStyleName(ValoTheme.BUTTON_LINK); likeButton.addStyleName("quick-action"); likeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { BookEntry updatedBook = presenter.updateLike(bookEntry, SecurityUtils.getSubject().getPrincipal().toString()); bookEntry.setLikes(updatedBook.getLikes()); bookEntry.setLikedby(updatedBook.getLikedby()); likeButton.setCaption("" + bookEntry.getLikes()); } catch (SolrServerException | IOException ex) { java.util.logging.Logger.getLogger(BookSearchLayout.class.getName()).log(Level.SEVERE, null, ex); } } }); final MButton downloadsButton = new MButton().withCaption("" + bookEntry.getDownloads()) .withIcon(FontAwesome.DOWNLOAD).withStyleName(ValoTheme.BUTTON_LINK); downloadsButton.addStyleName("quick-action"); HorizontalLayout quickActionLayout = new HorizontalLayout(watchListButton, likeButton, downloadsButton); quickActionLayout.addStyleName("quick-action-layout"); VerticalLayout result = new VerticalLayout(image, quickActionLayout); //result.setHeight("210px"); //result.setWidth("140px"); result.addStyleName("pointer-cursor"); result.addStyleName("book-card"); result.setComponentAlignment(image, Alignment.MIDDLE_CENTER); result.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { bookDetailLayout.loadData(bookEntry); bookDetailLayout.setLayoutVisible(true); //BookDetailDialog dialogInstance = bookDetail.get(); //dialogInstance.loadData(bookEntry); //UI.getCurrent().addWindow(dialogInstance); } }); return result; }
From source file:fr.univlorraine.mondossierweb.MainUI.java
License:Apache License
/** * Cration des onglets pour l'enseignant *//*w w w . j a v a 2 s . c om*/ private void ajoutOngletRecherche() { tabSheetEnseignant.setSizeFull(); //Onglet recherche rapide tabSheetEnseignant.addTab(rechercheRapideView, applicationContext.getMessage("mainUI.rechercherapide.title", null, getLocale()), FontAwesome.SEARCH); viewEnseignantTab.put(rechercheRapideView.NAME, 0); //Onglet recherche arborescente tabSheetEnseignant.addTab(rechercheArborescenteView, applicationContext.getMessage("mainUI.recherchearbo.title", null, getLocale()), FontAwesome.SITEMAP); viewEnseignantTab.put(rechercheArborescenteView.NAME, 1); //Onglet favoris tabSheetEnseignant.addTab(favorisView, "Favoris", FontAwesome.STAR_O); viewEnseignantTab.put(favorisView.NAME, 2); //On gre le changement d'onglet effectu par l'utilisateur tabSheetEnseignant.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() { public void selectedTabChange(SelectedTabChangeEvent event) { //On rcupre le tabSheet TabSheet tabsheet = event.getTabSheet(); //On rcupre la vue afficher View vue = (View) tabsheet.getSelectedTab(); //Si l'utilisateur veut afficher la vue des favoris if (vue instanceof FavorisView) { //On initialise la vue favorisView.init(); } //Si l'utilisateur veut afficher la vue de la liste des inscrits if (vue instanceof ListeInscritsView) { //On refresh la vue listeInscritsView.refresh(); } //Si l'utilisateur veut afficher la vue de la recherche arborescente if (vue instanceof RechercheArborescenteView) { //On refresh la vue rechercheArborescenteView.refresh(); } } }); //Ajout de l'onglet contenant la liste des inscrits addTabListeInscrits(); //Ajout du tabSheet dans le layout layoutOngletRecherche.addComponent(tabSheetEnseignant); //On passe le layout en sizeFull layoutOngletRecherche.setSizeFull(); //Le tabSheet prend toute la place disponible dans le layout layoutOngletRecherche.setExpandRatio(tabSheetEnseignant, 1); }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsMobileView.java
License:Apache License
/** * Initialise la vue/*from ww w . j ava2 s . co m*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) { // On rinitialise la vue removeAllComponents(); // Style setSizeFull(); addStyleName("v-noscrollableelement"); // On rcupre le favori afficher typeFavori = MdwTouchkitUI.getCurrent().getTypeObjListInscrits(); libelleObj = ""; if (typeIsVet() && MdwTouchkitUI.getCurrent().getEtapeListeInscrits() != null) { libelleObj = MdwTouchkitUI.getCurrent().getEtapeListeInscrits().getLibelle(); } if (typeIsElp() && MdwTouchkitUI.getCurrent().getElpListeInscrits() != null) { libelleObj = MdwTouchkitUI.getCurrent().getElpListeInscrits().getLibelle(); } //Rcupration de la liste des inscrits List<Inscrit> linscrits = MdwTouchkitUI.getCurrent().getListeInscrits(); //Rcupration du nombre d'inscrit par page nbEtuParPage = configController.getTrombiMobileNbEtuParPage(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getTrombinoscopeFromView() != null && MdwTouchkitUI.getCurrent().getTrombinoscopeFromView().equals(FavorisMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateTofavoris(); } if (MdwTouchkitUI.getCurrent().getTrombinoscopeFromView() != null && MdwTouchkitUI.getCurrent().getTrombinoscopeFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); //Title Label labelTrombi = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale())); labelTrombi.setStyleName("v-label-navbar"); navbar.addComponent(labelTrombi); navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER); // bouton pour ajouter en favori si ce n'est pas dj le cas List<Favoris> lfav = favorisController.getFavoris(); FavorisPK favpk = new FavorisPK(); favpk.setLogin(userController.getCurrentUserName()); favpk.setIdfav(MdwTouchkitUI.getCurrent().getCodeObjListInscrits()); favpk.setTypfav(typeFavori); Favoris favori = new Favoris(); favori.setId(favpk); //Si l'objet n'est pas dj en favori if (lfav != null && !lfav.contains(favori)) { //Cration du bouton pour ajouter l'objet aux favoris Button btnAjoutFavori = new Button("+"); btnAjoutFavori.setIcon(FontAwesome.STAR_O); btnAjoutFavori.setStyleName("v-nav-button"); btnAjoutFavori.addClickListener(e -> { //creation du favori en base sur le clic du bouton favorisController.saveFavori(favori); //On cache le bouton de mise en favori btnAjoutFavori.setVisible(false); //Affichage d'un message de confirmation Notification.show( applicationContext.getMessage(NAME + ".message.favoriAjoute", null, getLocale()), Type.TRAY_NOTIFICATION); }); //Ajout du bouton l'interface navbar.addComponent(btnAjoutFavori); } //Bouton Filtre //On a la possibilit de filtrer le trombinoscope que si on est positionn sur un ELP if (typeIsElp()) { FiltreInscritsMobileWindow w = new FiltreInscritsMobileWindow(); //Si on a des lments afficher dans la popup filtre if ((w.getListeEtapes() != null && w.getListeEtapes().size() > 0) || (w.getListeGroupes() != null && w.getListeGroupes().size() > 0)) { filterButton = new Button(); filterButton.setIcon(FontAwesome.ELLIPSIS_V); filterButton.setStyleName("v-nav-button"); filterButton.addClickListener(e -> { w.addCloseListener(f -> { //Si la personne a ferm la popup en appuyant sur le bouton FILTRER if (w.isDemandeFiltrage()) { vetSelectionnee = w.getVetSelectionnee(); groupeSelectionne = w.getGroupeSelectionne(); displayTrombinoscope(false); } }); UI.getCurrent().addWindow(w); }); navbar.addComponent(filterButton); navbar.setComponentAlignment(filterButton, Alignment.MIDDLE_RIGHT); } } navbar.setExpandRatio(labelTrombi, 1); addComponent(navbar); //Test si la liste contient des tudiants if (linscrits != null && linscrits.size() > 0) { pageEnCours = 1; //Calcul du nombre maxi de page if (nbEtuParPage > 0 && linscrits.size() > nbEtuParPage) { pageMax = (linscrits.size() / nbEtuParPage) + 1; } else { //On affiche tous les inscrits sur une seule page pageMax = 1; } infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); infoLayout.setMargin(true); infoLayout.setSpacing(true); infoLayout.addStyleName("v-scrollableelement"); //Layout avec le Libelle HorizontalLayout resumeLayout = new HorizontalLayout(); resumeLayout.setWidth("100%"); resumeLayout.setHeight("20px"); //Label affichant le nb d'inscrits infoLibelleObj = new Label(libelleObj); infoLibelleObj.setStyleName(ValoTheme.LABEL_SMALL); infoLibelleObj.setSizeFull(); resumeLayout.addComponent(infoLibelleObj); resumeLayout.setComponentAlignment(infoLibelleObj, Alignment.TOP_CENTER); infoLayout.addComponent(resumeLayout); //Layout qui contient la liste des inscrits et le trombinoscope dataLayout = new VerticalLayout(); dataLayout.setSizeFull(); //Layout contenant le gridLayout correspondant au trombinoscope verticalLayoutForTrombi = new VerticalLayout(); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.addStyleName("v-scrollablepanel"); //Cration du trombinoscope displayTrombinoscope(false); verticalLayoutForTrombi.addComponent(trombiLayout); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.setHeight(null); if (pageMax > 1) { HorizontalLayout layoutPagination = new HorizontalLayout(); layoutPagination.setWidth("100%"); layoutPagination.setMargin(true); if (pageEnCours < pageMax) { Button btnNext = new Button( applicationContext.getMessage(NAME + ".btn.affichersuite", null, getLocale())); btnNext.setStyleName(ValoTheme.BUTTON_PRIMARY); btnNext.addStyleName("v-popover-button"); btnNext.addClickListener(e -> { pageEnCours++; displayTrombinoscope(true); if (pageEnCours >= pageMax) { btnNext.setVisible(false); } }); layoutPagination.addComponent(btnNext); layoutPagination.setComponentAlignment(btnNext, Alignment.MIDDLE_CENTER); layoutPagination.setExpandRatio(btnNext, 1); } verticalLayoutForTrombi.addComponent(layoutPagination); } //Le layout contient le trombi afficher dataLayout.addComponent(verticalLayoutForTrombi); infoLayout.addComponent(dataLayout); infoLayout.setExpandRatio(dataLayout, 1); addComponent(infoLayout); setExpandRatio(infoLayout, 1); } else { // Layout contenant le label du message indiquant aucun inscrit infoLayout = new VerticalLayout(); infoLayout.setMargin(true); infoLayout.setSpacing(true); // Label du message indiquant aucun inscrit Label infoAucuninscrit = new Label( applicationContext.getMessage(NAME + ".message.aucuninscrit", null, getLocale())); infoAucuninscrit.setSizeFull(); // Ajout du label au layout infoLayout.addComponent(infoAucuninscrit); addComponent(infoLayout); setExpandRatio(infoLayout, 1); } } }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsView.java
License:Apache License
public void initListe() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && userController.isEnseignant()) { // initialisation de la vue removeAllComponents();// w ww .ja va 2s . c o m listeEtapes = null; listeGroupes = null; // Style setMargin(true); setSpacing(true); setSizeFull(); // Rcupration de l'objet de la SE dont on doit afficher les inscrits code = MainUI.getCurrent().getCodeObjListInscrits(); typeFavori = MainUI.getCurrent().getTypeObjListInscrits(); libelleObj = ""; if (typeIsVet() && MainUI.getCurrent().getEtapeListeInscrits() != null) { libelleObj = MainUI.getCurrent().getEtapeListeInscrits().getLibelle(); } if (typeIsElp() && MainUI.getCurrent().getElpListeInscrits() != null) { libelleObj = MainUI.getCurrent().getElpListeInscrits().getLibelle(); } // Si l'objet est renseign if (code != null && typeFavori != null) { //Panel contenant les filtres d'affichage et le bouton de mise en favori HorizontalLayout panelLayout = new HorizontalLayout(); panelLayout.setSizeFull(); panelLayout.addStyleName("small-font-element"); // Layout contenant les filtres FormLayout formInscritLayout = new FormLayout(); formInscritLayout.setStyleName(ValoTheme.FORMLAYOUT_LIGHT); formInscritLayout.setSpacing(true); formInscritLayout.setMargin(true); panelFormInscrits = new Panel(code + " " + libelleObj); //Affichage d'une liste droulante contenant la liste des annes List<String> lannees = MainUI.getCurrent().getListeAnneeInscrits(); if (lannees != null && lannees.size() > 0) { listeAnnees = new ComboBox(applicationContext.getMessage(NAME + ".annee", null, getLocale())); listeAnnees.setPageLength(5); listeAnnees.setTextInputAllowed(false); listeAnnees.setNullSelectionAllowed(false); listeAnnees.setWidth("150px"); for (String annee : lannees) { listeAnnees.addItem(annee); int anneenplusun = Integer.parseInt(annee) + 1; listeAnnees.setItemCaption(annee, annee + "/" + anneenplusun); } listeAnnees.setValue(MainUI.getCurrent().getAnneeInscrits()); //Gestion de l'vnement sur le changement d'anne listeAnnees.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String selectedValue = (String) event.getProperty().getValue(); //faire le changement Map<String, String> parameterMap = new HashMap<>(); parameterMap.put("code", code); parameterMap.put("type", typeFavori); //rcupration de la nouvelle liste if (typeIsVet()) { listeInscritsController.recupererLaListeDesInscrits(parameterMap, selectedValue, MainUI.getCurrent()); } if (typeIsElp()) { listeInscritsController.recupererLaListeDesInscritsELP(parameterMap, selectedValue, MainUI.getCurrent()); } //update de l'affichage initListe(); } }); formInscritLayout.addComponent(listeAnnees); } //Si on affiche la liste des inscrits un ELP //on doit affiche l'tape d'appartenance et ventuellement les groupes //Affichage d'une liste droulante contenant la liste des annes if (typeIsElp()) { List<VersionEtape> letapes = MainUI.getCurrent().getListeEtapesInscrits(); if (letapes != null && letapes.size() > 0) { listeEtapes = new ComboBox( applicationContext.getMessage(NAME + ".etapes", null, getLocale())); listeEtapes.setPageLength(5); listeEtapes.setNullSelectionAllowed(false); listeEtapes.setTextInputAllowed(false); listeEtapes.setRequired(false); listeEtapes.setWidth("400px"); listeEtapes.addItem(TOUTES_LES_ETAPES_LABEL); listeEtapes.setItemCaption(TOUTES_LES_ETAPES_LABEL, TOUTES_LES_ETAPES_LABEL); for (VersionEtape etape : letapes) { String idEtape = etape.getId().getCod_etp() + "/" + etape.getId().getCod_vrs_vet(); listeEtapes.addItem(idEtape); listeEtapes.setItemCaption(idEtape, "[" + idEtape + "] " + etape.getLib_web_vet()); } if (MainUI.getCurrent().getEtapeInscrits() != null) { listeEtapes.setValue(MainUI.getCurrent().getEtapeInscrits()); } else { listeEtapes.setValue(TOUTES_LES_ETAPES_LABEL); } //Gestion de l'vnement sur le changement d'tape listeEtapes.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String vetSelectionnee = (String) event.getProperty().getValue(); if (vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) { vetSelectionnee = null; } MainUI.getCurrent().setEtapeInscrits(vetSelectionnee); //faire le changement String groupeSelectionne = ((listeGroupes != null && listeGroupes.getValue() != null) ? (String) listeGroupes.getValue() : null); if (groupeSelectionne != null && groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) { groupeSelectionne = null; } filtrerInscrits(vetSelectionnee, groupeSelectionne); } }); formInscritLayout.addComponent(listeEtapes); } List<ElpDeCollection> lgroupes = MainUI.getCurrent().getListeGroupesInscrits(); if (lgroupes != null && lgroupes.size() > 0) { listeGroupes = new ComboBox(); listeGroupes.setPageLength(5); listeGroupes.setNullSelectionAllowed(false); listeGroupes.setTextInputAllowed(false); listeGroupes.setRequired(false); listeGroupes.setStyleName(ValoTheme.COMBOBOX_BORDERLESS); listeGroupes.setWidth("348px"); listeGroupes.addItem(TOUS_LES_GROUPES_LABEL); listeGroupes.setItemCaption(TOUS_LES_GROUPES_LABEL, TOUS_LES_GROUPES_LABEL); for (ElpDeCollection edc : lgroupes) { for (CollectionDeGroupes cdg : edc.getListeCollection()) { for (Groupe groupe : cdg.getListeGroupes()) { listeGroupes.addItem(groupe.getCleGroupe()); listeGroupes.setItemCaption(groupe.getCleGroupe(), groupe.getLibGroupe()); } } } if (MainUI.getCurrent().getGroupeInscrits() != null) { listeGroupes.setValue(MainUI.getCurrent().getGroupeInscrits()); } else { listeGroupes.setValue(TOUS_LES_GROUPES_LABEL); } //Gestion de l'vnement sur le changement de groupe listeGroupes.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String grpSelectionnee = (String) event.getProperty().getValue(); if (grpSelectionnee.equals(TOUS_LES_GROUPES_LABEL)) { grpSelectionnee = null; } MainUI.getCurrent().setGroupeInscrits(grpSelectionnee); //faire le changement String etapeSelectionnee = ((listeEtapes != null && listeEtapes.getValue() != null) ? (String) listeEtapes.getValue() : null); if (etapeSelectionnee != null && etapeSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) { etapeSelectionnee = null; } filtrerInscrits(etapeSelectionnee, grpSelectionnee); } }); HorizontalLayout gpLayout = new HorizontalLayout(); gpLayout.setCaption(applicationContext.getMessage(NAME + ".groupes", null, getLocale())); gpLayout.setMargin(false); gpLayout.setSpacing(false); gpLayout.addComponent(listeGroupes); Button btnDetailGpe = new Button(); btnDetailGpe.setWidth("52px"); btnDetailGpe.setHeight("32px"); btnDetailGpe.setStyleName(ValoTheme.BUTTON_PRIMARY); btnDetailGpe.setIcon(FontAwesome.SEARCH); btnDetailGpe.setDescription( applicationContext.getMessage(NAME + ".detail.groupes", null, getLocale())); btnDetailGpe.addClickListener(e -> { String vet = null; if (listeEtapes != null && listeEtapes.getValue() != null && !listeEtapes.getValue().equals(TOUTES_LES_ETAPES_LABEL)) { vet = listeEtapes.getItemCaption(listeEtapes.getValue()); } DetailGroupesWindow dgw = new DetailGroupesWindow(lgroupes, panelFormInscrits.getCaption(), vet, (String) listeAnnees.getValue()); UI.getCurrent().addWindow(dgw); }); gpLayout.addComponent(btnDetailGpe); formInscritLayout.addComponent(gpLayout); } } panelLayout.addComponent(formInscritLayout); panelLayout.setComponentAlignment(formInscritLayout, Alignment.MIDDLE_LEFT); //Cration du favori pour l'objet concern pas la liste des inscrits List<Favoris> lfav = favorisController.getFavoris(); FavorisPK favpk = new FavorisPK(); favpk.setLogin(userController.getCurrentUserName()); favpk.setIdfav(code); favpk.setTypfav(typeFavori); Favoris favori = new Favoris(); favori.setId(favpk); //Cration du bouton pour ajouter l'objet aux favoris favoriLayout = new VerticalLayout(); favoriLayout.setSizeFull(); favoriLayout.setMargin(true); favoriLayout.setSpacing(true); btnAjoutFavori = new Button( applicationContext.getMessage(NAME + ".btn.ajoutFavori", null, getLocale())); btnAjoutFavori.setIcon(FontAwesome.STAR_O); btnAjoutFavori.addStyleName(ValoTheme.BUTTON_PRIMARY); btnAjoutFavori.setDescription( applicationContext.getMessage(NAME + ".btn.ajoutFavori", null, getLocale())); btnAjoutFavori.addClickListener(e -> { //creation du favori en base sur le clic du bouton favorisController.saveFavori(favori); //On cache le bouton de mise en favori btnAjoutFavori.setVisible(false); //Affichage d'un message de confirmation Notification.show( applicationContext.getMessage(NAME + ".message.favoriAjoute", null, getLocale()), Type.TRAY_NOTIFICATION); }); //Ajout du bouton l'interface favoriLayout.addComponent(btnAjoutFavori); favoriLayout.setComponentAlignment(btnAjoutFavori, Alignment.TOP_RIGHT); if (typeIsElp()) { btnMasquerFiltre = new Button( applicationContext.getMessage(NAME + ".btn.btnMasquerFiltre", null, getLocale())); btnMasquerFiltre.setIcon(FontAwesome.CHEVRON_CIRCLE_UP); btnMasquerFiltre.addStyleName(ValoTheme.BUTTON_FRIENDLY); btnMasquerFiltre.setDescription( applicationContext.getMessage(NAME + ".btn.btnMasquerFiltre", null, getLocale())); btnMasquerFiltre.addClickListener(e -> { panelFormInscrits.setContent(null); if (btnDisplayFiltres != null) { btnDisplayFiltres.setVisible(true); } }); favoriLayout.addComponent(btnMasquerFiltre); favoriLayout.setComponentAlignment(btnMasquerFiltre, Alignment.BOTTOM_RIGHT); } panelLayout.addComponent(favoriLayout); panelLayout.setComponentAlignment(favoriLayout, Alignment.TOP_RIGHT); //Si l'objet est dj en favori if (lfav != null && lfav.contains(favori)) { //On affiche pas le bouton de mise en favori btnAjoutFavori.setVisible(false); } panelFormInscrits.setContent(panelLayout); addComponent(panelFormInscrits); //Rcupration de la liste des inscrits linscrits = MainUI.getCurrent().getListeInscrits(); refreshListeCodind(new BeanItemContainer<>(Inscrit.class, linscrits)); //Test si la liste contient des tudiants if (linscrits != null && linscrits.size() > 0 && listecodind != null && listecodind.size() > 0) { infoLayout = new VerticalLayout(); infoLayout.setSizeFull(); //Layout avec le nb d'inscrit, le bouton trombinoscope et le bouton d'export HorizontalLayout resumeLayout = new HorizontalLayout(); resumeLayout.setWidth("100%"); resumeLayout.setHeight("50px"); //Label affichant le nb d'inscrits infoNbInscrit = new Label( applicationContext.getMessage(NAME + ".message.nbinscrit", null, getLocale()) + " : " + linscrits.size()); leftResumeLayout = new HorizontalLayout(); leftResumeLayout.addComponent(infoNbInscrit); leftResumeLayout.setComponentAlignment(infoNbInscrit, Alignment.MIDDLE_LEFT); Button infoDescriptionButton = new Button(); infoDescriptionButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); infoDescriptionButton.setIcon(FontAwesome.INFO_CIRCLE); infoDescriptionButton.setDescription(applicationContext .getMessage(NAME + ".message.info.predescription", null, getLocale())); infoDescriptionButton.addClickListener(e -> { String message = ""; if (typeIsVet()) { message = applicationContext.getMessage(NAME + ".message.info.vetdescription", null, getLocale()); } if (typeIsElp()) { message = applicationContext.getMessage(NAME + ".message.info.elpdescription", null, getLocale()); } HelpBasicWindow hbw = new HelpBasicWindow(message, applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale())); UI.getCurrent().addWindow(hbw); }); leftResumeLayout.addComponent(infoDescriptionButton); leftResumeLayout.setComponentAlignment(infoDescriptionButton, Alignment.MIDDLE_LEFT); //Bouton export trombinoscope btnExportTrombi = new Button(); btnExportTrombi.setIcon(FontAwesome.FILE_PDF_O); btnExportTrombi.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnExportTrombi.addStyleName("button-icon"); btnExportTrombi.addStyleName("red-button-icon"); btnExportTrombi.setDescription( applicationContext.getMessage(NAME + ".pdf.trombinoscope.link", null, getLocale())); //methode qui permet de generer l'export la demande //Cration du nom du fichier String nomFichier = applicationContext.getMessage("pdf.trombinoscope.title", null, Locale.getDefault()) + "_" + panelFormInscrits.getCaption() + ".pdf"; nomFichier = nomFichier.replaceAll(" ", "_"); StreamResource resource = new StreamResource(new StreamResource.StreamSource() { @Override public InputStream getStream() { //recuperation de l'anne slectionne et du libell de l'ELP String annee = (String) listeAnnees.getValue(); String libObj = panelFormInscrits.getCaption(); //cration du trombi en pdf return listeInscritsController.getPdfStream(linscrits, listecodind, libObj, annee); } }, nomFichier); resource.setMIMEType("application/force-download;charset=UTF-8"); resource.setCacheTime(0); //On ajoute le FD sur le bouton d'export if (PropertyUtils.isPushEnabled()) { new MyFileDownloader(resource).extend(btnExportTrombi); } else { FileDownloader fdpdf = new FileDownloader(resource); fdpdf.setOverrideContentType(false); fdpdf.extend(btnExportTrombi); } leftResumeLayout.addComponent(btnExportTrombi); leftResumeLayout.setComponentAlignment(btnExportTrombi, Alignment.MIDDLE_LEFT); //if(!afficherTrombinoscope){ //On cache le bouton d'export pdf btnExportTrombi.setVisible(false); //} //Bouton export liste excel btnExportExcel = new Button(); btnExportExcel.setIcon(FontAwesome.FILE_EXCEL_O); btnExportExcel.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); btnExportExcel.addStyleName("button-icon"); btnExportExcel .setDescription(applicationContext.getMessage(NAME + ".excel.link", null, getLocale())); String nomFichierXls = applicationContext.getMessage("excel.listeinscrits.title", null, Locale.getDefault()) + "_" + panelFormInscrits.getCaption() + ".xls"; nomFichierXls = nomFichierXls.replaceAll(" ", "_"); StreamResource resourceXls = new StreamResource(new StreamResource.StreamSource() { @Override public InputStream getStream() { //recuperation de l'anne slectionne et du libell de l'ELP String annee = (String) listeAnnees.getValue(); String libObj = panelFormInscrits.getCaption(); //cration du trombi en pdf return listeInscritsController.getXlsStream(linscrits, listecodind, listeGroupes, libObj, annee, typeFavori); } }, nomFichierXls); resourceXls.setMIMEType("application/force-download;charset=UTF-8"); resourceXls.setCacheTime(0); //On ajoute le FD sur le bouton d'export if (PropertyUtils.isPushEnabled()) { new MyFileDownloader(resourceXls).extend(btnExportExcel); } else { FileDownloader fd = new FileDownloader(resourceXls); fd.setOverrideContentType(false); fd.extend(btnExportExcel); } //if(!afficherTrombinoscope){ //On change le bouton d'export pdf par le bouton export excel leftResumeLayout.replaceComponent(btnExportTrombi, btnExportExcel); //} resumeLayout.addComponent(leftResumeLayout); //Middle layout avec les bouton de collapse des colonnes middleResumeLayout = new HorizontalLayout(); middleResumeLayout.setSizeFull(); middleResumeLayout.addStyleName("small-font-element"); middleResumeLayout.setSpacing(true); if (!typeIsVet()) { collapseEtp = new CheckBox( applicationContext.getMessage(NAME + ".collapseEtp.title", null, getLocale())); collapseEtp.setValue(true); collapseEtp.addValueChangeListener(e -> { inscritstable.setColumnCollapsed("etape", !collapseEtp.getValue()); }); collapseEtp.setDescription(applicationContext.getMessage(NAME + ".collapseEtp.description", null, getLocale())); middleResumeLayout.addComponent(collapseEtp); middleResumeLayout.setComponentAlignment(collapseEtp, Alignment.MIDDLE_CENTER); } collapseResultatsS1 = new CheckBox( applicationContext.getMessage(NAME + ".collapseResultatsS1.title", null, getLocale())); collapseResultatsS1.setValue(false); collapseResultatsS1.addValueChangeListener(e -> { inscritstable.setColumnCollapsed("notes1", !collapseResultatsS1.getValue()); }); collapseResultatsS1.setDescription(applicationContext .getMessage(NAME + ".collapseResultatsS1.description", null, getLocale())); middleResumeLayout.addComponent(collapseResultatsS1); middleResumeLayout.setComponentAlignment(collapseResultatsS1, Alignment.MIDDLE_CENTER); collapseResultatsS2 = new CheckBox( applicationContext.getMessage(NAME + ".collapseResultatsS2.title", null, getLocale())); collapseResultatsS2.setValue(false); collapseResultatsS2.addValueChangeListener(e -> { inscritstable.setColumnCollapsed("notes2", !collapseResultatsS2.getValue()); }); collapseResultatsS2.setDescription(applicationContext .getMessage(NAME + ".collapseResultatsS2.description", null, getLocale())); middleResumeLayout.addComponent(collapseResultatsS2); middleResumeLayout.setComponentAlignment(collapseResultatsS2, Alignment.MIDDLE_CENTER); resumeLayout.addComponent(middleResumeLayout); HorizontalLayout buttonResumeLayout = new HorizontalLayout(); buttonResumeLayout.setSizeFull(); buttonResumeLayout.setSpacing(true); //Bouton pour afficher les filtres btnDisplayFiltres = new Button(); btnDisplayFiltres.setWidth("52px"); btnDisplayFiltres.setHeight("32px"); btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY); btnDisplayFiltres.setIcon(FontAwesome.FILTER); btnDisplayFiltres.setDescription( applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale())); btnDisplayFiltres.addClickListener(e -> { panelFormInscrits.setContent(panelLayout); btnDisplayFiltres.setVisible(false); }); buttonResumeLayout.addComponent(btnDisplayFiltres); buttonResumeLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT); buttonResumeLayout.setExpandRatio(btnDisplayFiltres, 1); btnDisplayFiltres.setVisible(false); //Bouton trombinoscope btnTrombi = new Button( applicationContext.getMessage(NAME + ".message.trombinoscope", null, getLocale())); if (listeInscritsController.isPhotoProviderOperationnel()) { btnTrombi.setIcon(FontAwesome.GROUP); buttonResumeLayout.addComponent(btnTrombi); //Gestion du clic sur le bouton trombinoscope btnTrombi.addClickListener(e -> { //Si on doit afficher une fentre de loading pendant l'excution if (PropertyUtils.isPushEnabled() && PropertyUtils.isShowLoadingIndicator()) { //affichage de la pop-up de loading MainUI.getCurrent().startBusyIndicator(); //Execution de la mthode en parallle dans un thread executorService.execute(new Runnable() { public void run() { MainUI.getCurrent().access(new Runnable() { @Override public void run() { executeDisplayTrombinoscope(); //close de la pop-up de loading MainUI.getCurrent().stopBusyIndicator(); } }); } }); } else { //On ne doit pas afficher de fentre de loading, on excute directement la mthode executeDisplayTrombinoscope(); } }); buttonResumeLayout.setComponentAlignment(btnTrombi, Alignment.MIDDLE_RIGHT); } //Bouton de retour l'affichage de la liste btnRetourListe = new Button( applicationContext.getMessage(NAME + ".message.retourliste", null, getLocale())); btnRetourListe.setIcon(FontAwesome.BARS); buttonResumeLayout.addComponent(btnRetourListe); //if(!afficherTrombinoscope){ btnRetourListe.setVisible(false); //} //Gestion du clic sur le bouton de retour l'affichage de la liste btnRetourListe.addClickListener(e -> { afficherTrombinoscope = false; btnExportTrombi.setVisible(false); leftResumeLayout.replaceComponent(btnExportTrombi, btnExportExcel); btnTrombi.setVisible(true); btnRetourListe.setVisible(false); dataLayout.removeAllComponents(); dataLayout.addComponent(inscritstable); middleResumeLayout.setVisible(true); }); buttonResumeLayout.setComponentAlignment(btnRetourListe, Alignment.MIDDLE_RIGHT); resumeLayout.addComponent(buttonResumeLayout); infoLayout.addComponent(resumeLayout); //Layout qui contient la liste des inscrits et le trombinoscope dataLayout = new VerticalLayout(); dataLayout.setSizeFull(); //Table contenant la liste des inscrits inscritstable = new Table(null, new BeanItemContainer<>(Inscrit.class, linscrits)); inscritstable.addStyleName("table-without-column-selector"); inscritstable.setSizeFull(); inscritstable.setVisibleColumns(new String[0]); String[] fields = INS_FIELDS_ELP; if (typeIsVet()) { fields = INS_FIELDS_VET; } for (String fieldName : fields) { inscritstable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale())); } inscritstable.addGeneratedColumn("cod_etu", new CodEtuColumnGenerator()); inscritstable.setColumnHeader("cod_etu", applicationContext.getMessage(NAME + ".table.cod_etu", null, getLocale())); inscritstable.addGeneratedColumn("email", new MailColumnGenerator()); inscritstable.setColumnHeader("email", applicationContext.getMessage(NAME + ".table.email", null, getLocale())); inscritstable.addGeneratedColumn("notes1", new Session1ColumnGenerator()); inscritstable.setColumnHeader("notes1", applicationContext.getMessage(NAME + ".table.notes1", null, getLocale())); inscritstable.addGeneratedColumn("notes2", new Session2ColumnGenerator()); inscritstable.setColumnHeader("notes2", applicationContext.getMessage(NAME + ".table.notes2", null, getLocale())); //Si on est sur un ELP if (typeIsElp()) { //on affiche l'tape de rattachement inscritstable.addGeneratedColumn("etape", new EtapeColumnGenerator()); inscritstable.setColumnHeader("etape", applicationContext.getMessage(NAME + ".table.etape", null, getLocale())); } String[] fields_to_display = INS_FIELDS_TO_DISPLAY_ELP; if (typeIsVet()) { fields_to_display = INS_FIELDS_TO_DISPLAY_VET; } inscritstable.setVisibleColumns((Object[]) fields_to_display); inscritstable.setColumnCollapsingAllowed(true); inscritstable.setColumnReorderingAllowed(false); //On masque les colonnes de notes par dfaut inscritstable.setColumnCollapsed("notes1", true); inscritstable.setColumnCollapsed("notes2", true); inscritstable.setSelectable(false); inscritstable.setImmediate(true); inscritstable.addStyleName("scrollabletable"); //Si on n'a pas dj demand afficher le trombinoscope //if(!afficherTrombinoscope){ //la layout contient la table dataLayout.addComponent(inscritstable); //} //Layout contenant le gridLayout correspondant au trombinoscope verticalLayoutForTrombi = new VerticalLayout(); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.addStyleName("v-scrollablepanel"); //Cration du trombinoscope displayTrombinoscope(); verticalLayoutForTrombi.addComponent(trombiLayout); verticalLayoutForTrombi.setSizeFull(); verticalLayoutForTrombi.setHeight(null); //Si on a demand afficher le trombinoscope /*if(afficherTrombinoscope){ //Le layout contient le trombi afficher dataLayout.addComponent(verticalLayoutForTrombi); }*/ infoLayout.addComponent(dataLayout); infoLayout.setExpandRatio(dataLayout, 1); addComponent(infoLayout); setExpandRatio(infoLayout, 1); //Si on a demand afficher le trombinoscope if (afficherTrombinoscope) { //On execute la procdure d'affichage du trombinoscope executeDisplayTrombinoscope(); } } else { Label infoAucuninscrit = new Label( applicationContext.getMessage(NAME + ".message.aucuninscrit", null, getLocale())); addComponent(infoAucuninscrit); setComponentAlignment(infoAucuninscrit, Alignment.TOP_CENTER); setExpandRatio(infoAucuninscrit, 1); } } } }
From source file:fr.univlorraine.mondossierweb.views.RechercheArborescenteView.java
License:Apache License
public void refresh() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && userController.isEnseignant()) { //Actualiser de l'affiche du bouton de mise en favori if (table != null && hc != null) { recuperationDesfavoris();//from w w w. jav a 2 s . c o m if (listeBoutonFavoris != null) { for (ReferencedButton btnfav : listeBoutonFavoris) { if (markedRows.contains(btnfav.getIdObj())) { btnfav.getButton().setIcon(FontAwesome.TRASH_O); btnfav.getButton().setStyleName(ValoTheme.BUTTON_DANGER); btnfav.getButton().addStyleName("deletefavbutton"); btnfav.getButton().setDescription( applicationContext.getMessage(NAME + ".supprimerfavori", null, getLocale())); } else { btnfav.getButton().setIcon(FontAwesome.STAR_O); btnfav.getButton().setStyleName(ValoTheme.BUTTON_PRIMARY); btnfav.getButton().setDescription( applicationContext.getMessage(NAME + ".ajouterfavori", null, getLocale())); } } } } } }