List of usage examples for com.vaadin.ui VerticalLayout setSizeFull
@Override public void setSizeFull()
From source file:fr.univlorraine.mondossierweb.MdwFallbackTouchkitUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { Label label = new Label(applicationContext.getMessage("fallbackToMobile.message", new Object[] { PropertyUtils.getAppUrl() }, getLocale()), ContentMode.HTML); label.setStyleName(ValoTheme.LABEL_HUGE); VerticalLayout content = new VerticalLayout(); content.setSizeFull(); content.setMargin(true);/* w ww.j av a 2 s . c om*/ content.addComponent(label); setContent(content); }
From source file:fr.univlorraine.mondossierweb.views.AdressesView.java
License:Apache License
/** * Initialise la vue/*from w ww.ja va 2 s . c o m*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { removeAllComponents(); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); if (MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { FormLayout formAdresseAnnuelleLayout = new FormLayout(); formAdresseAnnuelleLayout.setSpacing(true); formAdresseAnnuelleLayout.setMargin(true); Panel panelAdresseAnnuelle = new Panel( applicationContext.getMessage(NAME + ".adresseannuelle.title", null, getLocale()) + " " + MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAnnee()); String captionAdresseAnnuelle = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseAnnuelle = new Label(); formatLabel(fieldAdresseAnnuelle, captionAdresseAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse1()); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle); String annuelle2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresse3()); if (annuelle2 != null) { Label fieldAdresseAnnuelle2 = new Label(); formatLabel(fieldAdresseAnnuelle2, null, annuelle2); formAdresseAnnuelleLayout.addComponent(fieldAdresseAnnuelle2); } String captionVilleAnnuelle = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleAnnuelle = new Label(); formatLabel(fieldVilleAnnuelle, captionVilleAnnuelle, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getVille())); formAdresseAnnuelleLayout.addComponent(fieldVilleAnnuelle); String captionPaysAnnuelle = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysAnnuelle = new Label(); formatLabel(fieldPaysAnnuelle, captionPaysAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getPays()); formAdresseAnnuelleLayout.addComponent(fieldPaysAnnuelle); String captionTelephoneAnnuelle = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneAnnuelle = new Label(); formatLabel(fieldTelephoneAnnuelle, captionTelephoneAnnuelle, MainUI.getCurrent().getEtudiant().getAdresseAnnuelle().getNumerotel()); formAdresseAnnuelleLayout.addComponent(fieldTelephoneAnnuelle); panelAdresseAnnuelle.setContent(formAdresseAnnuelleLayout); HorizontalLayout adresseAnnuelleGlobalLayout = new HorizontalLayout(); adresseAnnuelleGlobalLayout.setSizeUndefined(); adresseAnnuelleGlobalLayout.setStyleName("firstitembox"); adresseAnnuelleGlobalLayout.addComponent(panelAdresseAnnuelle); adresseAnnuelleGlobalLayout.setExpandRatio(panelAdresseAnnuelle, 1); idLayout.addComponent(adresseAnnuelleGlobalLayout); } if (MainUI.getCurrent().getEtudiant().getAdresseFixe() != null) { FormLayout formAdresseFixeLayout = new FormLayout(); formAdresseFixeLayout.setSpacing(true); formAdresseFixeLayout.setMargin(true); Panel panelAdresseFixe = new Panel( applicationContext.getMessage(NAME + ".adressefixe.title", null, getLocale())); String captionAdresseFixe = applicationContext.getMessage(NAME + ".adresse.title", null, getLocale()); Label fieldAdresseFixe = new Label(); formatLabel(fieldAdresseFixe, captionAdresseFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse1()); formAdresseFixeLayout.addComponent(fieldAdresseFixe); String adfixe2 = valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse2(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresse3()); if (adfixe2 != null) { Label fieldAdresseFixe2 = new Label(); formatLabel(fieldAdresseFixe2, null, adfixe2); formAdresseFixeLayout.addComponent(fieldAdresseFixe2); } String captionVilleFixe = applicationContext.getMessage(NAME + ".ville.title", null, getLocale()); Label fieldVilleFixe = new Label(); formatLabel(fieldVilleFixe, captionVilleFixe, valuateTextFieldFromMultipleValues( MainUI.getCurrent().getEtudiant().getAdresseFixe().getAdresseetranger(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getCodePostal(), MainUI.getCurrent().getEtudiant().getAdresseFixe().getVille())); formAdresseFixeLayout.addComponent(fieldVilleFixe); String captionPaysFixe = applicationContext.getMessage(NAME + ".pays.title", null, getLocale()); Label fieldPaysFixe = new Label(); formatLabel(fieldPaysFixe, captionPaysFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getPays()); formAdresseFixeLayout.addComponent(fieldPaysFixe); String captionTelephoneFixe = applicationContext.getMessage(NAME + ".telephone.title", null, getLocale()); Label fieldTelephoneFixe = new Label(); formatLabel(fieldTelephoneFixe, captionTelephoneFixe, MainUI.getCurrent().getEtudiant().getAdresseFixe().getNumerotel()); formAdresseFixeLayout.addComponent(fieldTelephoneFixe); panelAdresseFixe.setContent(formAdresseFixeLayout); HorizontalLayout adresseFixeGlobalLayout = new HorizontalLayout(); adresseFixeGlobalLayout.setSizeUndefined(); adresseFixeGlobalLayout.setStyleName("itembox"); adresseFixeGlobalLayout.addComponent(panelAdresseFixe); adresseFixeGlobalLayout.setExpandRatio(panelAdresseFixe, 1); idLayout.addComponent(adresseFixeGlobalLayout); } addComponent(globalLayout); if (userController.isEtudiant() && configController.isModificationAdressesAutorisee() && MainUI.getCurrent().getEtudiant().getAdresseAnnuelle() != null) { HorizontalLayout btnLayout = new HorizontalLayout(); btnLayout.setSizeFull(); btnLayout.setSpacing(true); Button btnModifAdresses = new Button( applicationContext.getMessage(NAME + ".bouton.modifieradresses", null, getLocale())); btnModifAdresses.setStyleName(ValoTheme.BUTTON_PRIMARY); btnModifAdresses.setIcon(FontAwesome.EDIT); btnModifAdresses.addClickListener(e -> { ModificationAdressesWindow maw = new ModificationAdressesWindow( MainUI.getCurrent().getEtudiant()); maw.addCloseListener(f -> { init(); }); UI.getCurrent().addWindow(maw); }); btnLayout.addComponent(btnModifAdresses); btnLayout.setComponentAlignment(btnModifAdresses, Alignment.MIDDLE_LEFT); addComponent(btnLayout); } } }
From source file:fr.univlorraine.mondossierweb.views.CalendrierMobileView.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();// www . j a v a 2 s.c om /* 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); } //Title 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); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); //globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); globalLayout.setStyleName("v-scrollableelement"); if (MdwTouchkitUI.getCurrent().getEtudiant() != null && MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier() != null && MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier().size() > 0) { List<Examen> listeExam = MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier(); for (Examen exam : listeExam) { Panel panelCalendrier = new Panel(); panelCalendrier.setSizeFull(); HorizontalLayout labelExamenLayout = new HorizontalLayout(); labelExamenLayout.setMargin(true); labelExamenLayout.setSpacing(true); labelExamenLayout.setSizeFull(); //Dtail de l'preuve VerticalLayout detailLayout = new VerticalLayout(); detailLayout.setSizeFull(); //ajout de la date Label dateLabel = new Label(exam.getDatedeb()); dateLabel.setStyleName(ValoTheme.LABEL_BOLD); detailLayout.addComponent(dateLabel); dateLabel.addStyleName("v-label-align-right"); //ajout de l'heure Label heureLabel = new Label(exam.getHeure()); detailLayout.addComponent(heureLabel); heureLabel.setStyleName("v-label-align-right"); //ajout de la salle Label salleLabel = new Label(exam.getLibsalle()); detailLayout.addComponent(salleLabel); salleLabel.setStyleName("v-label-align-right"); //ajout du batiment Label batimentLabel = new Label(exam.getBatiment()); detailLayout.addComponent(batimentLabel); batimentLabel.setStyleName("v-label-align-right"); //Libelle de l'preuve VerticalLayout libelleLayout = new VerticalLayout(); libelleLayout.setSizeFull(); Label libLabel = new Label(exam.getEpreuve()); libLabel.setSizeFull(); libLabel.setStyleName(ValoTheme.LABEL_BOLD); libelleLayout.addComponent(new Label("")); libelleLayout.addComponent(libLabel); //Ajout des 2 layouts dans le layout principal labelExamenLayout.addComponent(detailLayout); labelExamenLayout.addComponent(libelleLayout); //Ajout du layout principal dans le panel panelCalendrier.setContent(labelExamenLayout); //Ajout du panel la vue globalLayout.addComponent(panelCalendrier); } } else { Panel panelCalendrier = new Panel(); panelCalendrier.setSizeFull(); HorizontalLayout labelExamenLayout = new HorizontalLayout(); labelExamenLayout.setMargin(true); labelExamenLayout.setSizeFull(); Label aucunExamen = new Label( applicationContext.getMessage(NAME + ".examen.aucun", null, getLocale())); aucunExamen.setStyleName(ValoTheme.LABEL_COLORED); aucunExamen.addStyleName(ValoTheme.LABEL_BOLD); aucunExamen.setWidth("100%"); aucunExamen.addStyleName("label-centre"); labelExamenLayout.addComponent(aucunExamen); panelCalendrier.setContent(labelExamenLayout); globalLayout.addComponent(panelCalendrier); } addComponent(globalLayout); setExpandRatio(globalLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.CalendrierView.java
License:Apache License
/** * Initialise la vue/*from w w w . j a v a 2s . co m*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { /* Style */ setMargin(true); setSpacing(true); //Si on n'a pas dj essayer de rcuprer le calendrier if (!MainUI.getCurrent().getEtudiant().isCalendrierRecupere()) { etudiantController.recupererCalendrierExamens(); } /* Titre */ HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setWidth("100%"); Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); titleLayout.addComponent(title); titleLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT); //Test si on a des diplomes ou des etapes if (MainUI.getCurrent().getEtudiant().getCalendrier() != null && MainUI.getCurrent().getEtudiant().getCalendrier().size() > 0) { Button pdfButton = new Button(); pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); pdfButton.addStyleName("button-big-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(calendrierController.exportPdf()); fd.extend(pdfButton); } else { FileDownloader fd = new FileDownloader(calendrierController.exportPdf()); fd.setOverrideContentType(false); fd.extend(pdfButton); } titleLayout.addComponent(pdfButton); titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT); } addComponent(titleLayout); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); /* Message d'info */ if (applicationContext.getMessage(NAME + ".message.info", null, getLocale()) != null) { Panel panelVue = new Panel(); HorizontalLayout vueLayout = new HorizontalLayout(); vueLayout.setMargin(true); vueLayout.setSpacing(true); vueLayout.setSizeFull(); Label vueLabel = new Label( applicationContext.getMessage(NAME + ".message.info", null, getLocale())); vueLabel.setContentMode(ContentMode.HTML); vueLabel.setStyleName(ValoTheme.LABEL_SMALL); vueLayout.addComponent(vueLabel); vueLayout.setExpandRatio(vueLabel, 1); panelVue.setContent(vueLayout); globalLayout.addComponent(panelVue); } /* Le Calendrier */ Panel panelCalendrier = new Panel( applicationContext.getMessage(NAME + ".calendrier.title", null, getLocale())); panelCalendrier.setSizeFull(); if (MainUI.getCurrent().getEtudiant() != null && MainUI.getCurrent().getEtudiant().getCalendrier() != null && MainUI.getCurrent().getEtudiant().getCalendrier().size() > 0) { BeanItemContainer<Examen> bic = new BeanItemContainer<>(Examen.class, MainUI.getCurrent().getEtudiant().getCalendrier()); Table calendrierTable = new Table(null, bic); calendrierTable.setWidth("100%"); String[] colonnes_to_create = CAL_FIELDS; if (configController.isAffNumPlaceExamen()) { colonnes_to_create = CAL_FIELDS_AVEC_PLACE; } for (String fieldName : colonnes_to_create) { calendrierTable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale())); } calendrierTable.addGeneratedColumn("batiment", new BatimentColumnGenerator()); calendrierTable.addGeneratedColumn("salle", new SalleColumnGenerator()); calendrierTable.setColumnHeader("batiment", applicationContext.getMessage(NAME + ".table.batiment", null, getLocale())); calendrierTable.setColumnHeader("salle", applicationContext.getMessage(NAME + ".table.salle", null, getLocale())); String[] colonnes_to_display = CAL_FIELDS_ORDER; if (configController.isAffNumPlaceExamen()) { colonnes_to_display = CAL_FIELDS_ORDER_AVEC_PLACE; } calendrierTable.setVisibleColumns((Object[]) colonnes_to_display); calendrierTable.setColumnCollapsingAllowed(true); calendrierTable.setColumnReorderingAllowed(true); calendrierTable.setSelectable(false); calendrierTable.setImmediate(true); calendrierTable.setStyleName("noscrollabletable"); calendrierTable.setPageLength(calendrierTable.getItemIds().size()); panelCalendrier.setContent(calendrierTable); } else { HorizontalLayout labelExamenLayout = new HorizontalLayout(); labelExamenLayout.setMargin(true); labelExamenLayout.setSizeFull(); Label aucunExamen = new Label( applicationContext.getMessage(NAME + ".examen.aucun", null, getLocale())); aucunExamen.setStyleName(ValoTheme.LABEL_COLORED); aucunExamen.addStyleName(ValoTheme.LABEL_BOLD); labelExamenLayout.addComponent(aucunExamen); panelCalendrier.setContent(labelExamenLayout); } globalLayout.addComponent(panelCalendrier); addComponent(globalLayout); } }
From source file:fr.univlorraine.mondossierweb.views.EtatCivilView.java
License:Apache License
/** * Initialise la vue/*from ww w . j a v a 2 s . c o m*/ */ @PostConstruct public void init() { LOG.debug(userController.getCurrentUserName() + " EtatCivilView"); //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant())) { if (MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { LOG.debug(userController.getCurrentUserName() + " init EtatCivilView"); /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Layout avec les infos etatcivil et contact CssLayout idLayout = new CssLayout(); idLayout.setSizeFull(); idLayout.setStyleName("flexwrap"); globalLayout.addComponent(idLayout); // Enable Responsive CSS selectors for the layout Responsive.makeResponsive(idLayout); /* Generalites */ FormLayout formGeneralitesLayout = new FormLayout(); formGeneralitesLayout.setSpacing(true); formGeneralitesLayout.setMargin(true); Panel panelGeneralites = new Panel( applicationContext.getMessage(NAME + ".generalites.title", null, getLocale())); String captionNumDossier = applicationContext.getMessage(NAME + ".numdossier.title", null, getLocale()); Label fieldNumDossier = new Label(); formatLabel(fieldNumDossier, captionNumDossier, MainUI.getCurrent().getEtudiant().getCod_etu()); formGeneralitesLayout.addComponent(fieldNumDossier); String captionNNE = applicationContext.getMessage(NAME + ".nne.title", null, getLocale()); Label fieldNNE = new Label(); formatLabel(fieldNNE, captionNNE, MainUI.getCurrent().getEtudiant().getCod_nne()); formGeneralitesLayout.addComponent(fieldNNE); String captionNom = applicationContext.getMessage(NAME + ".nom.title", null, getLocale()); Label fieldNom = new Label(); formatLabel(fieldNom, captionNom, MainUI.getCurrent().getEtudiant().getNom()); formGeneralitesLayout.addComponent(fieldNom); String captionMail = applicationContext.getMessage(NAME + ".mail.title", null, getLocale()); Label mailLabel = new Label(); mailLabel.setCaption(captionMail); String mail = MainUI.getCurrent().getEtudiant().getEmail(); if (StringUtils.hasText(mail)) { mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>"; mailLabel.setValue(mail); mailLabel.setContentMode(ContentMode.HTML); } mailLabel.setSizeFull(); formGeneralitesLayout.addComponent(mailLabel); String captionNationalite = applicationContext.getMessage(NAME + ".nationalite.title", null, getLocale()); Label fieldNationalite = new Label(); formatLabel(fieldNationalite, captionNationalite, MainUI.getCurrent().getEtudiant().getNationalite()); formGeneralitesLayout.addComponent(fieldNationalite); String captionDateNaissance = applicationContext.getMessage(NAME + ".naissance.title", null, getLocale()); Label fieldDateNaissance = new Label(); formatLabel(fieldDateNaissance, captionDateNaissance, MainUI.getCurrent().getEtudiant().getDatenaissance()); formGeneralitesLayout.addComponent(fieldDateNaissance); String captionLieuNaissance = applicationContext.getMessage(NAME + ".lieunaissance.title", null, getLocale()); Label fieldLieuNaissance = new Label(); formatLabel(fieldLieuNaissance, captionLieuNaissance, MainUI.getCurrent().getEtudiant().getLieunaissance()); formGeneralitesLayout.addComponent(fieldLieuNaissance); String captionDepNaissance = applicationContext.getMessage(NAME + ".depnaissance.title", null, getLocale()); Label fieldDepNaissance = new Label(); formatLabel(fieldDepNaissance, captionDepNaissance, MainUI.getCurrent().getEtudiant().getDepartementnaissance()); formGeneralitesLayout.addComponent(fieldDepNaissance); panelGeneralites.setContent(formGeneralitesLayout); HorizontalLayout generalitesGlobalLayout = new HorizontalLayout(); generalitesGlobalLayout.setSizeUndefined(); generalitesGlobalLayout.setStyleName("firstitembox"); generalitesGlobalLayout.addComponent(panelGeneralites); generalitesGlobalLayout.setExpandRatio(panelGeneralites, 1); idLayout.addComponent(generalitesGlobalLayout); /* Bac */ Panel panelBac = new Panel(applicationContext.getMessage(NAME + ".bac.title", null, getLocale())); //Si plusieurs bac if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() > 1) { panelBac.setCaption(applicationContext.getMessage(NAME + ".bacs.title", null, getLocale())); TabSheet bacTabSheet = new TabSheet(); VerticalLayout vBacLayout = new VerticalLayout(); vBacLayout.setSizeFull(); bacTabSheet.setSizeFull(); bacTabSheet.addStyleName(ValoTheme.TABSHEET_FRAMED); for (BacEtatCivil bec : MainUI.getCurrent().getEtudiant().getListeBac()) { FormLayout tabBacLayout = new FormLayout(); tabBacLayout.setSizeFull(); tabBacLayout.setMargin(false); ajouterBacToView(tabBacLayout, bec); bacTabSheet.addTab(tabBacLayout, bec.getCod_bac(), FontAwesome.GRADUATION_CAP); } vBacLayout.addComponent(bacTabSheet); panelBac.setContent(vBacLayout); } else { //Si un seul bac FormLayout formBacLayout = new FormLayout(); formBacLayout.setSizeFull(); if (MainUI.getCurrent().getEtudiant().getListeBac() != null && MainUI.getCurrent().getEtudiant().getListeBac().size() == 1) { formBacLayout.setSpacing(true); formBacLayout.setMargin(true); ajouterBacToView(formBacLayout, MainUI.getCurrent().getEtudiant().getListeBac().get(0)); } panelBac.setContent(formBacLayout); } HorizontalLayout bacGlobalLayout = new HorizontalLayout(); bacGlobalLayout.setSizeUndefined(); bacGlobalLayout.setStyleName("itembox"); bacGlobalLayout.addComponent(panelBac); bacGlobalLayout.setExpandRatio(panelBac, 1); idLayout.addComponent(bacGlobalLayout); /* Info de contact */ panelContact = new Panel(applicationContext.getMessage(NAME + ".contact.title", null, getLocale())); renseignerPanelContact(); globalLayout.addComponent(panelContact); addComponent(globalLayout); } else { /* Erreur */ addComponent(new BasicErreurMessageLayout(applicationContext)); } } }
From source file:fr.univlorraine.mondossierweb.views.FavorisMobileView.java
License:Apache License
/** * Initialise la vue//from ww w .j a va 2 s.co m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) { removeAllComponents(); /* Style */ setSizeFull(); liste_types_inscrits = new LinkedList<String>(); liste_types_inscrits.add("ELP"); liste_types_inscrits.add("VET"); liste_type_arbo = new LinkedList<String>(); liste_type_arbo.add("CMP"); liste_type_arbo.add("VET"); List<Favoris> lfav = favorisController.getFavoris(); //NAVBAR HorizontalLayout navbar = new HorizontalLayout(); navbar.setSizeFull(); navbar.setHeight("40px"); navbar.setStyleName("navigation-bar"); //Bouton info infoButton = new Button(); infoButton.setIcon(FontAwesome.INFO); infoButton.setStyleName("v-nav-button"); infoButton.addClickListener(e -> { /** * NOUVELLE VERSION */ Notification note = new Notification( applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()), "", Notification.TYPE_TRAY_NOTIFICATION, true); note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(6000); note.show(UI.getCurrent().getPage()); /** * ANCIENNE VERSION */ /* //afficher message HelpMobileWindow hbw = new HelpMobileWindow(applicationContext.getMessage("helpWindowMobile.text.enseignant", null, getLocale()),applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()),false); UI.getCurrent().addWindow(hbw); */ }); navbar.addComponent(infoButton); navbar.setComponentAlignment(infoButton, Alignment.MIDDLE_LEFT); //Title Label labelFav = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale())); labelFav.setStyleName("v-label-navbar"); navbar.addComponent(labelFav); navbar.setComponentAlignment(labelFav, Alignment.MIDDLE_CENTER); //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(labelFav, 1); addComponent(navbar); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); globalLayout.setMargin(true); FormLayout labelLayout = new FormLayout(); labelLayout.setSizeFull(); labelLayout.setMargin(false); labelLayout.setSpacing(false); Label infoLabel = new Label(applicationContext.getMessage(NAME + ".info.label", null, getLocale())); infoLabel.setStyleName(ValoTheme.LABEL_SMALL); infoLabel.setIcon(FontAwesome.INFO_CIRCLE); infoLabel.setWidth("100%"); labelLayout.addComponent(infoLabel); globalLayout.addComponent(labelLayout); if (lfav != null && lfav.size() > 0) { if (favorisContientVet(lfav)) { Panel vetPanel = new Panel( applicationContext.getMessage(NAME + ".vetpanel.title", null, getLocale())); vetPanel.setStyleName("centertitle-panel"); vetPanel.addStyleName("v-colored-panel-caption"); vetPanel.setSizeFull(); VerticalLayout vetLayout = new VerticalLayout(); vetLayout.setSizeFull(); vetLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.VET)) { i++; HorizontalLayout favVetLayout = new HorizontalLayout(); favVetLayout.setSizeFull(); favVetLayout.setMargin(true); favVetLayout.setSpacing(true); favVetLayout.setStyleName("v-layout-multiline"); favVetLayout.setWidth("100%"); favVetLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); codeButton.setCaption(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favVetLayout.addComponent(codeButton); //favVetLayout.setComponentAlignment(codeButton, Alignment.MIDDLE_CENTER); favVetLayout.addComponent(libButton); favVetLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favVetLayout.setExpandRatio(libButton, 1); vetLayout.addComponent(favVetLayout); if (i > 1) { favVetLayout.addStyleName("line-separator"); } } } vetPanel.setContent(vetLayout); globalLayout.addComponent(vetPanel); } if (favorisContientElp(lfav)) { Panel elpPanel = new Panel( applicationContext.getMessage(NAME + ".elppanel.title", null, getLocale())); elpPanel.setStyleName("centertitle-panel"); elpPanel.addStyleName("v-colored-panel-caption"); elpPanel.setSizeFull(); VerticalLayout elpLayout = new VerticalLayout(); elpLayout.setSizeFull(); elpLayout.setHeight(null); int i = 0; for (Favoris fav : lfav) { if (fav.getId().getTypfav().equals(Utils.ELP)) { i++; HorizontalLayout favElpLayout = new HorizontalLayout(); favElpLayout.setSizeFull(); favElpLayout.setMargin(true); favElpLayout.setSpacing(true); favElpLayout.setStyleName("v-layout-multiline"); favElpLayout.setWidth("100%"); favElpLayout.setHeight("100%"); Button codeButton = new Button(fav.getId().getIdfav()); Utils.setButtonStyle(codeButton); codeButton.setWidth("90px"); codeButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); Button libButton = new Button(favorisController.getLibObjFavori(fav.getId().getTypfav(), fav.getId().getIdfav())); Utils.setButtonStyle(libButton); libButton.setHeight("100%"); libButton.setWidth("100%"); libButton.addClickListener(e -> { accessToDetail(fav.getId().getIdfav(), fav.getId().getTypfav()); }); favElpLayout.addComponent(codeButton); favElpLayout.addComponent(libButton); favElpLayout.setComponentAlignment(libButton, Alignment.MIDDLE_CENTER); favElpLayout.setExpandRatio(libButton, 1); elpLayout.addComponent(favElpLayout); if (i > 1) { favElpLayout.addStyleName("line-separator"); } } } elpPanel.setContent(elpLayout); globalLayout.addComponent(elpPanel); } } labelAucunFavoriLayout = new HorizontalLayout(); labelAucunFavoriLayout.setMargin(true); labelAucunFavoriLayout.setSizeFull(); Button aucunFavoris = new Button( applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale())); aucunFavoris.setStyleName("v-nav-button"); aucunFavoris.addStyleName(ValoTheme.BUTTON_LINK); aucunFavoris.addClickListener(e -> { ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME); }); labelAucunFavoriLayout.addComponent(aucunFavoris); labelAucunFavoriLayout.setVisible(false); globalLayout.addComponent(labelAucunFavoriLayout); if (lfav == null || lfav.size() == 0) { labelAucunFavoriLayout.setVisible(true); } //addComponent(globalLayout); contentLayout.setStyleName("v-scrollableelement"); contentLayout.addComponent(globalLayout); addComponent(contentLayout); setExpandRatio(contentLayout, 1); } }
From source file:fr.univlorraine.mondossierweb.views.FavorisView.java
License:Apache License
/** * Initialise la vue//from w w w . j av a 2s . c o m */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && userController.isEnseignant()) { removeAllComponents(); /* Style */ setMargin(true); setSpacing(true); liste_types_inscrits = new LinkedList<String>(); liste_types_inscrits.add(Utils.ELP); liste_types_inscrits.add(Utils.VET); liste_type_arbo = new LinkedList<String>(); liste_type_arbo.add(Utils.CMP); liste_type_arbo.add(Utils.VET); lfav = favorisController.getFavoris(); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); if (lfav != null && lfav.size() > 0) { bic = new BeanItemContainer<>(Favoris.class, lfav); bic.addNestedContainerProperty("id.typfav"); bic.addNestedContainerProperty("id.idfav"); favorisTable = new Table(null, bic); favorisTable.setWidth("100%"); favorisTable.addGeneratedColumn("Type", new DisplayTypeColumnGenerator()); favorisTable.setColumnHeader("Type", applicationContext.getMessage(NAME + ".table.id.typfav", null, getLocale())); favorisTable.addGeneratedColumn("id", new DisplayIdColumnGenerator()); favorisTable.setColumnHeader("id", applicationContext.getMessage(NAME + ".table.id.idfav", null, getLocale())); favorisTable.addGeneratedColumn("Libelle", new MyLibelleColumnGenerator()); favorisTable.addGeneratedColumn("Actions", new MyActionsColumnGenerator()); favorisTable.setVisibleColumns((Object[]) FAV_FIELDS_ORDER); favorisTable.setColumnCollapsingAllowed(true); favorisTable.setColumnReorderingAllowed(true); favorisTable.setSelectable(true); favorisTable.setImmediate(true); favorisTable.addStyleName("noscrollabletable"); favorisTable.setPageLength(favorisTable.getItemIds().size()); globalLayout.addComponent(favorisTable); } labelAucunFavoriLayout = new HorizontalLayout(); labelAucunFavoriLayout.setMargin(true); labelAucunFavoriLayout.setSizeFull(); Label aucunFavoris = new Label( applicationContext.getMessage(NAME + ".favoris.aucun", null, getLocale())); aucunFavoris.setStyleName(ValoTheme.LABEL_COLORED); aucunFavoris.addStyleName(ValoTheme.LABEL_BOLD); labelAucunFavoriLayout.addComponent(aucunFavoris); labelAucunFavoriLayout.setVisible(false); globalLayout.addComponent(labelAucunFavoriLayout); if (lfav == null || lfav.size() == 0) { labelAucunFavoriLayout.setVisible(true); } addComponent(globalLayout); } }
From source file:fr.univlorraine.mondossierweb.views.InscriptionsView.java
License:Apache License
/** * Initialise la vue/*from w w w.j a v a2 s . c om*/ */ @PostConstruct public void init() { //On vrifie le droit d'accder la vue if (UI.getCurrent() instanceof MainUI && (userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null && MainUI.getCurrent().getEtudiant() != null) { /* Style */ setMargin(true); setSpacing(true); /* Titre */ Label title = new Label(applicationContext.getMessage(NAME + ".title", null, getLocale())); title.addStyleName(ValoTheme.LABEL_H1); addComponent(title); VerticalLayout globalLayout = new VerticalLayout(); globalLayout.setSizeFull(); globalLayout.setSpacing(true); //Si les informations sur les inscriptions n'ont pas dj t rcupres, on les rcupre if (MainUI.getCurrent().getEtudiant().getLibEtablissement() == null) { etudiantController.recupererInscriptions(); } //Test si la rcupration des inscriptions via le WS s'est bien passe if (MainUI.getCurrent().isRecuperationWsInscriptionsOk()) { //Tout c'est bien pass lors de la rcupration des infos via le WS Panel panelInscription = new Panel(MainUI.getCurrent().getEtudiant().getLibEtablissement()); Table inscriptionsTable = new Table(null, new BeanItemContainer<>(Inscription.class, MainUI.getCurrent().getEtudiant().getLinsciae())); inscriptionsTable.setWidth("100%"); String[] colonnes = IA_FIELDS_ORDER; if (userController.isEtudiant()) { colonnes = IA_FIELDS_ORDER_ETU; } inscriptionsTable.setVisibleColumns((Object[]) colonnes); for (String fieldName : colonnes) { inscriptionsTable.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale())); } inscriptionsTable.addGeneratedColumn( applicationContext.getMessage(NAME + ".table.lib_etp", null, getLocale()), new LibelleInscriptionColumnGenerator()); //inscriptionsTable.setSortContainerPropertyId("cod_anu"); inscriptionsTable.setColumnCollapsingAllowed(true); inscriptionsTable.setColumnReorderingAllowed(false); inscriptionsTable.setSelectable(false); inscriptionsTable.setImmediate(true); inscriptionsTable.setStyleName("noscrollabletable"); inscriptionsTable.setPageLength(inscriptionsTable.getItemIds().size()); panelInscription.setContent(inscriptionsTable); globalLayout.addComponent(panelInscription); //DAC Panel panelDAC = new Panel(applicationContext.getMessage(NAME + ".dac.title", null, getLocale())); if (MainUI.getCurrent().getEtudiant().getLinscdac() != null && MainUI.getCurrent().getEtudiant().getLinscdac().size() > 0) { Table inscriptionsDAC = new Table(null, new BeanItemContainer<>(Inscription.class, MainUI.getCurrent().getEtudiant().getLinscdac())); inscriptionsDAC.setWidth("100%"); inscriptionsDAC.setVisibleColumns((Object[]) DAC_FIELDS_ORDER); for (String fieldName : DAC_FIELDS_ORDER) { inscriptionsDAC.setColumnHeader(fieldName, applicationContext.getMessage(NAME + ".tabledac." + fieldName, null, getLocale())); } inscriptionsDAC.setColumnCollapsingAllowed(true); inscriptionsDAC.setColumnReorderingAllowed(false); inscriptionsDAC.setSelectable(false); inscriptionsDAC.setImmediate(true); inscriptionsDAC.setStyleName("noscrollabletable"); inscriptionsDAC.setPageLength(inscriptionsDAC.getItemIds().size()); panelDAC.setContent(inscriptionsDAC); } else { HorizontalLayout labelDacLayout = new HorizontalLayout(); labelDacLayout.setMargin(true); labelDacLayout.setSizeFull(); Label aucuneDAC = new Label( applicationContext.getMessage(NAME + ".dac.aucune", null, getLocale()) + " " + MainUI.getCurrent().getEtudiant().getLibEtablissement()); aucuneDAC.setStyleName(ValoTheme.LABEL_COLORED); aucuneDAC.addStyleName(ValoTheme.LABEL_BOLD); labelDacLayout.addComponent(aucuneDAC); panelDAC.setContent(labelDacLayout); } globalLayout.addComponent(panelDAC); Panel panelPremInscription = new Panel( applicationContext.getMessage(NAME + ".premiereinsc.title", null, getLocale())); FormLayout formPremInscription = new FormLayout(); formPremInscription.setSpacing(true); formPremInscription.setMargin(true); String captionAnneePremInscription = applicationContext.getMessage(NAME + ".premiereinsc.annee", null, getLocale()); TextField fieldAnneePremInscription = new TextField(captionAnneePremInscription, MainUI.getCurrent().getEtudiant().getAnneePremiereInscrip()); formatTextField(fieldAnneePremInscription); formPremInscription.addComponent(fieldAnneePremInscription); String captionEtbPremInscription = applicationContext.getMessage(NAME + ".premiereinsc.etb", null, getLocale()); TextField fieldEtbPremInscription = new TextField(captionEtbPremInscription, MainUI.getCurrent().getEtudiant().getEtbPremiereInscrip()); formatTextField(fieldEtbPremInscription); formPremInscription.addComponent(fieldEtbPremInscription); panelPremInscription.setContent(formPremInscription); globalLayout.addComponent(panelPremInscription); addComponent(globalLayout); } else { //Il y a eu un soucis lors de la rcupration des infos via le WS Panel panelErreurInscription = new Panel(); Label labelMsgErreur = new Label( applicationContext.getMessage("AllView.erreur.message", null, getLocale())); panelErreurInscription.setContent(labelMsgErreur); addComponent(panelErreurInscription); } } }
From source file:fr.univlorraine.mondossierweb.views.ListeInscritsView.java
License:Apache License
private void displayTrombinoscope() { List<Inscrit> linscrits = MainUI.getCurrent().getListeInscrits(); if (trombiLayout != null) { trombiLayout.removeAllComponents(); } else {// w w w .j a v a2s.c o m trombiLayout = new GridLayout(); trombiLayout.setColumns(5); trombiLayout.setWidth("100%"); trombiLayout.setHeight(null); trombiLayout.setSpacing(true); } for (Inscrit inscrit : linscrits) { if (listecodind.contains(inscrit.getCod_ind())) { VerticalLayout photoLayout = new VerticalLayout(); photoLayout.setId(inscrit.getCod_ind()); photoLayout.setHeight("100%"); if (inscrit.getUrlphoto() != null) { //Button fotoEtu=new Button(); Image fotoEtudiant = new Image(null, new ExternalResource(inscrit.getUrlphoto())); fotoEtudiant.setWidth("120px"); fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK); fotoEtudiant.addClickListener(e -> { rechercheController.accessToDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, null); }); photoLayout.addComponent(fotoEtudiant); //photoLayout.addComponent(fotoEtu); photoLayout.setComponentAlignment(fotoEtudiant, Alignment.MIDDLE_CENTER); photoLayout.setExpandRatio(fotoEtudiant, 1); } VerticalLayout nomCodeLayout = new VerticalLayout(); nomCodeLayout.setSizeFull(); nomCodeLayout.setSpacing(false); Button btnNomEtudiant = new Button(inscrit.getPrenom() + " " + inscrit.getNom()); btnNomEtudiant.setSizeFull(); btnNomEtudiant.setStyleName(ValoTheme.BUTTON_BORDERLESS); btnNomEtudiant.addStyleName("link"); btnNomEtudiant.addStyleName("v-link"); nomCodeLayout.addComponent(btnNomEtudiant); btnNomEtudiant.addClickListener(e -> { rechercheController.accessToDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU, null); }); nomCodeLayout.setComponentAlignment(btnNomEtudiant, Alignment.MIDDLE_CENTER); //nomCodeLayout.setExpandRatio(btnNomEtudiant, 1); Label codetuLabel = new Label(inscrit.getCod_etu()); codetuLabel.setSizeFull(); codetuLabel.setStyleName(ValoTheme.LABEL_TINY); codetuLabel.addStyleName("label-centre"); nomCodeLayout.addComponent(codetuLabel); nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.TOP_CENTER); photoLayout.addComponent(nomCodeLayout); trombiLayout.addComponent(photoLayout); trombiLayout.setComponentAlignment(photoLayout, Alignment.MIDDLE_CENTER); } } }
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;// w w w . j a v a 2 s. c om } //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(); } } }