Example usage for com.vaadin.ui Label setSizeFull

List of usage examples for com.vaadin.ui Label setSizeFull

Introduction

In this page you can find the example usage for com.vaadin.ui Label setSizeFull.

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

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();/*from   ww  w . jav a  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();
                }

                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.EtatCivilView.java

License:Apache License

/**
 * Initialise la vue/* w  w  w .ja v  a2 s . com*/
 */
@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.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  .  jav 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();
                } 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// w w  w . ja  v  a 2  s  .  co  m
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI && userController.isEnseignant()) {
        // On rinitialise la vue
        removeAllComponents();

        // Style
        setSizeFull();
        addStyleName("v-noscrollableelement");

        // On rcupre le favori  afficher
        typeFavori = MdwTouchkitUI.getCurrent().getTypeObjListInscrits();
        libelleObj = "";
        if (typeIsVet() && MdwTouchkitUI.getCurrent().getEtapeListeInscrits() != null) {
            libelleObj = MdwTouchkitUI.getCurrent().getEtapeListeInscrits().getLibelle();
        }
        if (typeIsElp() && MdwTouchkitUI.getCurrent().getElpListeInscrits() != null) {
            libelleObj = MdwTouchkitUI.getCurrent().getElpListeInscrits().getLibelle();
        }

        //Rcupration de la liste des inscrits
        List<Inscrit> linscrits = MdwTouchkitUI.getCurrent().getListeInscrits();

        //Rcupration du nombre d'inscrit par page
        nbEtuParPage = configController.getTrombiMobileNbEtuParPage();

        //NAVBAR
        HorizontalLayout navbar = new HorizontalLayout();
        navbar.setSizeFull();
        navbar.setHeight("40px");
        navbar.setStyleName("navigation-bar");

        //Bouton retour
        returnButton = new Button();
        returnButton.setIcon(FontAwesome.ARROW_LEFT);
        returnButton.setStyleName("v-nav-button");
        returnButton.addClickListener(e -> {
            if (MdwTouchkitUI.getCurrent().getTrombinoscopeFromView() != null
                    && MdwTouchkitUI.getCurrent().getTrombinoscopeFromView().equals(FavorisMobileView.NAME)) {
                MdwTouchkitUI.getCurrent().navigateTofavoris();
            }
            if (MdwTouchkitUI.getCurrent().getTrombinoscopeFromView() != null
                    && MdwTouchkitUI.getCurrent().getTrombinoscopeFromView().equals(RechercheMobileView.NAME)) {
                MdwTouchkitUI.getCurrent().navigateToRecherche(null);
            }
        });
        navbar.addComponent(returnButton);
        navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);

        //Title
        Label labelTrombi = new Label(applicationContext.getMessage(NAME + ".title.label", null, getLocale()));
        labelTrombi.setStyleName("v-label-navbar");
        navbar.addComponent(labelTrombi);
        navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER);

        // bouton pour ajouter en favori si ce n'est pas dj le cas
        List<Favoris> lfav = favorisController.getFavoris();
        FavorisPK favpk = new FavorisPK();
        favpk.setLogin(userController.getCurrentUserName());
        favpk.setIdfav(MdwTouchkitUI.getCurrent().getCodeObjListInscrits());
        favpk.setTypfav(typeFavori);
        Favoris favori = new Favoris();
        favori.setId(favpk);
        //Si l'objet n'est pas dj en favori
        if (lfav != null && !lfav.contains(favori)) {
            //Cration du bouton pour ajouter l'objet aux favoris
            Button btnAjoutFavori = new Button("+");
            btnAjoutFavori.setIcon(FontAwesome.STAR_O);
            btnAjoutFavori.setStyleName("v-nav-button");
            btnAjoutFavori.addClickListener(e -> {

                //creation du favori en base sur le clic du bouton
                favorisController.saveFavori(favori);

                //On cache le bouton de mise en favori
                btnAjoutFavori.setVisible(false);

                //Affichage d'un message de confirmation
                Notification.show(
                        applicationContext.getMessage(NAME + ".message.favoriAjoute", null, getLocale()),
                        Type.TRAY_NOTIFICATION);
            });

            //Ajout du bouton  l'interface
            navbar.addComponent(btnAjoutFavori);
        }

        //Bouton Filtre
        //On a la possibilit de filtrer le trombinoscope que si on est positionn sur un ELP
        if (typeIsElp()) {
            FiltreInscritsMobileWindow w = new FiltreInscritsMobileWindow();
            //Si on a des lments  afficher dans la popup filtre
            if ((w.getListeEtapes() != null && w.getListeEtapes().size() > 0)
                    || (w.getListeGroupes() != null && w.getListeGroupes().size() > 0)) {
                filterButton = new Button();
                filterButton.setIcon(FontAwesome.ELLIPSIS_V);
                filterButton.setStyleName("v-nav-button");

                filterButton.addClickListener(e -> {
                    w.addCloseListener(f -> {
                        //Si la personne a ferm la popup en appuyant sur le bouton FILTRER
                        if (w.isDemandeFiltrage()) {
                            vetSelectionnee = w.getVetSelectionnee();
                            groupeSelectionne = w.getGroupeSelectionne();
                            displayTrombinoscope(false);
                        }
                    });
                    UI.getCurrent().addWindow(w);

                });
                navbar.addComponent(filterButton);
                navbar.setComponentAlignment(filterButton, Alignment.MIDDLE_RIGHT);
            }
        }

        navbar.setExpandRatio(labelTrombi, 1);
        addComponent(navbar);

        //Test si la liste contient des tudiants
        if (linscrits != null && linscrits.size() > 0) {

            pageEnCours = 1;
            //Calcul du nombre maxi de page
            if (nbEtuParPage > 0 && linscrits.size() > nbEtuParPage) {
                pageMax = (linscrits.size() / nbEtuParPage) + 1;
            } else {
                //On affiche tous les inscrits sur une seule page
                pageMax = 1;
            }

            infoLayout = new VerticalLayout();
            infoLayout.setSizeFull();
            infoLayout.setMargin(true);
            infoLayout.setSpacing(true);
            infoLayout.addStyleName("v-scrollableelement");

            //Layout avec le Libelle
            HorizontalLayout resumeLayout = new HorizontalLayout();
            resumeLayout.setWidth("100%");
            resumeLayout.setHeight("20px");
            //Label affichant le nb d'inscrits
            infoLibelleObj = new Label(libelleObj);
            infoLibelleObj.setStyleName(ValoTheme.LABEL_SMALL);
            infoLibelleObj.setSizeFull();
            resumeLayout.addComponent(infoLibelleObj);
            resumeLayout.setComponentAlignment(infoLibelleObj, Alignment.TOP_CENTER);
            infoLayout.addComponent(resumeLayout);

            //Layout qui contient la liste des inscrits et le trombinoscope
            dataLayout = new VerticalLayout();
            dataLayout.setSizeFull();

            //Layout contenant le gridLayout correspondant au trombinoscope
            verticalLayoutForTrombi = new VerticalLayout();
            verticalLayoutForTrombi.setSizeFull();
            verticalLayoutForTrombi.addStyleName("v-scrollablepanel");

            //Cration du trombinoscope
            displayTrombinoscope(false);

            verticalLayoutForTrombi.addComponent(trombiLayout);
            verticalLayoutForTrombi.setSizeFull();
            verticalLayoutForTrombi.setHeight(null);

            if (pageMax > 1) {
                HorizontalLayout layoutPagination = new HorizontalLayout();
                layoutPagination.setWidth("100%");
                layoutPagination.setMargin(true);
                if (pageEnCours < pageMax) {
                    Button btnNext = new Button(
                            applicationContext.getMessage(NAME + ".btn.affichersuite", null, getLocale()));
                    btnNext.setStyleName(ValoTheme.BUTTON_PRIMARY);
                    btnNext.addStyleName("v-popover-button");
                    btnNext.addClickListener(e -> {
                        pageEnCours++;
                        displayTrombinoscope(true);
                        if (pageEnCours >= pageMax) {
                            btnNext.setVisible(false);
                        }
                    });
                    layoutPagination.addComponent(btnNext);
                    layoutPagination.setComponentAlignment(btnNext, Alignment.MIDDLE_CENTER);
                    layoutPagination.setExpandRatio(btnNext, 1);
                }
                verticalLayoutForTrombi.addComponent(layoutPagination);

            }

            //Le layout contient le trombi  afficher
            dataLayout.addComponent(verticalLayoutForTrombi);

            infoLayout.addComponent(dataLayout);
            infoLayout.setExpandRatio(dataLayout, 1);

            addComponent(infoLayout);

            setExpandRatio(infoLayout, 1);
        } else {
            // Layout contenant le label du message indiquant aucun inscrit
            infoLayout = new VerticalLayout();
            infoLayout.setMargin(true);
            infoLayout.setSpacing(true);

            // Label du message indiquant aucun inscrit
            Label infoAucuninscrit = new Label(
                    applicationContext.getMessage(NAME + ".message.aucuninscrit", null, getLocale()));
            infoAucuninscrit.setSizeFull();

            // Ajout du label au layout
            infoLayout.addComponent(infoAucuninscrit);
            addComponent(infoLayout);
            setExpandRatio(infoLayout, 1);
        }

    }

}

