List of usage examples for com.vaadin.ui HorizontalLayout setHeight
@Override public void setHeight(String height)
From source file:fr.univlorraine.mondossierweb.views.InformationsAnnuellesMobileView.java
License:Apache License
public void refresh() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { removeAllComponents();//w w w . j ava 2 s . c o m /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour if (userController.isEnseignant()) { returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToListeInscrits(); } else { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); } //Title Label labelTrombi = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelTrombi.setStyleName("v-label-navbar"); navbar.addComponent(labelTrombi); navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER); if (userController.isEnseignant()) { //Si on ne peut pas dj revenir sur la recherche via le bouton 'retour' if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() == null || !MdwTouchkitUI.getCurrent().getDossierEtuFromView().equals(RechercheMobileView.NAME)) { //Bouton Search Button searchButton = new Button(); searchButton.setIcon(FontAwesome.SEARCH); searchButton.setStyleName("v-nav-button"); navbar.addComponent(searchButton); navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT); searchButton.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); } } navbar.setExpandRatio(labelTrombi, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); VerticalLayout slimLayout = new VerticalLayout(); slimLayout.setSpacing(false); slimLayout.setMargin(false); //slimLayout.setStyleName("v-scrollableelement"); String mail = MdwTouchkitUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { Panel mailPanel = new Panel(); mailPanel.setStyleName("panel-without-bottom-line-separator"); HorizontalLayout mailLayout = new HorizontalLayout(); mailLayout.setSizeFull(); mailLayout.setHeight("25px"); Label mailLabel = new Label(); mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); mailLabel.setSizeFull(); mailLabel.addStyleName("label-centre"); mailLayout.addComponent(mailLabel); mailLayout.setComponentAlignment(mailLabel, Alignment.MIDDLE_CENTER); mailPanel.setContent(mailLayout); slimLayout.addComponent(mailPanel); slimLayout.setComponentAlignment(mailPanel, Alignment.MIDDLE_CENTER); } Panel etuPanel = new Panel(); HorizontalLayout photoLayout = new HorizontalLayout(); photoLayout.setId(MdwTouchkitUI.getCurrent().getEtudiant().getCod_ind()); photoLayout.setSizeFull(); if (MdwTouchkitUI.getCurrent().getEtudiant().getPhoto() != null) { Image fotoEtudiant = new Image(null, new ExternalResource(MdwTouchkitUI.getCurrent().getEtudiant().getPhoto())); fotoEtudiant.setWidth("120px"); fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK); photoLayout.addComponent(fotoEtudiant); } VerticalLayout nomCodeLayout = new VerticalLayout(); //nomCodeLayout.setSizeFull(); nomCodeLayout.setSpacing(false); Label labelNomEtudiant = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNomEtudiant.setSizeFull(); labelNomEtudiant.setStyleName(ValoTheme.LABEL_BOLD); labelNomEtudiant.addStyleName("label-centre"); nomCodeLayout.addComponent(labelNomEtudiant); nomCodeLayout.setComponentAlignment(labelNomEtudiant, Alignment.MIDDLE_CENTER); //nomCodeLayout.setExpandRatio(labelNomEtudiant, 1); Label codetuLabel = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getCod_etu()); codetuLabel.setSizeFull(); codetuLabel.setStyleName(ValoTheme.LABEL_TINY); codetuLabel.addStyleName("label-centre"); nomCodeLayout.addComponent(codetuLabel); nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER); photoLayout.addComponent(nomCodeLayout); photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER); photoLayout.setExpandRatio(nomCodeLayout, 1); etuPanel.setContent(photoLayout); slimLayout.addComponent(etuPanel); slimLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER); globalLayout.addComponent(slimLayout); Panel panelInfos = new Panel(applicationContext.getMessage(NAME + ".infos.title", null, getLocale()) + " " + Utils.getAnneeUniversitaireEnCours( etudiantController.getAnneeUnivEnCours(MdwTouchkitUI.getCurrent()))); panelInfos.setStyleName("centertitle-panel"); panelInfos.addStyleName("v-colored-panel-caption"); //Si l'tudiant est inscrit pour l'anne en cours if (MdwTouchkitUI.getCurrent().getEtudiant().isInscritPourAnneeEnCours()) { FormLayout formInfosLayout = new FormLayout(); formInfosLayout.setSpacing(true); formInfosLayout.setMargin(true); //Numro Anonymat visible que si l'utilisateur est tudiant List<Anonymat> lano = null; if (!userController.isEnseignant() && userController.isEtudiant()) { lano = MdwTouchkitUI.getCurrent().getEtudiant().getNumerosAnonymat(); if (lano != null) { //Si l'tudiant n'a qu'un seul numro d'anonymat if (lano.size() == 1) { String captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymat.title", null, getLocale()); TextField fieldNumAnonymat = new TextField(captionNumAnonymat, MdwTouchkitUI .getCurrent().getEtudiant().getNumerosAnonymat().get(0).getCod_etu_ano()); formatTextField(fieldNumAnonymat); //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE); //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale())); formInfosLayout.addComponent(fieldNumAnonymat); } //Si l'tudiant a plusieurs numros d'anonymat if (lano.size() > 1) { int i = 0; for (Anonymat ano : lano) { String captionNumAnonymat = ""; if (i == 0) { //Pour le premier numro affich on affiche le libell du champ captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymats.title", null, getLocale()); } TextField fieldNumAnonymat = new TextField(captionNumAnonymat, ano.getCod_etu_ano() + " (" + ano.getLib_man() + ")"); formatTextField(fieldNumAnonymat); if (i == 0) { //Pour le premier numro affich on affiche l'info bulle //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE); //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale())); } formInfosLayout.addComponent(fieldNumAnonymat); i++; } } } } String captionBousier = applicationContext.getMessage(NAME + ".boursier.title", null, getLocale()); TextField fieldNumBoursier = new TextField(captionBousier, MdwTouchkitUI.getCurrent().getEtudiant().isBoursier() ? applicationContext.getMessage(NAME + ".boursier.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".boursier.non", null, getLocale())); formatTextField(fieldNumBoursier); formInfosLayout.addComponent(fieldNumBoursier); String captionSalarie = applicationContext.getMessage(NAME + ".salarie.title", null, getLocale()); TextField fieldSalarie = new TextField(captionSalarie, MdwTouchkitUI.getCurrent().getEtudiant().isTemSalarie() == true ? applicationContext.getMessage(NAME + ".salarie.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".salarie.non", null, getLocale())); formatTextField(fieldSalarie); formInfosLayout.addComponent(fieldSalarie); String captionAmenagementEtude = applicationContext.getMessage(NAME + ".amenagementetude.title", null, getLocale()); TextField fieldAmenagementEtude = new TextField(captionAmenagementEtude, MdwTouchkitUI.getCurrent().getEtudiant().isTemAmenagementEtude() == true ? applicationContext.getMessage(NAME + ".amenagementetude.oui", null, getLocale()) : applicationContext.getMessage(NAME + ".amenagementetude.non", null, getLocale())); formatTextField(fieldAmenagementEtude); formInfosLayout.addComponent(fieldAmenagementEtude); panelInfos.setContent(formInfosLayout); } else { HorizontalLayout labelNonInscritLayout = new HorizontalLayout(); labelNonInscritLayout.setMargin(true); labelNonInscritLayout.setSizeFull(); Label labelNonInscrit = new Label( applicationContext.getMessage(NAME + ".inscrit.non", null, getLocale())); labelNonInscrit.setStyleName(ValoTheme.LABEL_COLORED); labelNonInscrit.addStyleName(ValoTheme.LABEL_BOLD); labelNonInscrit.setWidth("100%"); labelNonInscrit.addStyleName("label-centre"); labelNonInscritLayout.addComponent(labelNonInscrit); panelInfos.setContent(labelNonInscritLayout); } globalLayout.addComponent(panelInfos); addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsMobileView.java
License:Apache License
/** * Initialise la vue//www .j ava 2 s . c o 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();//from www. j a v a 2 s.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.NotesDetailMobileView.java
License:Apache License
@SuppressWarnings("deprecation") public void refresh(Etape etapeToDisplay, String codetuToDisplay) { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { //On repassera dans la cration que si on n'a pas dej cr la vue if (codetu == null || !codetuToDisplay.equals(codetu)) { codetu = null;/*from w w w. jav a 2s . c o m*/ } //On repassera dans la cration que si on n'a pas dej cr la vue if (etape == null || !etapeToDisplay.getAnnee().equals(etape.getAnnee()) || !etapeToDisplay.getCode().equals(etape.getCode()) || !etapeToDisplay.getVersion().equals(etape.getVersion())) { etape = null; } //On repassera dans la cration que si on n'a pas dej cr la vue if (codetu == null || etape == null) { compteurElp = 0; removeAllComponents(); /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //Test si user enseignant if (userController.isEnseignant()) { //On recupere les notes pour un enseignant etudiantController.renseigneDetailNotesEtResultatsEnseignant(etapeToDisplay); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneDetailNotesEtResultats(etapeToDisplay); } //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(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { MdwTouchkitUI.getCurrent().navigateToResumeNotes(); }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); //Titre Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNavBar.setStyleName("v-label-navbar"); navbar.addComponent(labelNavBar); navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER); navbar.setExpandRatio(labelNavBar, 1); //Significations if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { significationButton = new Button(); significationButton.setIcon(FontAwesome.INFO_CIRCLE); significationButton.setStyleName("v-nav-button"); significationButton.addClickListener(e -> { //afficher les significations SignificationsMobileWindow w = new SignificationsMobileWindow(true); UI.getCurrent().addWindow(w); }); navbar.addComponent(significationButton); navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT); } addComponent(navbar); layoutList = new HashMap<String, LinkedList<HorizontalLayout>>(); etape = etapeToDisplay; codetu = codetuToDisplay; /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); layout.setStyleName("v-scrollableelement"); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); List<ElementPedagogique> lelp = MdwTouchkitUI.getCurrent().getEtudiant().getElementsPedagogiques(); if (lelp != null && lelp.size() > 0) { //Panel notesPanel = new Panel(); //notesPanel.setSizeFull(); VerticalLayout notesLayout = new VerticalLayout(); //notesLayout.setSpacing(true); HorizontalLayout libSessionLayout = new HorizontalLayout(); libSessionLayout.setSizeFull(); libSessionLayout.addComponent(new Label()); HorizontalLayout sessionLayout = new HorizontalLayout(); sessionLayout.setSizeFull(); Label session1 = new Label("Session1"); session1.setStyleName("label-bold-with-bottom"); sessionLayout.addComponent(session1); Label session2 = new Label("Session2"); session2.setStyleName("label-bold-with-bottom"); sessionLayout.addComponent(session2); libSessionLayout.addComponent(sessionLayout); notesLayout.addComponent(libSessionLayout); boolean blueLevel = false; compteurElp = 0; elpPere = ""; HorizontalLayout layoutPere = null; int nbFils = 0; for (ElementPedagogique elp : lelp) { compteurElp++; //Si on est sur un element de niveau 1, diffrent du premier element de la liste (qui est un rappel de l'etape) if (elp.getLevel() == 1 && compteurElp > 1) { blueLevel = !blueLevel; } HorizontalLayout libElpLayout = new HorizontalLayout(); if (compteurElp > 1) { if (elp.getLevel() == 1) { //Si le pere prcdent n'avait aucun fils if (layoutPere != null && nbFils == 0) { layoutPere.setStyleName("layout-bottom-line-separator"); } layoutPere = libElpLayout; nbFils = 0; //Sur un elp de niveau 1, il est sur fond sombre libElpLayout.addStyleName("main-layout-bottom-line-separator"); //ajout dans la hashMap layoutList.put(elp.getCode(), new LinkedList<HorizontalLayout>()); elpPere = elp.getCode(); libElpLayout.setId("layout_pere_" + elp.getCode()); } else { nbFils++; libElpLayout.addStyleName("layout-bottom-line-separator"); libElpLayout.setId(compteurElp + "_" + elp.getCode() + "_layout_fils_" + elpPere); //ajout dans la hashMap layoutList.get(elpPere).add(libElpLayout); } } else { //on affiche la racine (qui est un rappel de l'etape) en blanc sur un fond trs sombre libElpLayout.addStyleName("root-layout-bottom-line-separator"); } libElpLayout.setSizeFull(); libElpLayout.setHeight("100%"); VerticalLayout libVerticalLayout = new VerticalLayout(); Label libElpLabel = new Label(elp.getLibelle()); if (elp.isEpreuve()) { libElpLabel.setStyleName("bold-italic-label"); } else { libElpLabel.setStyleName("bold-label"); } libVerticalLayout.addComponent(libElpLabel); //Si on n'est pas sur le premier elp de la liste (rappel de l'tape) on affiche un indicateur de niveau if (compteurElp > 1) { HorizontalLayout levelMainLayout = new HorizontalLayout(); levelMainLayout.setSizeFull(); levelMainLayout.setSpacing(true); levelMainLayout.setStyleName("level-indicator-layout"); int k = 0; for (int i = 0; i < elp.getLevel(); i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); if (blueLevel) { libLevelLayout.setStyleName("layout-level-blue-indicator"); } else { libLevelLayout.setStyleName("layout-level-green-indicator"); } levelMainLayout.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout.addComponent(libLevelSpaceLayout); } libVerticalLayout.addComponent(levelMainLayout); } libElpLayout.addComponent(libVerticalLayout); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); VerticalLayout vlsession1 = new VerticalLayout(); Label note1 = new Label(elp.getNote1()); if (!StringUtils.hasText(elp.getNote2())) { if (elp.isEpreuve()) { note1.setStyleName("bold-italic-label"); } else { note1.setStyleName("bold-label"); } } vlsession1.addComponent(note1); if (StringUtils.hasText(elp.getRes1())) { Label adm1 = new Label(elp.getRes1()); if (!StringUtils.hasText(elp.getRes2())) { if (elp.isEpreuve()) { adm1.setStyleName("bold-italic-label"); } else { adm1.setStyleName("bold-label"); } } vlsession1.addComponent(adm1); } noteLayout.addComponent(vlsession1); VerticalLayout vlsession2 = new VerticalLayout(); Label note2 = new Label(elp.getNote2()); if (StringUtils.hasText(elp.getNote2())) { if (elp.isEpreuve()) { note2.setStyleName("bold-italic-label"); } else { note2.setStyleName("bold-label"); } } vlsession2.addComponent(note2); if (StringUtils.hasText(elp.getRes2())) { Label adm2 = new Label(elp.getRes2()); if (StringUtils.hasText(elp.getRes2())) { if (elp.isEpreuve()) { adm2.setStyleName("bold-italic-label"); } else { adm2.setStyleName("bold-label"); } } vlsession2.addComponent(adm2); } noteLayout.addComponent(vlsession2); libElpLayout.addComponent(noteLayout); notesLayout.addComponent(libElpLayout); //Au dpart, on cache les lments de niveau suprieur 1 if (compteurElp > 1 && elp.getLevel() > 1) { //libElpLayout.setVisible(false); Page.getCurrent().getJavaScript().execute("document.getElementById('" + libElpLayout.getId() + "').style.display=\"none\";"); } } //Cas o le dernier lment tait un lment le pere qui n'avait aucun fils if (layoutPere != null && nbFils == 0) { layoutPere.setStyleName("layout-bottom-line-separator"); } //Ajout du javascript for (Entry<String, LinkedList<HorizontalLayout>> entry : layoutList.entrySet()) { String pere = entry.getKey(); LinkedList<HorizontalLayout> listeLayoutFils = entry.getValue(); // traitements if (listeLayoutFils != null && listeLayoutFils.size() > 0) { String affichagejavascriptfils = ""; for (HorizontalLayout hl : listeLayoutFils) { affichagejavascriptfils += "if(document.getElementById('" + hl.getId() + "').style.display==\"none\"){document.getElementById('" + hl.getId() + "').style.display = \"block\";}else{document.getElementById('" + hl.getId() + "').style.display = \"none\";}"; } //sur le clic du layout pere, on affiche les fils Page.getCurrent().getJavaScript().execute("document.getElementById('" + "layout_pere_" + pere + "').onclick=function(){ " + affichagejavascriptfils + "};"); } } layout.addComponent(notesLayout); layout.setExpandRatio(notesLayout, 1); } else { setHeight(30, Unit.PERCENTAGE); HorizontalLayout messageLayout = new HorizontalLayout(); messageLayout.setSpacing(true); messageLayout.setMargin(true); Label labelAucunResultat = new Label( applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale())); labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD); messageLayout.addComponent(labelAucunResultat); layout.addComponent(messageLayout); } addComponent(layout); setExpandRatio(layout, 1); } else { refreshJavascript(); } } }
From source file:fr.univlorraine.mondossierweb.views.NotesMobileView.java
License:Apache License
public void refresh() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && (userController.isEnseignant() || userController.isEtudiant()) && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) { removeAllComponents();/*from ww w. j a v a2 s . com*/ /* Style */ setMargin(false); setSpacing(false); setSizeFull(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton retour if (userController.isEnseignant()) { returnButton = new Button(); returnButton.setIcon(FontAwesome.ARROW_LEFT); //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY); returnButton.setStyleName("v-nav-button"); returnButton.addClickListener(e -> { if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToListeInscrits(); } if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent() .getDossierEtuFromView().equals(RechercheMobileView.NAME)) { MdwTouchkitUI.getCurrent().navigateToRecherche(null); } }); navbar.addComponent(returnButton); navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT); } //Titre Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom()); labelNavBar.setStyleName("v-label-navbar"); navbar.addComponent(labelNavBar); navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER); navbar.setExpandRatio(labelNavBar, 1); //Significations if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { significationButton = new Button(); significationButton.setIcon(FontAwesome.INFO_CIRCLE); significationButton.setStyleName("v-nav-button"); significationButton.addClickListener(e -> { //afficher les significations SignificationsMobileWindow w = new SignificationsMobileWindow(false); UI.getCurrent().addWindow(w); }); navbar.addComponent(significationButton); navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT); } addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); List<Diplome> ldiplomes = MdwTouchkitUI.getCurrent().getEtudiant().getDiplomes(); if (ldiplomes != null && ldiplomes.size() > 0) { Panel diplomesPanel = new Panel( applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale())); diplomesPanel.setStyleName("centertitle-panel"); diplomesPanel.addStyleName("v-colored-panel-caption"); VerticalLayout diplomesLayout = new VerticalLayout(); for (Diplome diplome : ldiplomes) { Panel panelEnCours = null; panelEnCours = new Panel(diplome.getAnnee()); panelEnCours.setStyleName("v-panel-caption-centertitle-panel"); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); noteLayout.setSpacing(true); VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Label libelleButton = new Label(diplome.getLib_web_vdi()); libelleButton.setHeight("100%"); libelleButton.setWidth("100%"); libelleButton.addStyleName("label-centre"); //Appel de la window contenant le dtail des notes if (diplome.getResultats() != null && diplome.getResultats().size() > 0) { libelleLayout.addComponent(new Label("")); } libelleLayout.addComponent(libelleButton); libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER); HorizontalLayout notesessionLayout = new HorizontalLayout(); notesessionLayout.setSizeFull(); notesessionLayout.setSpacing(true); if (diplome.getResultats() != null && diplome.getResultats().size() > 0) { int i = 0; for (Resultat r : diplome.getResultats()) { i++; VerticalLayout resultatLayout = new VerticalLayout(); resultatLayout.setSizeFull(); Label session = new Label(r.getSession()); session.setStyleName("label-bold-with-bottom"); resultatLayout.addComponent(session); Label note = new Label(r.getNote()); resultatLayout.addComponent(note); Label resultat = new Label(r.getAdmission()); resultatLayout.addComponent(resultat); //Si c'est la dernire session if (i == diplome.getResultats().size()) { //On affiche les infos en gras note.setStyleName(ValoTheme.LABEL_BOLD); resultat.setStyleName(ValoTheme.LABEL_BOLD); } notesessionLayout.addComponent(resultatLayout); } } else { Label resultat = new Label("Aucun rsultat"); resultat.setStyleName(ValoTheme.LABEL_SMALL); notesessionLayout.addComponent(resultat); } noteLayout.addComponent(libelleLayout); noteLayout.addComponent(notesessionLayout); panelEnCours.setContent(noteLayout); diplomesLayout.addComponent(panelEnCours); } diplomesPanel.setContent(diplomesLayout); globalLayout.addComponent(diplomesPanel); } List<Etape> letapes = MdwTouchkitUI.getCurrent().getEtudiant().getEtapes(); if (letapes != null && letapes.size() > 0) { Panel elpsPanel = new Panel( applicationContext.getMessage(NAME + ".table.etapes", null, getLocale())); elpsPanel.setStyleName("centertitle-panel"); elpsPanel.addStyleName("v-colored-panel-caption"); VerticalLayout elpsLayout = new VerticalLayout(); for (Etape etape : letapes) { Panel panelEnCours = null; panelEnCours = new Panel(etape.getAnnee()); panelEnCours.setStyleName("v-panel-caption-centertitle-panel"); HorizontalLayout noteLayout = new HorizontalLayout(); noteLayout.setSizeFull(); noteLayout.setSpacing(true); VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Button libelleButton = new Button(etape.getLibelle()); Utils.setButtonStyle(libelleButton); libelleButton.setHeight("100%"); libelleButton.setWidth("100%"); //Appel de la window contenant le dtail des notes prepareBoutonAppelDetailDesNotes(libelleButton, etape); if (etape.getResultats() != null && etape.getResultats().size() > 0) { libelleLayout.addComponent(new Label("")); } libelleLayout.addComponent(libelleButton); libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER); HorizontalLayout notesessionLayout = new HorizontalLayout(); notesessionLayout.setSizeFull(); notesessionLayout.setSpacing(true); if (etape.getResultats() != null && etape.getResultats().size() > 0) { int i = 0; for (Resultat r : etape.getResultats()) { i++; VerticalLayout resultatLayout = new VerticalLayout(); resultatLayout.setSizeFull(); Label session = new Label(r.getSession()); session.setStyleName("label-bold-with-bottom"); resultatLayout.addComponent(session); Label note = new Label(r.getNote()); resultatLayout.addComponent(note); Label resultat = new Label(r.getAdmission()); resultatLayout.addComponent(resultat); //Si c'est la dernire session if (i == etape.getResultats().size()) { //On affiche les infos en gras note.setStyleName(ValoTheme.LABEL_BOLD); resultat.setStyleName(ValoTheme.LABEL_BOLD); } notesessionLayout.addComponent(resultatLayout); } } else { Label resultat = new Label("Aucun rsultat"); resultat.setStyleName(ValoTheme.LABEL_SMALL); notesessionLayout.addComponent(resultat); } noteLayout.addComponent(libelleLayout); noteLayout.addComponent(notesessionLayout); panelEnCours.setContent(noteLayout); elpsLayout.addComponent(panelEnCours); } elpsPanel.setContent(elpsLayout); globalLayout.addComponent(elpsPanel); } addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.RechercheMobileView.java
License:Apache License
/** * Initialise la vue//ww w . ja v a2s . c o 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"); //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 -> { MdwTouchkitUI.getCurrent().backFromSearch(); }); 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); navbar.setExpandRatio(labelTrombi, 1); addComponent(navbar); //BOUTON DE RECHERCHE btnRecherche = new Button(); btnRecherche.setIcon(FontAwesome.SEARCH); btnRecherche.setStyleName(ValoTheme.BUTTON_PRIMARY); btnRecherche.addStyleName("v-popover-button"); btnRecherche.addStyleName("v-button-without-padding"); btnRecherche.setEnabled(true); btnRecherche.addClickListener(e -> search(false)); //CHAMP DE RECHERCHE champRechercheLayout = new HorizontalLayout(); champRechercheLayout.setWidth("100%"); mainVerticalLayout = new VerticalLayout(); mainVerticalLayout.setImmediate(true); mainVerticalLayout.setSizeFull(); //Init connexion ES, pour gain perf au premiere lettre tapes if (ElasticSearchService.initConnexion(true)) { //Cration du champ autoComplete champRecherche = new AutoComplete(); champRecherche.setWidth(100, Unit.PERCENTAGE); champRecherche.setEnabled(true); champRecherche.setImmediate(true); champRecherche.focus(); champRecherche.setTextChangeEventMode(TextChangeEventMode.EAGER); champRecherche.addTextChangeListener(new TextChangeListener() { @Override public void textChange(TextChangeEvent event) { /*if(event.getText()!=null){ resetButton.setIcon(FontAwesome.TIMES); }*/ champRecherche.showChoices(quickSearch(event.getText()), mainVerticalLayout, btnRecherche, true); } }); champRecherche.setImmediate(true); champRecherche.addShortcutListener( new ShortcutListener("Enter Shortcut", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { if (target == champRecherche) { //Si on tait sur une ligne propose sous le champ de recherche if (champRecherche.getSelectedItem() > 0) { //On remplie d'abord le champ avec la ligne slectionne champRecherche.setValue(champRecherche.getChoices() .getItem(champRecherche.getSelectedItem()).getItemProperty("lib") .getValue().toString()); } search(false); } } }); champRecherche.addShortcutListener( new ShortcutListener("Bottom Arrow", ShortcutAction.KeyCode.ARROW_DOWN, null) { @Override public void handleAction(Object sender, Object target) { if (target == champRecherche) { if (champRecherche.getChoices().getItemIds() != null) { champRecherche.getChoicesPopup().setVisible(true); champRecherche.getChoices().setValue(champRecherche.getNextItem()); } } } }); champRecherche.addShortcutListener( new ShortcutListener("Top Arrow", ShortcutAction.KeyCode.ARROW_UP, null) { @Override public void handleAction(Object sender, Object target) { if (target == champRecherche) { if (champRecherche.getChoices().getItemIds() != null) { champRecherche.getChoicesPopup().setVisible(true); Integer champSelectionne = champRecherche.getPreviousItem(); if (champSelectionne > 0) { champRecherche.getChoices().setValue(champSelectionne); } else { champRecherche.getChoices().setValue(null); } } } } }); champRechercheLayout.addComponent(champRecherche); champRechercheLayout.setComponentAlignment(champRecherche, Alignment.MIDDLE_LEFT); //BOUTON RESET champRecherche.addStyleName("textfield-resetable"); resetButton = new Button(); resetButton.setIcon(FontAwesome.TIMES); resetButton.setStyleName(ValoTheme.BUTTON_BORDERLESS); resetButton.addStyleName("v-popover-button"); resetButton.addStyleName("v-button-without-padding"); resetButton.addStyleName("btn-reset"); resetButton.addClickListener(e -> { champRecherche.setValue(""); //search1.setValue(""); resetButton.setIcon(FontAwesome.TIMES); champRecherche.focus(); }); champRechercheLayout.addComponent(resetButton); champRechercheLayout.setComponentAlignment(resetButton, Alignment.MIDDLE_LEFT); //Ajout du bouton de recherche au layout champRechercheLayout.addComponent(btnRecherche); mainVerticalLayout.addComponent(champRechercheLayout); mainVerticalLayout.setComponentAlignment(champRechercheLayout, Alignment.MIDDLE_LEFT); champRechercheLayout.setMargin(true); champRechercheLayout.setExpandRatio(champRecherche, 1); HorizontalLayout checkBoxVetLayout = new HorizontalLayout(); Label etapeLabel = new Label( applicationContext.getMessage(NAME + ".etapes.checkbox", null, getLocale())); etapeLabel.setStyleName(ValoTheme.LABEL_SMALL); checkBoxVetLayout.addComponent(etapeLabel); HorizontalLayout checkBoxElpLayout = new HorizontalLayout(); Label elpLabel = new Label( applicationContext.getMessage(NAME + ".elps.checkbox", null, getLocale())); elpLabel.setStyleName(ValoTheme.LABEL_SMALL); checkBoxElpLayout.addComponent(elpLabel); HorizontalLayout checkBoxEtuLayout = new HorizontalLayout(); Label etuLabel = new Label( applicationContext.getMessage(NAME + ".etudiants.checkbox", null, getLocale())); etuLabel.setStyleName(ValoTheme.LABEL_SMALL); checkBoxEtuLayout.addComponent(etuLabel); checkBoxVetLayout.setSizeFull(); checkBoxElpLayout.setSizeFull(); checkBoxEtuLayout.setSizeFull(); if (casesAcocherVet) { checkBoxVetLayout.setStyleName("layout-checkbox-checked"); etapeLabel.setStyleName(ValoTheme.LABEL_SMALL); } else { checkBoxVetLayout.setStyleName("layout-checkbox-unchecked"); etapeLabel.addStyleName("label-line-through"); } if (casesAcocherElp) { checkBoxElpLayout.setStyleName("layout-checkbox-checked"); elpLabel.setStyleName(ValoTheme.LABEL_SMALL); } else { checkBoxElpLayout.setStyleName("layout-checkbox-unchecked"); elpLabel.addStyleName("label-line-through"); } if (casesAcocherEtudiant) { checkBoxEtuLayout.setStyleName("layout-checkbox-checked"); etuLabel.setStyleName(ValoTheme.LABEL_SMALL); } else { checkBoxEtuLayout.setStyleName("layout-checkbox-unchecked"); etuLabel.addStyleName("label-line-through"); } checkBoxVetLayout.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { if (casesAcocherVet) { casesAcocherVet = false; checkBoxVetLayout.setStyleName("layout-checkbox-unchecked"); etapeLabel.addStyleName("label-line-through"); } else { casesAcocherVet = true; checkBoxVetLayout.setStyleName("layout-checkbox-checked"); etapeLabel.setStyleName(ValoTheme.LABEL_SMALL); } tuneSearch(); } }); checkBoxElpLayout.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { if (casesAcocherElp) { casesAcocherElp = false; checkBoxElpLayout.setStyleName("layout-checkbox-unchecked"); elpLabel.addStyleName("label-line-through"); } else { casesAcocherElp = true; checkBoxElpLayout.setStyleName("layout-checkbox-checked"); elpLabel.setStyleName(ValoTheme.LABEL_SMALL); } tuneSearch(); } }); checkBoxEtuLayout.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { if (casesAcocherEtudiant) { casesAcocherEtudiant = false; checkBoxEtuLayout.setStyleName("layout-checkbox-unchecked"); etuLabel.addStyleName("label-line-through"); } else { casesAcocherEtudiant = true; checkBoxEtuLayout.setStyleName("layout-checkbox-checked"); etuLabel.setStyleName(ValoTheme.LABEL_SMALL); } tuneSearch(); } }); HorizontalLayout checkBoxLayout = new HorizontalLayout(); checkBoxLayout.setWidth("100%"); checkBoxLayout.setHeight("50px"); checkBoxLayout.setMargin(true); checkBoxLayout.setSpacing(true); checkBoxLayout.addComponent(checkBoxVetLayout); checkBoxLayout.addComponent(checkBoxElpLayout); checkBoxLayout.addComponent(checkBoxEtuLayout); mainVerticalLayout.addComponent(checkBoxLayout); //TABLE DE RESULTATS rrContainer = new HierarchicalContainer(); rrContainer.addContainerProperty("lib", String.class, ""); rrContainer.addContainerProperty("code", String.class, ""); rrContainer.addContainerProperty("type", String.class, ""); tableResultats = new TreeTable(); tableResultats.setWidth("100%"); tableResultats.setSelectable(false); tableResultats.setMultiSelect(false); tableResultats.setImmediate(true); columnHeaders = new String[FIELDS_ORDER.length]; for (int fieldIndex = 0; fieldIndex < FIELDS_ORDER.length; fieldIndex++) { columnHeaders[fieldIndex] = applicationContext .getMessage("result.table." + FIELDS_ORDER[fieldIndex], null, Locale.getDefault()); } tableResultats.addGeneratedColumn("type", new DisplayTypeColumnGenerator()); tableResultats.addGeneratedColumn("lib", new DisplayNameColumnGenerator()); tableResultats.setContainerDataSource(rrContainer); tableResultats.setVisibleColumns(FIELDS_ORDER); tableResultats.setStyleName("nohscrollabletable"); tableResultats.setColumnHeaders(columnHeaders); tableResultats.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN); tableResultats.setColumnWidth("type", 100); /*mainVerticalLayout.addComponent(searchBoxFilter); mainVerticalLayout.setComponentAlignment(searchBoxFilter, Alignment.MIDDLE_RIGHT);*/ VerticalLayout tableVerticalLayout = new VerticalLayout(); tableVerticalLayout.setMargin(true); tableVerticalLayout.setSizeFull(); tableVerticalLayout.addComponent(tableResultats); mainVerticalLayout.addComponent(tableVerticalLayout); mainVerticalLayout.setExpandRatio(tableVerticalLayout, 1); tableResultats.setVisible(false); addComponent(mainVerticalLayout); setExpandRatio(mainVerticalLayout, 1); } else { //Message fonctionnalit indisponible addComponent( new Label(applicationContext.getMessage(NAME + ".indisponible.message", null, getLocale()), ContentMode.HTML)); } } }
From source file:fr.univlorraine.mondossierweb.views.windows.DetailGroupesWindow.java
License:Apache License
private void init() { /* Style *///w ww .j a v a2s .com setWidth(80, Unit.PERCENTAGE); setHeight(95, Unit.PERCENTAGE); setModal(true); setResizable(false); /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); //Sous titre avec l'anne HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setSizeFull(); titleLayout.setHeight("20px"); Label labelAnneeUniv = new Label(); labelAnneeUniv.setValue(applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>" + annee + "</b>"); labelAnneeUniv.setContentMode(ContentMode.HTML); titleLayout.addComponent(labelAnneeUniv); titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_LEFT); if (StringUtils.hasText(vetLibelle)) { Label labelEtape = new Label(); labelEtape.setValue(applicationContext.getMessage(NAME + ".label.vet", null, getLocale()) + " : <b>" + vetLibelle + "</b>"); labelEtape.setContentMode(ContentMode.HTML); titleLayout.addComponent(labelEtape); titleLayout.setComponentAlignment(labelEtape, Alignment.MIDDLE_RIGHT); } layout.addComponent(titleLayout); Panel panelDetailGroupes = new Panel(elpLibelle); panelDetailGroupes.setSizeFull(); if (lgroupes != null && lgroupes.size() > 0) { TreeTable detailGroupesTable = new TreeTable(); detailGroupesTable.setSizeFull(); HierarchicalContainer hc = new HierarchicalContainer(); hc.addContainerProperty(ID_PROPERTY, String.class, ""); hc.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, ""); hc.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, ""); hc.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, ""); hc.addContainerProperty(CAP_MAX_PROPERTY, String.class, ""); hc.addContainerProperty(CAP_INT_PROPERTY, String.class, ""); hc.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, ""); detailGroupesTable.setContainerDataSource(hc); int id = 0; for (ElpDeCollection edc : lgroupes) { id++; for (CollectionDeGroupes cdg : edc.getListeCollection()) { id++; ObjetBaseCollectionGroupe obj = new ObjetBaseCollectionGroupe(); obj.setId("" + id); obj.setCod_coll(cdg.getCodCollection()); obj.setCap_max(""); obj.setCap_int(""); obj.setNb_inscrits(""); Item itemCollection = hc.addItem(obj.getId()); renseignerItem(itemCollection, obj); for (Groupe gpe : cdg.getListeGroupes()) { id++; ObjetBaseCollectionGroupe objgpe = new ObjetBaseCollectionGroupe(); objgpe.setId("" + id); objgpe.setCod_gpe(gpe.getCodGroupe()); objgpe.setLib_gpe(gpe.getLibGroupe()); objgpe.setCap_max("" + gpe.getCapMaxGpe()); objgpe.setCap_int("" + gpe.getCapIntGpe()); objgpe.setNb_inscrits("" + gpe.getNbInscrits()); Item i = hc.addItem(objgpe.getId()); renseignerItem(i, objgpe); detailGroupesTable.setParent(objgpe.getId(), obj.getId()); detailGroupesTable.setChildrenAllowed(objgpe.getId(), false); } detailGroupesTable.setCollapsed(obj.getId(), false); } } detailGroupesTable.addContainerProperty(ID_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CAP_MAX_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(CAP_INT_PROPERTY, String.class, ""); detailGroupesTable.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, ""); detailGroupesTable.setVisibleColumns(DETAIL_FIELDS_ORDER); detailGroupesTable.setColumnHeader(CODE_COLLECTION_PROPERTY, applicationContext.getMessage(NAME + ".table.codecollection", null, getLocale())); detailGroupesTable.setColumnHeader(CODE_GROUPE_PROPERTY, applicationContext.getMessage(NAME + ".table.codegroupe", null, getLocale())); detailGroupesTable.setColumnHeader(LIBELLE_GROUPE_PROPERTY, applicationContext.getMessage(NAME + ".table.libgroupe", null, getLocale())); detailGroupesTable.setColumnHeader(CAP_MAX_PROPERTY, applicationContext.getMessage(NAME + ".table.capmax", null, getLocale())); detailGroupesTable.setColumnHeader(CAP_INT_PROPERTY, applicationContext.getMessage(NAME + ".table.capint", null, getLocale())); detailGroupesTable.setColumnHeader(NB_INSCRITS_PROPERTY, applicationContext.getMessage(NAME + ".table.nbinscrits", null, getLocale())); detailGroupesTable.setColumnCollapsingAllowed(true); detailGroupesTable.setColumnReorderingAllowed(false); detailGroupesTable.setSelectable(false); detailGroupesTable.setImmediate(true); detailGroupesTable.addStyleName("scrollabletable"); panelDetailGroupes.setContent(detailGroupesTable); } layout.addComponent(panelDetailGroupes); Panel panelCollectionInfo = new Panel( applicationContext.getMessage(NAME + ".info.title", null, getLocale())); panelCollectionInfo.setIcon(FontAwesome.INFO_CIRCLE); panelCollectionInfo.addStyleName("significationpanel"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); Label mapSignificationLabel = new Label( applicationContext.getMessage(NAME + ".collection.info", null, getLocale())); mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL); mapSignificationLabel.setContentMode(ContentMode.HTML); significationLayout.addComponent(mapSignificationLabel); panelCollectionInfo.setContent(significationLayout); layout.addComponent(panelCollectionInfo); layout.setExpandRatio(panelDetailGroupes, 1); setContent(layout); /* Centre la fentre */ center(); }
From source file:fr.univlorraine.mondossierweb.views.windows.DetailInscriptionWindow.java
License:Apache License
private void init() { //On vrifie le droit d'accder la vue if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { /* Style */ setWidth(80, Unit.PERCENTAGE);// w w w . j a v a 2 s. c om setHeight(95, Unit.PERCENTAGE); setModal(true); setResizable(false); //Test si user enseignant et en vue Enseignant if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { //On recupere les notes pour un enseignant etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneDetailNotesEtResultats(etape); } /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); //Sous titre avec l'anne HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setSizeFull(); titleLayout.setHeight("20px"); Label labelAnneeUniv = new Label( applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>" + etape.getAnnee() + "</b>"); labelAnneeUniv.setContentMode(ContentMode.HTML); titleLayout.addComponent(labelAnneeUniv); titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_CENTER); layout.addComponent(titleLayout); Panel panelDetailInscription = new Panel(etape.getLibelle()); panelDetailInscription.setSizeFull(); panelDetailInscription.addStyleName("small-font-element"); List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques(); if (lelp != null && lelp.size() > 0) { Table detailInscriptionTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp)); detailInscriptionTable.setSizeFull(); detailInscriptionTable.setVisibleColumns(new String[0]); detailInscriptionTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()), new CodeElpColumnGenerator()); detailInscriptionTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()), new LibelleElpColumnGenerator()); if (configController.isAffECTSEtudiant()) { detailInscriptionTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()), new ECTSColumnGenerator()); } detailInscriptionTable.setColumnCollapsingAllowed(true); detailInscriptionTable.setColumnReorderingAllowed(false); detailInscriptionTable.setSelectable(false); detailInscriptionTable.setImmediate(true); detailInscriptionTable.addStyleName("scrollabletable"); panelDetailInscription.setContent(detailInscriptionTable); } else { setHeight(30, Unit.PERCENTAGE); HorizontalLayout messageLayout = new HorizontalLayout(); messageLayout.setSpacing(true); messageLayout.setMargin(true); Label labelAucuneIp = new Label( applicationContext.getMessage(NAME + ".message.aucuneip", null, getLocale())); labelAucuneIp.setStyleName(ValoTheme.LABEL_BOLD); messageLayout.addComponent(labelAucuneIp); panelDetailInscription.setContent(messageLayout); } layout.addComponent(panelDetailInscription); layout.setExpandRatio(panelDetailInscription, 1); setContent(layout); /* Centre la fentre */ center(); } }
From source file:fr.univlorraine.mondossierweb.views.windows.DetailNotesWindow.java
License:Apache License
private void init() { //On vrifie le droit d'accder la vue if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { /* Style */ setWidth(80, Unit.PERCENTAGE);/* ww w . j ava 2s . co m*/ setHeight(95, Unit.PERCENTAGE); setModal(true); setResizable(false); //Test si user enseignant et en vue Enseignant if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { //On recupere les notes pour un enseignant etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape); } else { //On rcupre les notes pour un tudiant etudiantController.renseigneDetailNotesEtResultats(etape); } /* Layout */ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setMargin(true); layout.setSpacing(true); /* Titre */ setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale())); List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques(); //Sous titre avec l'anne HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setSizeFull(); titleLayout.setHeight("20px"); Label messageLabel = new Label( applicationContext.getMessage(NAME + ".label.messageinfo", null, getLocale())); messageLabel.setContentMode(ContentMode.HTML); messageLabel.setStyleName(ValoTheme.LABEL_SMALL); titleLayout.addComponent(messageLabel); titleLayout.setExpandRatio(messageLabel, 1); titleLayout.setComponentAlignment(messageLabel, Alignment.MIDDLE_LEFT); //Test si user enseignant if (userController.isEnseignant() && lelp != null && lelp.size() > 0) { //Bouton pour afficher les filtres btnDisplayFiltres = new Button(); btnDisplayFiltres.setWidth("52px"); btnDisplayFiltres.setHeight("32px"); btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_PRIMARY); if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY); } btnDisplayFiltres.setIcon(FontAwesome.FILTER); btnDisplayFiltres.setDescription( applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale())); btnDisplayFiltres.addClickListener(e -> { btnDisplayFiltres.setVisible(false); panelVue.setVisible(true); }); titleLayout.addComponent(btnDisplayFiltres); titleLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT); //titleLayout.setExpandRatio(btnDisplayFiltres, 1); btnDisplayFiltres.setVisible(true); } if (lelp != null && lelp.size() > 0 && configController.isPdfNotesActive()) { Button pdfButton = new Button(); pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); pdfButton.addStyleName("button-icon"); pdfButton.addStyleName("red-button-icon"); pdfButton.setIcon(FontAwesome.FILE_PDF_O); pdfButton.setDescription( applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale())); if (PropertyUtils.isPushEnabled()) { MyFileDownloader fd = new MyFileDownloader(noteController.exportPdfDetail(etape)); fd.extend(pdfButton); } else { FileDownloader fd = new FileDownloader(noteController.exportPdfDetail(etape)); fd.extend(pdfButton); } titleLayout.addComponent(pdfButton); titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT); } layout.addComponent(titleLayout); //Test si user enseignant if (userController.isEnseignant() && lelp != null && lelp.size() > 0) { panelVue = new Panel(); HorizontalLayout vueLayout = new HorizontalLayout(); vueLayout.setMargin(true); vueLayout.setSpacing(true); vueLayout.setSizeFull(); Button changerVueButton = new Button( applicationContext.getMessage(NAME + ".button.vueEnseignant", null, getLocale())); changerVueButton.setStyleName(ValoTheme.BUTTON_PRIMARY); if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { changerVueButton.setStyleName(ValoTheme.BUTTON_FRIENDLY); changerVueButton.setCaption( applicationContext.getMessage(NAME + ".button.vueEtudiant", null, getLocale())); } //On change la variable vueEnseignantNotesEtResultats et on recr la vue en cours changerVueButton.addClickListener(e -> { etudiantController.changerVueNotesEtResultats(); init(); }); Label vueLabel = new Label( applicationContext.getMessage(NAME + ".label.vueEtudiant", null, getLocale())); if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) { vueLabel.setValue( applicationContext.getMessage(NAME + ".label.vueEnseignant", null, getLocale())); } vueLabel.setContentMode(ContentMode.HTML); vueLabel.setStyleName(ValoTheme.LABEL_SMALL); vueLayout.addComponent(changerVueButton); vueLayout.setComponentAlignment(changerVueButton, Alignment.MIDDLE_CENTER); vueLayout.addComponent(vueLabel); vueLayout.setExpandRatio(vueLabel, 1); panelVue.setContent(vueLayout); layout.addComponent(panelVue); panelVue.setVisible(false); } Panel panelDetailNotes = new Panel(etape.getLibelle() + " - " + applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " " + etape.getAnnee()); panelDetailNotes.addStyleName("small-font-element"); panelDetailNotes.setSizeFull(); if (lelp != null && lelp.size() > 0) { Table detailNotesTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp)); detailNotesTable.setSizeFull(); detailNotesTable.setVisibleColumns(new String[0]); if (contientElpObtenusPrecedemment(lelp)) { detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.annee", null, getLocale()), new AnneeColumnGenerator()); } detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()), new CodeElpColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()), new LibelleElpColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.notesession1", null, getLocale()), new Session1ColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.resultatsession1", null, getLocale()), new ResultatSession1ColumnGenerator()); detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.notesession2", null, getLocale()), new Session2ColumnGenerator()); detailNotesTable.addGeneratedColumn("resultatsession2", new ResultatSession2ColumnGenerator()); detailNotesTable.setColumnHeader("resultatsession2", applicationContext.getMessage(NAME + ".table.elp.resultatsession2", null, getLocale())); if (configController.isAffRangEtudiant() || etudiantController.isAfficherRangElpEpr()) { detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.rang", null, getLocale()), new RangColumnGenerator()); } if (configController.isAffECTSEtudiant()) { detailNotesTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()), new ECTSColumnGenerator()); } detailNotesTable.setColumnCollapsingAllowed(true); detailNotesTable.setColumnReorderingAllowed(false); detailNotesTable.setSelectable(false); detailNotesTable.setImmediate(true); detailNotesTable.addStyleName("scrollabletable"); panelDetailNotes.setContent(detailNotesTable); } else { setHeight(30, Unit.PERCENTAGE); HorizontalLayout messageLayout = new HorizontalLayout(); messageLayout.setSpacing(true); messageLayout.setMargin(true); Label labelAucunResultat = new Label( applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale())); labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD); messageLayout.addComponent(labelAucunResultat); panelDetailNotes.setContent(messageLayout); } layout.addComponent(panelDetailNotes); if (lelp != null && lelp.size() > 0 && MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { Panel panelSignificationResultats = new Panel( applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale())); panelSignificationResultats.addStyleName("significationpanel"); panelSignificationResultats.addStyleName("small-font-element"); panelSignificationResultats.setIcon(FontAwesome.INFO_CIRCLE); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); String grilleSignficationResultats = ""; //grilleSignficationResultats = significationResultats.toString().substring(1,significationResultats.toString().length()-1); Set<String> ss = MainUI.getCurrent().getEtudiant().getSignificationResultats().keySet(); for (String k : ss) { if (k != null && !k.equals("") && !k.equals(" ")) { grilleSignficationResultats = grilleSignficationResultats + "<b>" + k + "</b> : " + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k); grilleSignficationResultats = grilleSignficationResultats + "   "; } } Label mapSignificationLabel = new Label(grilleSignficationResultats); mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL); mapSignificationLabel.setContentMode(ContentMode.HTML); significationLayout.addComponent(mapSignificationLabel); panelSignificationResultats.setContent(significationLayout); layout.addComponent(panelSignificationResultats); } layout.setExpandRatio(panelDetailNotes, 1); setContent(layout); /* Centre la fentre */ center(); } }
From source file:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java
License:Apache License
/** * Cre une fentre/*from ww w . j a v a 2s .c om*/ */ public SignificationsMobileWindow(boolean afficherSignificationIndicateurProfondeur) { setWidth("95%"); setHeight("95%"); setCaption(applicationContext.getMessage("significationsWindow.title", null, getLocale())); setModal(true); setResizable(false); setClosable(false); setStyleName("v-popover-blank"); VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); VerticalLayout panelLayout = new VerticalLayout(); panelLayout.setWidth("100%"); panelLayout.setStyleName("v-scrollableelement"); panelLayout.setSpacing(true); panelLayout.setMargin(true); if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) { Panel panelSignificationResultats = new Panel(); panelSignificationResultats.setCaption( applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale())); panelSignificationResultats.addStyleName("significationpanel"); panelSignificationResultats.setWidth("100%"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setWidth("100%"); significationLayout.setMargin(true); significationLayout.setSpacing(true); Set<String> ss = MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().keySet(); for (String k : ss) { if (k != null && !k.equals("") && !k.equals(" ")) { HorizontalLayout signLayout = new HorizontalLayout(); signLayout.setSizeFull(); signLayout.setMargin(true); signLayout.setSpacing(true); Label codeLabel = new Label(k); codeLabel.setStyleName(ValoTheme.LABEL_BOLD); codeLabel.addStyleName("v-label-align-right"); signLayout.addComponent(codeLabel); Label valueLabel = new Label( "" + MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().get(k)); signLayout.addComponent(valueLabel); significationLayout.addComponent(signLayout); } } panelSignificationResultats.setContent(significationLayout); panelLayout.addComponent(panelSignificationResultats); } if (afficherSignificationIndicateurProfondeur) { Panel panelSignificationIndicateurs = new Panel(); panelSignificationIndicateurs.setCaption( applicationContext.getMessage(NAME + ".info.significations.indicateurs", null, getLocale())); panelSignificationIndicateurs.addStyleName("significationpanel"); panelSignificationIndicateurs.setWidth("100%"); VerticalLayout significationLayout = new VerticalLayout(); significationLayout.setMargin(true); significationLayout.setSpacing(true); significationLayout.setWidth("100%"); //1er NIVEAU HorizontalLayout levelLayout1 = new HorizontalLayout(); levelLayout1.setWidth("100%"); HorizontalLayout levelMainLayout1 = new HorizontalLayout(); levelMainLayout1.setWidth("100%"); levelMainLayout1.setSpacing(true); levelMainLayout1.setStyleName("level-indicator-layout"); int k = 0; for (int i = 0; i < 1; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout1.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout1.addComponent(libLevelSpaceLayout); } levelLayout1.addComponent(levelMainLayout1); levelLayout1.addComponent(new Label("1er niveau")); significationLayout.addComponent(levelLayout1); //2em NIVEAU HorizontalLayout levelLayout2 = new HorizontalLayout(); levelLayout2.setSizeFull(); HorizontalLayout levelMainLayout2 = new HorizontalLayout(); levelMainLayout2.setSizeFull(); levelMainLayout2.setSpacing(true); levelMainLayout2.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 2; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout2.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout2.addComponent(libLevelSpaceLayout); } levelLayout2.addComponent(levelMainLayout2); levelLayout2.addComponent(new Label("2em niveau")); significationLayout.addComponent(levelLayout2); //3em NIVEAU HorizontalLayout levelLayout3 = new HorizontalLayout(); levelLayout3.setSizeFull(); HorizontalLayout levelMainLayout3 = new HorizontalLayout(); levelMainLayout3.setSizeFull(); levelMainLayout3.setSpacing(true); levelMainLayout3.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 3; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout3.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout3.addComponent(libLevelSpaceLayout); } levelLayout3.addComponent(levelMainLayout3); levelLayout3.addComponent(new Label("3em niveau")); significationLayout.addComponent(levelLayout3); //4em NIVEAU HorizontalLayout levelLayout4 = new HorizontalLayout(); levelLayout4.setSizeFull(); HorizontalLayout levelMainLayout4 = new HorizontalLayout(); levelMainLayout4.setSizeFull(); levelMainLayout4.setSpacing(true); levelMainLayout4.setStyleName("level-indicator-layout"); k = 0; for (int i = 0; i < 4; i++) { //Ajout d'un level k++; Label libLevelLayout = new Label(); libLevelLayout.setSizeFull(); libLevelLayout.setHeight("8px"); libLevelLayout.setStyleName("layout-level-green-indicator"); levelMainLayout4.addComponent(libLevelLayout); } //On pense avoir 7 level maxi for (int j = k; j < 8; j++) { Label libLevelSpaceLayout = new Label(); libLevelSpaceLayout.setSizeFull(); libLevelSpaceLayout.setHeight("8px"); levelMainLayout4.addComponent(libLevelSpaceLayout); } levelLayout4.addComponent(levelMainLayout4); levelLayout4.addComponent(new Label("4em niveau")); significationLayout.addComponent(levelLayout4); //ETC HorizontalLayout levelLayoutEtc = new HorizontalLayout(); levelLayoutEtc.setSizeFull(); levelLayoutEtc.addComponent(new Label("...")); levelLayoutEtc.addComponent(new Label("")); significationLayout.addComponent(levelLayoutEtc); panelSignificationIndicateurs.setContent(significationLayout); panelLayout.addComponent(panelSignificationIndicateurs); } layout.addComponent(panelLayout); // close button HorizontalLayout bLayout = new HorizontalLayout(); bLayout.setSizeFull(); bLayout.setHeight("50px"); Button closeButton = new Button(); //closeButton.setCaption(applicationContext.getMessage("significationsWindow.btnFermer", null, getLocale())); closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY); closeButton.addStyleName("v-popover-button"); closeButton.setIcon(FontAwesome.CHECK); closeButton.addClickListener(e -> { close(); }); bLayout.addComponent(closeButton); bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER); layout.addComponent(bLayout); layout.setExpandRatio(panelLayout, 1); }