From source file:fr.univlorraine.mondossierweb.views.ListeInscritsMobileView.java

License:Apache License

/**
 * Affichage du trombinoscope/*from  w  w w.  j  a v  a 2  s  . co  m*/
 */
private void displayTrombinoscope(boolean completion) {
    // Rcupration de la liste des inscrits
    List<Inscrit> linscrits = MdwTouchkitUI.getCurrent().getListeInscrits();

    // On rinitialise le layout contenant le trombinoscope
    if (trombiLayout != null) {
        //On n'a pas fait 'afficher suivant'
        if (!completion) {
            trombiLayout.removeAllComponents();
        }
    } else {
        trombiLayout = new VerticalLayout();
        trombiLayout.setSizeFull();
        trombiLayout.setSpacing(true);
    }

    int compteurEtu = 0;
    //Pour chaque inscrit
    for (Inscrit inscrit : linscrits) {

        compteurEtu++;
        //Si on affiche tout sur une page ou si l'tudiant doit tre affich sur cette page
        if (pageMax == 1 || ((((pageEnCours - 1) * nbEtuParPage) < compteurEtu)
                && (compteurEtu <= ((pageEnCours) * nbEtuParPage)))) {

            boolean afficherEtudiant = true;

            //Si l'tudiant n'est pas dans la VET slectionne, on ne l'affiche pas
            if (StringUtils.hasText(vetSelectionnee)
                    && (inscrit.getId_etp() == null || !inscrit.getId_etp().contains(vetSelectionnee))) {
                afficherEtudiant = false;

            }

            // Si l'tudiant n'est pas dans le groupe slectionn, on ne l'affiche pas
            if (StringUtils.hasText(groupeSelectionne) && (inscrit.getCodes_groupes() == null
                    || !inscrit.getCodes_groupes().contains(groupeSelectionne))) {
                afficherEtudiant = false;
            }

            // Si l'tudiant doit tre affich
            if (afficherEtudiant) {

                // Panel contenant l'tudiant
                Panel etuPanel = new Panel();

                // Layout du Panel contenant l'tudiant
                HorizontalLayout photoLayout = new HorizontalLayout();
                // Ajout d'un id sur le layout
                photoLayout.setId(inscrit.getCod_ind());
                photoLayout.setSizeFull();

                // Si on a une url renseigne vers la photo de l'tudiant
                if (inscrit.getUrlphoto() != null) {

                    // Image contenant la photo de l'tudiant
                    Image fotoEtudiant = new Image(null, new ExternalResource(inscrit.getUrlphoto()));
                    fotoEtudiant.setWidth("120px");
                    fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK);
                    // Gestion du clic sur la photo
                    fotoEtudiant.addClickListener(e -> {
                        // Au clic sur la photo on redirige vers le contenu du dossier de l'tudiant dont la photo a t clique
                        rechercheController.accessToMobileDetail(inscrit.getCod_etu().toString(),
                                Utils.TYPE_ETU, false);
                    });
                    // Ajout de la photo au layout
                    photoLayout.addComponent(fotoEtudiant);

                }

                // Layout contenant le nom, prnom et le codetu
                VerticalLayout nomCodeLayout = new VerticalLayout();
                //nomCodeLayout.setSizeFull();
                nomCodeLayout.setSpacing(false);

                // Bouton contenant le nom/prnom
                Button btnNomEtudiant = new Button(inscrit.getPrenom() + " " + inscrit.getNom());
                Utils.setButtonStyle(btnNomEtudiant);

                // Ajout du bouton au layout
                nomCodeLayout.addComponent(btnNomEtudiant);
                //Gestion du clic sur le bouton
                btnNomEtudiant.addClickListener(e -> {
                    // Au clic sur le bouton on redirige vers le contenu du dossier de l'tudiant dont le nom a t cliqu
                    rechercheController.accessToMobileDetail(inscrit.getCod_etu().toString(), Utils.TYPE_ETU,
                            false);
                });
                nomCodeLayout.setComponentAlignment(btnNomEtudiant, Alignment.MIDDLE_CENTER);
                //nomCodeLayout.setExpandRatio(btnNomEtudiant, 1);

                // Label contenant le codetu
                Label codetuLabel = new Label(inscrit.getCod_etu());
                codetuLabel.setSizeFull();
                codetuLabel.setStyleName(ValoTheme.LABEL_TINY);
                codetuLabel.addStyleName("label-centre");

                // Ajout du label au layout
                nomCodeLayout.addComponent(codetuLabel);
                nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER);

                // Ajout du layout contenant nom, prnom et codetu au layout de la photo
                photoLayout.addComponent(nomCodeLayout);
                photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER);
                photoLayout.setExpandRatio(nomCodeLayout, 1);

                // Ajout du layout de la photo comme contenu du panel
                etuPanel.setContent(photoLayout);
                trombiLayout.addComponent(etuPanel);
                trombiLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER);
            }
        }
    }

}

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 {/*from   ww  w. j  a v a  2 s. co 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;/*from w  w w .j ava  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.windows.SignificationsMobileWindow.java

License:Apache License

/**
 * Cre une fentre//from w  ww. j a va 2 s .c  o m
 */
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);

}

From source file:module.contents.presentationTier.component.PageView.java

License:Open Source License

@Override
public void attach() {
    super.attach();

    final Panel layout = new Panel();
    final SpacingHandler content = (SpacingHandler) layout.getContent();
    content.setSpacing(true);//ww  w. j a  v a 2 s  .  c o m
    final MarginHandler marginHandler = (MarginHandler) layout.getContent();
    marginHandler.setMargin(new MarginInfo(false));
    setCompositionRoot(layout);
    layout.setHeight(500, UNITS_PIXELS);
    layout.addStyleName(BennuTheme.PANEL_LIGHT);

    final Label title = new Label("<h2>" + page.getTitle().getContent() + "</h2>", Label.CONTENT_XHTML);
    title.setSizeFull();
    layout.addComponent(title);

    final PageIndex pageIndex = new PageIndex();
    layout.addComponent(pageIndex);

    final PageContent pageContent = new PageContent();
    layout.addComponent(pageContent);

    if (scrolledSection != null) {
        scrollIntoSection(scrolledSection.getExternalId());
    }
    /*
     * renderPageMenuArea(horizontalSplitPanel);
     * renderPageContent(horizontalSplitPanel);
     */
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.project.GAMPStep.java

License:Apache License

@Override
public Component getContent() {
    VerticalLayout vl = new VerticalLayout();
    Label text = new Label();
    text.setSizeFull();
    text.setEnabled(false);//from   ww  w . j  a v  a  2  s.co m
    text.setValue(TRANSLATOR.translate("template.gamp5.disclaimer"));
    getCategory().removeAllItems();
    switch (wizard.getType()) {
    case "general.software":
        //Load SW options
        getCategory().addItem("template.gamp5.sw.cat1");
        getCategory().addItem("template.gamp5.sw.cat3");
        getCategory().addItem("template.gamp5.sw.cat4");
        getCategory().addItem("template.gamp5.sw.cat5");
        break;
    default:
        //Load HW options
        getCategory().addItem("template.gamp5.hw.cat1");
        getCategory().addItem("template.gamp5.hw.cat2");
    }
    wizard.translateSelect(getCategory());
    vl.addComponent(getCategory());
    vl.addComponent(text);
    vl.setSizeFull();
    return vl;
}