Example usage for com.vaadin.ui Button setWidth

List of usage examples for com.vaadin.ui Button setWidth

Introduction

In this page you can find the example usage for com.vaadin.ui Button setWidth.

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:fi.semantum.strategia.widget.Tag.java

License:Open Source License

public static void updateMonitoredTags(final Main main, boolean canWrite) {

    final Database database = main.getDatabase();

    final Base base = main.getUIState().currentItem;

    if (!(base instanceof Tavoite || base instanceof Painopiste))
        return;/*w  w  w  .  j av a2 s.com*/

    Set<Tag> monitoredTags = getMonitoredTags(database, base);
    monitoredTags.removeAll(base.getRelatedTags(database));
    Map<String, Base> implementors = new HashMap<String, Base>();
    for (Base impl : Utils.getImplementationSet(database, base)) {
        for (Tag i : impl.getRelatedTags(database)) {
            if (monitoredTags.contains(i)) {
                implementors.put(i.uuid, impl);
            }
        }
    }

    if (!monitoredTags.isEmpty() || canWrite) {

        HorizontalLayout tagHeader = new HorizontalLayout();
        tagHeader.setSpacing(true);

        Label header2 = new Label("Seurattavat aihetunnisteet");
        header2.setHeight("32px");
        header2.addStyleName(ValoTheme.LABEL_HUGE);
        header2.addStyleName(ValoTheme.LABEL_BOLD);
        tagHeader.addComponent(header2);
        tagHeader.setComponentAlignment(header2, Alignment.BOTTOM_CENTER);

        main.properties.addComponent(tagHeader);
        main.properties.setComponentAlignment(tagHeader, Alignment.MIDDLE_CENTER);

        HorizontalLayout divider = new HorizontalLayout();
        main.properties.addComponent(divider);
        main.properties.setComponentAlignment(divider, Alignment.MIDDLE_CENTER);

        VerticalLayout left = new VerticalLayout();
        left.setSpacing(true);
        left.setWidth("400px");
        left.setMargin(true);
        divider.addComponent(left);
        VerticalLayout right = new VerticalLayout();
        right.setSpacing(true);
        right.setWidth("400px");
        right.setMargin(true);
        divider.addComponent(right);

        int i = 0;
        for (final Tag tag : monitoredTags) {

            String tagId = tag.getId(database);

            HorizontalLayout hl = new HorizontalLayout();
            hl.setSpacing(true);
            hl.setHeight("37px");

            Button tagButton = Utils.tagButton(database, "inferred", tagId, i++);
            left.addComponent(tagButton);
            left.setComponentAlignment(tagButton, Alignment.MIDDLE_RIGHT);

            Base implementor = implementors.get(tag.uuid);
            if (implementor != null) {

                String desc = implementor.getId(database);
                if (desc.isEmpty())
                    desc = implementor.getText(database);

                Label tagLabel = new Label("Toteutetaan ylemmll tasolla: " + desc);
                hl.addComponent(tagLabel);
                hl.setComponentAlignment(tagLabel, Alignment.MIDDLE_LEFT);

            } else {

                Button tagButton2 = new Button();
                tagButton2.setCaption("Merkitse toteuttajaksi");
                tagButton2.addStyleName("redButton");
                tagButton2.addStyleName(ValoTheme.BUTTON_SMALL);
                tagButton2.setWidth("200px");
                if (canWrite) {
                    tagButton2.addClickListener(new ClickListener() {

                        private static final long serialVersionUID = -1769769368034323594L;

                        @Override
                        public void buttonClick(ClickEvent event) {
                            base.assertRelatedTags(database, tag);
                            Utils.loseFocus(main.properties);
                            Updates.update(main, true);
                        }

                    });
                    tagButton2.setEnabled(true);
                } else {
                    tagButton2.setEnabled(false);
                }
                hl.addComponent(tagButton2);
                hl.setComponentAlignment(tagButton2, Alignment.MIDDLE_LEFT);

            }

            right.addComponent(hl);
            right.setComponentAlignment(hl, Alignment.MIDDLE_LEFT);

        }

    }

}

From source file:fr.amapj.view.engine.tools.table.complex.ComplexTableBuilder.java

License:Open Source License

private Button createButton(String msg, int taille, CallBack<T> onClic, T t) {
    Button cb = new Button(msg);
    cb.addStyleName("align-center");
    cb.setWidth(taille + "px");
    cb.setImmediate(true);/*from  ww w .ja  va  2 s .co  m*/
    cb.addClickListener(e -> onClic.onClick(t));
    return cb;
}

From source file:fr.amapj.view.engine.tools.TableBuilder.java

License:Open Source License

public Button createButton(String msg, int taille) {
    Button cb = new Button(msg);
    cb.addStyleName("align-center");
    cb.setWidth(taille + "px");
    cb.setImmediate(true);//  w w w.  ja  v  a 2 s.  c o  m
    return cb;
}

From source file:fr.amapj.view.views.mescontrats.MesContratsView.java

License:Open Source License

public void refresh() {
    mesContratsDTO = new MesContratsService().getMesContrats(SessionManager.getUserId());

    layout = this;
    layout.removeAllComponents();/*  w  ww.j a va  2  s  .co  m*/

    // Information sur le renouvellement de l'adhsion
    adhesionPart.addAhesionInfo(layout);

    // Le titre
    addLabel(layout, "Les nouveaux contrats disponibles");

    // la liste des nouveaux contrats 
    List<ContratDTO> newContrats = mesContratsDTO.getNewContrats();
    for (ContratDTO c : newContrats) {
        Panel p = new Panel();
        p.addStyleName(PANEL_UNCONTRAT);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(true);
        hl.setSpacing(true);
        hl.setWidth("100%");

        VerticalLayout vl = new VerticalLayout();
        Label lab = new Label(c.nom);
        lab.addStyleName(LABEL_TITRECONTRAT);
        vl.addComponent(lab);

        String str = formatLibelleContrat(c, true);
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        Button b = addButtonInscription("S'inscrire", c);
        b.setWidth("100%");
        b.addStyleName(BUTTON_PRINCIPAL);
        vl2.addComponent(b);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        p.setContent(hl);

        layout.addComponent(p);

    }

    // Le titre
    addLabel(layout, "Mes contrats existants");

    // la liste des contrats existants 
    List<ContratDTO> existingContrats = mesContratsDTO.getExistingContrats();
    for (ContratDTO c : existingContrats) {
        Panel p = new Panel();
        p.addStyleName(PANEL_UNCONTRAT);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(true);
        hl.setSpacing(true);
        hl.setWidth("100%");

        VerticalLayout vl = new VerticalLayout();
        Label lab = new Label(c.nom);
        lab.addStyleName(LABEL_TITRECONTRAT);
        vl.addComponent(lab);

        String str = formatLibelleContrat(c, false);
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        if (c.isModifiable) {
            Button b = addButtonInscription("Modifier", c);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        if (c.isSupprimable) {
            Button b = addButtonSupprimer("Supprimer", c);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        if (c.isJoker) {
            Button b = addButtonJoker("Grer jokers", c);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        Button v = addButtonVoir("Voir", c);
        v.addStyleName(BUTTON_PRINCIPAL);
        v.setWidth("100%");
        vl2.addComponent(v);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        p.setContent(hl);

        layout.addComponent(p);

    }

    // Le bouton pour tlcharger les contrats
    if (existingContrats.size() > 0) {
        Button telechargerButton = new Button("Imprimer mes contrats ...");
        telechargerButton.setIcon(FontAwesome.PRINT);
        telechargerButton.addStyleName("borderless");
        telechargerButton.addStyleName("large");
        telechargerButton.addClickListener(e -> handleTelecharger());

        layout.addComponent(telechargerButton);
        layout.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT);

    }
}

From source file:fr.amapj.view.views.mescontrats.MesContratsViewAdhesionPart.java

License:Open Source License

public void addAhesionInfo(VerticalLayout layout) {
    MesContratsDTO mesContratsDTO = view.mesContratsDTO;

    // Cas classique de renouvellement de l'adhsion
    if (mesContratsDTO.adhesionDTO.displayAdhesionTop()) {

        Label lab = new Label("Renouvellement de votre adhsion  l'AMAP");
        lab.addStyleName(MesContratsView.LABEL_RUBRIQUE);
        layout.addComponent(lab);//  www .  ja  va2  s.co  m

        Panel p = new Panel();
        p.addStyleName(MesContratsView.PANEL_UNCONTRAT);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(true);
        hl.setSpacing(true);
        hl.setWidth("100%");

        VerticalLayout vl = new VerticalLayout();
        Label lab1 = new Label("Adhsion pour " + mesContratsDTO.adhesionDTO.periodeCotisationDTO.nom);
        lab1.addStyleName(MesContratsView.LABEL_TITRECONTRAT);
        vl.addComponent(lab1);

        String str = formatLibelleAdhesion(mesContratsDTO.adhesionDTO);
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        addLinkImpressionBulletin(mesContratsDTO.adhesionDTO, vl);

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        if (mesContratsDTO.adhesionDTO.isCotisant()) {
            Button b = addButtonAdhesionAdherer("Modifier");
            b.setWidth("100%");
            vl2.addComponent(b);

            b = addButtonAdhesionSupprimer("Supprimer");
            b.setWidth("100%");
            vl2.addComponent(b);

            Button v = addButtonAdhesionVoir("Voir");
            v.setWidth("100%");
            v.addStyleName(MesContratsView.BUTTON_PRINCIPAL);
            vl2.addComponent(v);

        } else {
            Button b = addButtonAdhesionAdherer("Adhrer");
            b.addStyleName(MesContratsView.BUTTON_PRINCIPAL);
            b.setWidth("100%");
            vl2.addComponent(b);
        }

        p.setContent(hl);
        layout.addComponent(p);

    }

    // Cas d'affichage uniquement, pendant 30 jours apres la fin des inscriptions  
    if (mesContratsDTO.adhesionDTO.affichageOnly != null) {
        AffichageOnly aff = mesContratsDTO.adhesionDTO.affichageOnly;

        Label lab = new Label("Votre adhsion  l'AMAP");
        lab.addStyleName(MesContratsView.LABEL_RUBRIQUE);
        layout.addComponent(lab);

        Panel p = new Panel();
        p.addStyleName(MesContratsView.PANEL_UNCONTRAT);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setMargin(true);
        hl.setSpacing(true);
        hl.setWidth("100%");

        VerticalLayout vl = new VerticalLayout();
        Label lab1 = new Label("Adhsion pour " + aff.nomPeriode);
        lab1.addStyleName(MesContratsView.LABEL_TITRECONTRAT);
        vl.addComponent(lab1);

        String str = "Vous avez renouvel votre adhsion  l'AMAP. Montant : "
                + new CurrencyTextFieldConverter().convertToString(aff.montantAdhesion) + " ";
        BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

        if (shouldDisplayLinkBulletinInAffichageOnly(aff)) {
            Link l = LinkCreator
                    .createLink(new PGBulletinAdhesion(aff.idPeriode, aff.idPeriodeUtilisateur, null));
            l.setCaption("Imprimer mon bulletin d'adhsion");
            l.setStyleName("adhesion");

            vl.addComponent(l);
        }

        hl.addComponent(vl);
        hl.setExpandRatio(vl, 1);

        VerticalLayout vl2 = new VerticalLayout();
        vl2.setWidth("115px");
        vl2.setSpacing(true);

        hl.addComponent(vl2);
        hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

        p.setContent(hl);
        layout.addComponent(p);

    }
}

From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupRoleDifferent.java

License:Open Source License

/**
 * Permet de dessiner le tableau /*from   www.j  a  v a 2s  . co  m*/
 */
public void drawTab(Tab tab) {
    GridLayout gl = new GridLayout(4, 1 + tab.lines.size());
    gl.setWidth("800px");
    gl.setSpacing(false);

    contentLayout.addComponent(gl);

    // Construction du titre   
    Label l = new Label(tab.titre);
    l.addStyleName(tab.styleTitre);
    l.setWidth("100%");
    gl.addComponent(l, 0, 0, 3, 0);

    List<TabLine> lines = tab.lines;
    for (int i = 0; i < lines.size(); i++) {
        TabLine line = lines.get(i);

        int height = computeHeight(line);
        // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire
        height = Math.max(height, 36);

        Label l1 = new Label(line.col1);
        l1.addStyleName(line.styleCol1);
        l1.setWidth("100%");
        l1.setHeight(height + "px");
        gl.addComponent(l1, 0, i + 1);

        Label l2 = new Label(line.col2);
        l2.addStyleName(line.styleCol2);
        l2.setWidth("100%");
        l2.setHeight(height + "px");
        gl.addComponent(l2, 1, i + 1);

        Label l3 = new Label(line.col3);
        l3.addStyleName(line.styleCol3);
        l3.setWidth("100%");
        l3.setHeight(height + "px");
        gl.addComponent(l3, 2, i + 1);

        if (line.col4 != null) {
            Button b = new Button(line.col4);
            b.addStyleName(line.styleCol4);
            b.addClickListener(e -> handleButton(line.role));
            b.setWidth("100%");
            gl.addComponent(b, 3, i + 1);
            gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER);
        } else {
            Label l4 = new Label("");
            l4.addStyleName(line.styleCol4);
            l4.setWidth("100%");
            l4.setHeight(height + "px");
            gl.addComponent(l4, 3, i + 1);
        }
    }
}

From source file:fr.amapj.view.views.permanence.mespermanences.grille.InscriptionPopupToutAutorise.java

License:Open Source License

/**
 * Permet de dessiner le tableau /* w w w . jav  a2 s.  c  om*/
 */
public void drawTab(Tab tab) {
    GridLayout gl = new GridLayout(3, 1 + tab.lines.size());
    gl.setWidth("600px");
    gl.setSpacing(false);

    contentLayout.addComponent(gl);

    // Construction du titre   
    Label l = new Label(tab.titre);
    l.addStyleName(tab.styleTitre);
    l.setWidth("100%");
    gl.addComponent(l, 0, 0, 2, 0);

    List<TabLine> lines = tab.lines;
    for (int i = 0; i < lines.size(); i++) {
        TabLine line = lines.get(i);

        int height = computeHeight(line);
        // La taille minimale est de 36 pixels, pour les boutons inscrire / desincrire
        height = Math.max(height, 36);

        Label l1 = new Label(line.col1);
        l1.addStyleName(line.styleCol1);
        l1.setWidth("100%");
        l1.setHeight(height + "px");
        gl.addComponent(l1, 0, i + 1);

        Label l2 = new Label(line.col2);
        l2.addStyleName(line.styleCol2);
        l2.setWidth("100%");
        l2.setHeight(height + "px");
        gl.addComponent(l2, 1, i + 1);

        if (line.col3 != null) {
            Button b = new Button(line.col3);
            b.addStyleName(line.styleCol3);
            b.addClickListener(e -> handleButton(line.cell));
            b.setWidth("100%");
            gl.addComponent(b, 2, i + 1);
            gl.setComponentAlignment(b, Alignment.MIDDLE_CENTER);
        } else {
            Label l3 = new Label("");
            l3.addStyleName(line.styleCol3);
            l3.setWidth("100%");
            l3.setHeight(height + "px");
            gl.addComponent(l3, 2, i + 1);
        }
    }
}

From source file:fr.amapj.view.views.permanence.mespermanences.MesPermanencesView.java

License:Open Source License

public void refresh() {
    mesContratsDTO = new MesPermanencesService().getMesPermanenceDTO(SessionManager.getUserId());

    layout = this;
    layout.removeAllComponents();/*from w  ww  .  j  a  va2  s.  c  o m*/

    if (mesContratsDTO.mesPeriodesPermanences.size() > 0) {

        // Le titre
        addLabel(layout, "S'inscrire aux permanences");

        // la liste des inscriptions possibles
        for (UnePeriodePermanenceDTO c : mesContratsDTO.mesPeriodesPermanences) {
            Panel p = new Panel();
            p.addStyleName(PANEL_UNCONTRAT);

            HorizontalLayout hl = new HorizontalLayout();
            hl.setMargin(true);
            hl.setSpacing(true);
            hl.setWidth("100%");

            VerticalLayout vl = new VerticalLayout();
            Label lab = new Label(c.nom);
            lab.addStyleName(LABEL_TITRECONTRAT);
            vl.addComponent(lab);

            String str = formatLibelleContrat(c, true);
            BaseUiTools.addHtmlLabel(vl, str, "libelle-contrat");

            hl.addComponent(vl);
            hl.setExpandRatio(vl, 1);

            VerticalLayout vl2 = new VerticalLayout();
            vl2.setWidth("115px");
            vl2.setSpacing(true);

            String libButton = getLibButton(c);
            Button b = addButtonInscription(libButton, c);
            b.setWidth("100%");
            b.addStyleName(BUTTON_PRINCIPAL);
            vl2.addComponent(b);

            hl.addComponent(vl2);
            hl.setComponentAlignment(vl2, Alignment.MIDDLE_CENTER);

            p.setContent(hl);

            layout.addComponent(p);

        }
    }

    //
    addLabel(layout, "Les dates de mes permanences");

    VerticalLayout vl1 = BaseUiTools.addPanel(this, "mes-permanences");
    String mesPermanences = getLibMesPermanences();
    BaseUiTools.addHtmlLabel(vl1, mesPermanences, "ligne");

    addLabel(layout, "Consulter les plannings de permanence");

    VerticalLayout vl2 = BaseUiTools.addPanel(this, "mes-permanences");

    // Le bouton pour visualiser les permanences en ligne 
    Button onLineButton = new Button("Visualiser les plannings de permanence ...");
    onLineButton.setIcon(FontAwesome.EYE);
    onLineButton.addStyleName("borderless");
    onLineButton.addStyleName("large");
    onLineButton.addClickListener(e -> handleVisualiser());

    vl2.addComponent(onLineButton);
    vl2.setComponentAlignment(onLineButton, Alignment.MIDDLE_LEFT);

    // Le bouton pour tlcharger les permanences 
    Button telechargerButton = new Button("Tlcharger les plannings de permanence au format tableur ...");
    telechargerButton.setIcon(FontAwesome.PRINT);
    telechargerButton.addStyleName("borderless");
    telechargerButton.addStyleName("large");
    telechargerButton.addClickListener(e -> handleTelecharger());

    vl2.addComponent(telechargerButton);
    vl2.setComponentAlignment(telechargerButton, Alignment.MIDDLE_LEFT);

}

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

License:Apache License

/**
 * Initialise la vue// w  w w .jav a2s  .c o  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.ListeInscritsView.java

License:Apache License

public void initListe() {
    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MainUI && userController.isEnseignant()) {
        // initialisation de la vue
        removeAllComponents();/*w  w  w.  j av a 2s. c  om*/
        listeEtapes = null;
        listeGroupes = null;

        // Style 
        setMargin(true);
        setSpacing(true);
        setSizeFull();

        // Rcupration de l'objet de la SE dont on doit afficher les inscrits
        code = MainUI.getCurrent().getCodeObjListInscrits();
        typeFavori = MainUI.getCurrent().getTypeObjListInscrits();
        libelleObj = "";
        if (typeIsVet() && MainUI.getCurrent().getEtapeListeInscrits() != null) {
            libelleObj = MainUI.getCurrent().getEtapeListeInscrits().getLibelle();
        }
        if (typeIsElp() && MainUI.getCurrent().getElpListeInscrits() != null) {
            libelleObj = MainUI.getCurrent().getElpListeInscrits().getLibelle();
        }

        // Si l'objet est renseign
        if (code != null && typeFavori != null) {

            //Panel contenant les filtres d'affichage et le bouton de mise en favori
            HorizontalLayout panelLayout = new HorizontalLayout();
            panelLayout.setSizeFull();
            panelLayout.addStyleName("small-font-element");

            // Layout contenant les filtres
            FormLayout formInscritLayout = new FormLayout();
            formInscritLayout.setStyleName(ValoTheme.FORMLAYOUT_LIGHT);
            formInscritLayout.setSpacing(true);
            formInscritLayout.setMargin(true);

            panelFormInscrits = new Panel(code + " " + libelleObj);

            //Affichage d'une liste droulante contenant la liste des annes
            List<String> lannees = MainUI.getCurrent().getListeAnneeInscrits();
            if (lannees != null && lannees.size() > 0) {
                listeAnnees = new ComboBox(applicationContext.getMessage(NAME + ".annee", null, getLocale()));
                listeAnnees.setPageLength(5);
                listeAnnees.setTextInputAllowed(false);
                listeAnnees.setNullSelectionAllowed(false);
                listeAnnees.setWidth("150px");
                for (String annee : lannees) {
                    listeAnnees.addItem(annee);
                    int anneenplusun = Integer.parseInt(annee) + 1;
                    listeAnnees.setItemCaption(annee, annee + "/" + anneenplusun);
                }
                listeAnnees.setValue(MainUI.getCurrent().getAnneeInscrits());

                //Gestion de l'vnement sur le changement d'anne
                listeAnnees.addValueChangeListener(new ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        String selectedValue = (String) event.getProperty().getValue();

                        //faire le changement
                        Map<String, String> parameterMap = new HashMap<>();
                        parameterMap.put("code", code);
                        parameterMap.put("type", typeFavori);

                        //rcupration de la nouvelle liste
                        if (typeIsVet()) {
                            listeInscritsController.recupererLaListeDesInscrits(parameterMap, selectedValue,
                                    MainUI.getCurrent());
                        }
                        if (typeIsElp()) {
                            listeInscritsController.recupererLaListeDesInscritsELP(parameterMap, selectedValue,
                                    MainUI.getCurrent());
                        }

                        //update de l'affichage
                        initListe();
                    }
                });
                formInscritLayout.addComponent(listeAnnees);

            }

            //Si on affiche la liste des inscrits  un ELP
            //on doit affiche l'tape d'appartenance et ventuellement les groupes
            //Affichage d'une liste droulante contenant la liste des annes
            if (typeIsElp()) {
                List<VersionEtape> letapes = MainUI.getCurrent().getListeEtapesInscrits();
                if (letapes != null && letapes.size() > 0) {
                    listeEtapes = new ComboBox(
                            applicationContext.getMessage(NAME + ".etapes", null, getLocale()));
                    listeEtapes.setPageLength(5);
                    listeEtapes.setNullSelectionAllowed(false);
                    listeEtapes.setTextInputAllowed(false);
                    listeEtapes.setRequired(false);
                    listeEtapes.setWidth("400px");
                    listeEtapes.addItem(TOUTES_LES_ETAPES_LABEL);
                    listeEtapes.setItemCaption(TOUTES_LES_ETAPES_LABEL, TOUTES_LES_ETAPES_LABEL);
                    for (VersionEtape etape : letapes) {
                        String idEtape = etape.getId().getCod_etp() + "/" + etape.getId().getCod_vrs_vet();
                        listeEtapes.addItem(idEtape);
                        listeEtapes.setItemCaption(idEtape, "[" + idEtape + "] " + etape.getLib_web_vet());
                    }

                    if (MainUI.getCurrent().getEtapeInscrits() != null) {
                        listeEtapes.setValue(MainUI.getCurrent().getEtapeInscrits());
                    } else {

                        listeEtapes.setValue(TOUTES_LES_ETAPES_LABEL);
                    }

                    //Gestion de l'vnement sur le changement d'tape
                    listeEtapes.addValueChangeListener(new ValueChangeListener() {
                        @Override
                        public void valueChange(ValueChangeEvent event) {
                            String vetSelectionnee = (String) event.getProperty().getValue();
                            if (vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) {
                                vetSelectionnee = null;
                            }
                            MainUI.getCurrent().setEtapeInscrits(vetSelectionnee);

                            //faire le changement
                            String groupeSelectionne = ((listeGroupes != null
                                    && listeGroupes.getValue() != null) ? (String) listeGroupes.getValue()
                                            : null);
                            if (groupeSelectionne != null && groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) {
                                groupeSelectionne = null;
                            }
                            filtrerInscrits(vetSelectionnee, groupeSelectionne);

                        }
                    });
                    formInscritLayout.addComponent(listeEtapes);

                }

                List<ElpDeCollection> lgroupes = MainUI.getCurrent().getListeGroupesInscrits();
                if (lgroupes != null && lgroupes.size() > 0) {
                    listeGroupes = new ComboBox();
                    listeGroupes.setPageLength(5);
                    listeGroupes.setNullSelectionAllowed(false);
                    listeGroupes.setTextInputAllowed(false);
                    listeGroupes.setRequired(false);
                    listeGroupes.setStyleName(ValoTheme.COMBOBOX_BORDERLESS);
                    listeGroupes.setWidth("348px");
                    listeGroupes.addItem(TOUS_LES_GROUPES_LABEL);
                    listeGroupes.setItemCaption(TOUS_LES_GROUPES_LABEL, TOUS_LES_GROUPES_LABEL);
                    for (ElpDeCollection edc : lgroupes) {
                        for (CollectionDeGroupes cdg : edc.getListeCollection()) {
                            for (Groupe groupe : cdg.getListeGroupes()) {
                                listeGroupes.addItem(groupe.getCleGroupe());
                                listeGroupes.setItemCaption(groupe.getCleGroupe(), groupe.getLibGroupe());

                            }
                        }
                    }
                    if (MainUI.getCurrent().getGroupeInscrits() != null) {
                        listeGroupes.setValue(MainUI.getCurrent().getGroupeInscrits());
                    } else {
                        listeGroupes.setValue(TOUS_LES_GROUPES_LABEL);
                    }

                    //Gestion de l'vnement sur le changement de groupe
                    listeGroupes.addValueChangeListener(new ValueChangeListener() {
                        @Override
                        public void valueChange(ValueChangeEvent event) {
                            String grpSelectionnee = (String) event.getProperty().getValue();
                            if (grpSelectionnee.equals(TOUS_LES_GROUPES_LABEL)) {
                                grpSelectionnee = null;
                            }
                            MainUI.getCurrent().setGroupeInscrits(grpSelectionnee);

                            //faire le changement
                            String etapeSelectionnee = ((listeEtapes != null && listeEtapes.getValue() != null)
                                    ? (String) listeEtapes.getValue()
                                    : null);
                            if (etapeSelectionnee != null
                                    && etapeSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) {
                                etapeSelectionnee = null;
                            }
                            filtrerInscrits(etapeSelectionnee, grpSelectionnee);

                        }
                    });

                    HorizontalLayout gpLayout = new HorizontalLayout();
                    gpLayout.setCaption(applicationContext.getMessage(NAME + ".groupes", null, getLocale()));
                    gpLayout.setMargin(false);
                    gpLayout.setSpacing(false);
                    gpLayout.addComponent(listeGroupes);
                    Button btnDetailGpe = new Button();
                    btnDetailGpe.setWidth("52px");
                    btnDetailGpe.setHeight("32px");
                    btnDetailGpe.setStyleName(ValoTheme.BUTTON_PRIMARY);
                    btnDetailGpe.setIcon(FontAwesome.SEARCH);
                    btnDetailGpe.setDescription(
                            applicationContext.getMessage(NAME + ".detail.groupes", null, getLocale()));
                    btnDetailGpe.addClickListener(e -> {
                        String vet = null;
                        if (listeEtapes != null && listeEtapes.getValue() != null
                                && !listeEtapes.getValue().equals(TOUTES_LES_ETAPES_LABEL)) {
                            vet = listeEtapes.getItemCaption(listeEtapes.getValue());
                        }
                        DetailGroupesWindow dgw = new DetailGroupesWindow(lgroupes,
                                panelFormInscrits.getCaption(), vet, (String) listeAnnees.getValue());
                        UI.getCurrent().addWindow(dgw);
                    });
                    gpLayout.addComponent(btnDetailGpe);

                    formInscritLayout.addComponent(gpLayout);

                }
            }
            panelLayout.addComponent(formInscritLayout);
            panelLayout.setComponentAlignment(formInscritLayout, Alignment.MIDDLE_LEFT);

            //Cration du favori pour l'objet concern pas la liste des inscrits
            List<Favoris> lfav = favorisController.getFavoris();
            FavorisPK favpk = new FavorisPK();
            favpk.setLogin(userController.getCurrentUserName());
            favpk.setIdfav(code);
            favpk.setTypfav(typeFavori);
            Favoris favori = new Favoris();
            favori.setId(favpk);
            //Cration du bouton pour ajouter l'objet aux favoris
            favoriLayout = new VerticalLayout();
            favoriLayout.setSizeFull();
            favoriLayout.setMargin(true);
            favoriLayout.setSpacing(true);
            btnAjoutFavori = new Button(
                    applicationContext.getMessage(NAME + ".btn.ajoutFavori", null, getLocale()));
            btnAjoutFavori.setIcon(FontAwesome.STAR_O);
            btnAjoutFavori.addStyleName(ValoTheme.BUTTON_PRIMARY);
            btnAjoutFavori.setDescription(
                    applicationContext.getMessage(NAME + ".btn.ajoutFavori", null, getLocale()));
            btnAjoutFavori.addClickListener(e -> {

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

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

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

            //Ajout du bouton  l'interface
            favoriLayout.addComponent(btnAjoutFavori);
            favoriLayout.setComponentAlignment(btnAjoutFavori, Alignment.TOP_RIGHT);
            if (typeIsElp()) {
                btnMasquerFiltre = new Button(
                        applicationContext.getMessage(NAME + ".btn.btnMasquerFiltre", null, getLocale()));
                btnMasquerFiltre.setIcon(FontAwesome.CHEVRON_CIRCLE_UP);
                btnMasquerFiltre.addStyleName(ValoTheme.BUTTON_FRIENDLY);
                btnMasquerFiltre.setDescription(
                        applicationContext.getMessage(NAME + ".btn.btnMasquerFiltre", null, getLocale()));
                btnMasquerFiltre.addClickListener(e -> {
                    panelFormInscrits.setContent(null);
                    if (btnDisplayFiltres != null) {
                        btnDisplayFiltres.setVisible(true);
                    }
                });
                favoriLayout.addComponent(btnMasquerFiltre);
                favoriLayout.setComponentAlignment(btnMasquerFiltre, Alignment.BOTTOM_RIGHT);
            }
            panelLayout.addComponent(favoriLayout);
            panelLayout.setComponentAlignment(favoriLayout, Alignment.TOP_RIGHT);

            //Si l'objet est dj en favori
            if (lfav != null && lfav.contains(favori)) {

                //On affiche pas le bouton de mise en favori
                btnAjoutFavori.setVisible(false);
            }

            panelFormInscrits.setContent(panelLayout);
            addComponent(panelFormInscrits);

            //Rcupration de la liste des inscrits
            linscrits = MainUI.getCurrent().getListeInscrits();

            refreshListeCodind(new BeanItemContainer<>(Inscrit.class, linscrits));

            //Test si la liste contient des tudiants
            if (linscrits != null && linscrits.size() > 0 && listecodind != null && listecodind.size() > 0) {
                infoLayout = new VerticalLayout();
                infoLayout.setSizeFull();

                //Layout avec le nb d'inscrit, le bouton trombinoscope et le bouton d'export
                HorizontalLayout resumeLayout = new HorizontalLayout();
                resumeLayout.setWidth("100%");
                resumeLayout.setHeight("50px");

                //Label affichant le nb d'inscrits
                infoNbInscrit = new Label(
                        applicationContext.getMessage(NAME + ".message.nbinscrit", null, getLocale()) + " : "
                                + linscrits.size());

                leftResumeLayout = new HorizontalLayout();
                leftResumeLayout.addComponent(infoNbInscrit);
                leftResumeLayout.setComponentAlignment(infoNbInscrit, Alignment.MIDDLE_LEFT);

                Button infoDescriptionButton = new Button();
                infoDescriptionButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
                infoDescriptionButton.setIcon(FontAwesome.INFO_CIRCLE);
                infoDescriptionButton.setDescription(applicationContext
                        .getMessage(NAME + ".message.info.predescription", null, getLocale()));
                infoDescriptionButton.addClickListener(e -> {
                    String message = "";
                    if (typeIsVet()) {
                        message = applicationContext.getMessage(NAME + ".message.info.vetdescription", null,
                                getLocale());
                    }
                    if (typeIsElp()) {
                        message = applicationContext.getMessage(NAME + ".message.info.elpdescription", null,
                                getLocale());
                    }

                    HelpBasicWindow hbw = new HelpBasicWindow(message,
                            applicationContext.getMessage("helpWindow.defaultTitle", null, getLocale()));
                    UI.getCurrent().addWindow(hbw);
                });
                leftResumeLayout.addComponent(infoDescriptionButton);
                leftResumeLayout.setComponentAlignment(infoDescriptionButton, Alignment.MIDDLE_LEFT);

                //Bouton export trombinoscope
                btnExportTrombi = new Button();
                btnExportTrombi.setIcon(FontAwesome.FILE_PDF_O);
                btnExportTrombi.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
                btnExportTrombi.addStyleName("button-icon");
                btnExportTrombi.addStyleName("red-button-icon");
                btnExportTrombi.setDescription(
                        applicationContext.getMessage(NAME + ".pdf.trombinoscope.link", null, getLocale()));

                //methode qui permet de generer l'export  la demande
                //Cration du nom du fichier
                String nomFichier = applicationContext.getMessage("pdf.trombinoscope.title", null,
                        Locale.getDefault()) + "_" + panelFormInscrits.getCaption() + ".pdf";
                nomFichier = nomFichier.replaceAll(" ", "_");
                StreamResource resource = new StreamResource(new StreamResource.StreamSource() {
                    @Override
                    public InputStream getStream() {

                        //recuperation de l'anne slectionne et du libell de l'ELP
                        String annee = (String) listeAnnees.getValue();
                        String libObj = panelFormInscrits.getCaption();

                        //cration du trombi en pdf
                        return listeInscritsController.getPdfStream(linscrits, listecodind, libObj, annee);
                    }
                }, nomFichier);
                resource.setMIMEType("application/force-download;charset=UTF-8");
                resource.setCacheTime(0);

                //On ajoute le FD sur le bouton d'export
                if (PropertyUtils.isPushEnabled()) {
                    new MyFileDownloader(resource).extend(btnExportTrombi);
                } else {
                    FileDownloader fdpdf = new FileDownloader(resource);
                    fdpdf.setOverrideContentType(false);
                    fdpdf.extend(btnExportTrombi);
                }

                leftResumeLayout.addComponent(btnExportTrombi);
                leftResumeLayout.setComponentAlignment(btnExportTrombi, Alignment.MIDDLE_LEFT);
                //if(!afficherTrombinoscope){

                //On cache le bouton d'export pdf
                btnExportTrombi.setVisible(false);
                //}

                //Bouton export liste excel
                btnExportExcel = new Button();
                btnExportExcel.setIcon(FontAwesome.FILE_EXCEL_O);
                btnExportExcel.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
                btnExportExcel.addStyleName("button-icon");
                btnExportExcel
                        .setDescription(applicationContext.getMessage(NAME + ".excel.link", null, getLocale()));
                String nomFichierXls = applicationContext.getMessage("excel.listeinscrits.title", null,
                        Locale.getDefault()) + "_" + panelFormInscrits.getCaption() + ".xls";
                nomFichierXls = nomFichierXls.replaceAll(" ", "_");

                StreamResource resourceXls = new StreamResource(new StreamResource.StreamSource() {

                    @Override
                    public InputStream getStream() {

                        //recuperation de l'anne slectionne et du libell de l'ELP
                        String annee = (String) listeAnnees.getValue();
                        String libObj = panelFormInscrits.getCaption();

                        //cration du trombi en pdf
                        return listeInscritsController.getXlsStream(linscrits, listecodind, listeGroupes,
                                libObj, annee, typeFavori);
                    }
                }, nomFichierXls);
                resourceXls.setMIMEType("application/force-download;charset=UTF-8");
                resourceXls.setCacheTime(0);
                //On ajoute le FD sur le bouton d'export
                if (PropertyUtils.isPushEnabled()) {
                    new MyFileDownloader(resourceXls).extend(btnExportExcel);
                } else {
                    FileDownloader fd = new FileDownloader(resourceXls);
                    fd.setOverrideContentType(false);
                    fd.extend(btnExportExcel);
                }

                //if(!afficherTrombinoscope){
                //On change le bouton d'export pdf par le bouton export excel
                leftResumeLayout.replaceComponent(btnExportTrombi, btnExportExcel);
                //}

                resumeLayout.addComponent(leftResumeLayout);

                //Middle layout avec les bouton de collapse des colonnes
                middleResumeLayout = new HorizontalLayout();
                middleResumeLayout.setSizeFull();
                middleResumeLayout.addStyleName("small-font-element");
                middleResumeLayout.setSpacing(true);

                if (!typeIsVet()) {
                    collapseEtp = new CheckBox(
                            applicationContext.getMessage(NAME + ".collapseEtp.title", null, getLocale()));
                    collapseEtp.setValue(true);
                    collapseEtp.addValueChangeListener(e -> {
                        inscritstable.setColumnCollapsed("etape", !collapseEtp.getValue());
                    });
                    collapseEtp.setDescription(applicationContext.getMessage(NAME + ".collapseEtp.description",
                            null, getLocale()));
                    middleResumeLayout.addComponent(collapseEtp);
                    middleResumeLayout.setComponentAlignment(collapseEtp, Alignment.MIDDLE_CENTER);
                }
                collapseResultatsS1 = new CheckBox(
                        applicationContext.getMessage(NAME + ".collapseResultatsS1.title", null, getLocale()));
                collapseResultatsS1.setValue(false);
                collapseResultatsS1.addValueChangeListener(e -> {
                    inscritstable.setColumnCollapsed("notes1", !collapseResultatsS1.getValue());
                });
                collapseResultatsS1.setDescription(applicationContext
                        .getMessage(NAME + ".collapseResultatsS1.description", null, getLocale()));
                middleResumeLayout.addComponent(collapseResultatsS1);
                middleResumeLayout.setComponentAlignment(collapseResultatsS1, Alignment.MIDDLE_CENTER);

                collapseResultatsS2 = new CheckBox(
                        applicationContext.getMessage(NAME + ".collapseResultatsS2.title", null, getLocale()));
                collapseResultatsS2.setValue(false);
                collapseResultatsS2.addValueChangeListener(e -> {
                    inscritstable.setColumnCollapsed("notes2", !collapseResultatsS2.getValue());
                });
                collapseResultatsS2.setDescription(applicationContext
                        .getMessage(NAME + ".collapseResultatsS2.description", null, getLocale()));
                middleResumeLayout.addComponent(collapseResultatsS2);
                middleResumeLayout.setComponentAlignment(collapseResultatsS2, Alignment.MIDDLE_CENTER);

                resumeLayout.addComponent(middleResumeLayout);

                HorizontalLayout buttonResumeLayout = new HorizontalLayout();
                buttonResumeLayout.setSizeFull();
                buttonResumeLayout.setSpacing(true);
                //Bouton pour afficher les filtres
                btnDisplayFiltres = new Button();
                btnDisplayFiltres.setWidth("52px");
                btnDisplayFiltres.setHeight("32px");
                btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY);
                btnDisplayFiltres.setIcon(FontAwesome.FILTER);
                btnDisplayFiltres.setDescription(
                        applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale()));
                btnDisplayFiltres.addClickListener(e -> {
                    panelFormInscrits.setContent(panelLayout);
                    btnDisplayFiltres.setVisible(false);
                });
                buttonResumeLayout.addComponent(btnDisplayFiltres);
                buttonResumeLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT);
                buttonResumeLayout.setExpandRatio(btnDisplayFiltres, 1);
                btnDisplayFiltres.setVisible(false);

                //Bouton trombinoscope
                btnTrombi = new Button(
                        applicationContext.getMessage(NAME + ".message.trombinoscope", null, getLocale()));
                if (listeInscritsController.isPhotoProviderOperationnel()) {
                    btnTrombi.setIcon(FontAwesome.GROUP);
                    buttonResumeLayout.addComponent(btnTrombi);

                    //Gestion du clic sur le bouton trombinoscope
                    btnTrombi.addClickListener(e -> {

                        //Si on doit afficher une fentre de loading pendant l'excution
                        if (PropertyUtils.isPushEnabled() && PropertyUtils.isShowLoadingIndicator()) {
                            //affichage de la pop-up de loading
                            MainUI.getCurrent().startBusyIndicator();

                            //Execution de la mthode en parallle dans un thread
                            executorService.execute(new Runnable() {
                                public void run() {
                                    MainUI.getCurrent().access(new Runnable() {
                                        @Override
                                        public void run() {
                                            executeDisplayTrombinoscope();
                                            //close de la pop-up de loading
                                            MainUI.getCurrent().stopBusyIndicator();
                                        }
                                    });
                                }
                            });

                        } else {
                            //On ne doit pas afficher de fentre de loading, on excute directement la mthode
                            executeDisplayTrombinoscope();
                        }

                    });
                    buttonResumeLayout.setComponentAlignment(btnTrombi, Alignment.MIDDLE_RIGHT);
                }

                //Bouton de retour  l'affichage de la liste
                btnRetourListe = new Button(
                        applicationContext.getMessage(NAME + ".message.retourliste", null, getLocale()));
                btnRetourListe.setIcon(FontAwesome.BARS);
                buttonResumeLayout.addComponent(btnRetourListe);
                //if(!afficherTrombinoscope){
                btnRetourListe.setVisible(false);
                //}

                //Gestion du clic sur le bouton de  retour  l'affichage de la liste
                btnRetourListe.addClickListener(e -> {
                    afficherTrombinoscope = false;
                    btnExportTrombi.setVisible(false);
                    leftResumeLayout.replaceComponent(btnExportTrombi, btnExportExcel);
                    btnTrombi.setVisible(true);
                    btnRetourListe.setVisible(false);
                    dataLayout.removeAllComponents();
                    dataLayout.addComponent(inscritstable);
                    middleResumeLayout.setVisible(true);

                });
                buttonResumeLayout.setComponentAlignment(btnRetourListe, Alignment.MIDDLE_RIGHT);

                resumeLayout.addComponent(buttonResumeLayout);

                infoLayout.addComponent(resumeLayout);

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

                //Table contenant la liste des inscrits
                inscritstable = new Table(null, new BeanItemContainer<>(Inscrit.class, linscrits));

                inscritstable.addStyleName("table-without-column-selector");
                inscritstable.setSizeFull();
                inscritstable.setVisibleColumns(new String[0]);

                String[] fields = INS_FIELDS_ELP;
                if (typeIsVet()) {
                    fields = INS_FIELDS_VET;
                }
                for (String fieldName : fields) {
                    inscritstable.setColumnHeader(fieldName,
                            applicationContext.getMessage(NAME + ".table." + fieldName, null, getLocale()));
                }

                inscritstable.addGeneratedColumn("cod_etu", new CodEtuColumnGenerator());
                inscritstable.setColumnHeader("cod_etu",
                        applicationContext.getMessage(NAME + ".table.cod_etu", null, getLocale()));
                inscritstable.addGeneratedColumn("email", new MailColumnGenerator());
                inscritstable.setColumnHeader("email",
                        applicationContext.getMessage(NAME + ".table.email", null, getLocale()));
                inscritstable.addGeneratedColumn("notes1", new Session1ColumnGenerator());
                inscritstable.setColumnHeader("notes1",
                        applicationContext.getMessage(NAME + ".table.notes1", null, getLocale()));
                inscritstable.addGeneratedColumn("notes2", new Session2ColumnGenerator());
                inscritstable.setColumnHeader("notes2",
                        applicationContext.getMessage(NAME + ".table.notes2", null, getLocale()));

                //Si on est sur un ELP
                if (typeIsElp()) {
                    //on affiche l'tape de rattachement
                    inscritstable.addGeneratedColumn("etape", new EtapeColumnGenerator());
                    inscritstable.setColumnHeader("etape",
                            applicationContext.getMessage(NAME + ".table.etape", null, getLocale()));
                }

                String[] fields_to_display = INS_FIELDS_TO_DISPLAY_ELP;
                if (typeIsVet()) {
                    fields_to_display = INS_FIELDS_TO_DISPLAY_VET;
                }

                inscritstable.setVisibleColumns((Object[]) fields_to_display);

                inscritstable.setColumnCollapsingAllowed(true);
                inscritstable.setColumnReorderingAllowed(false);

                //On masque les colonnes de notes par dfaut
                inscritstable.setColumnCollapsed("notes1", true);
                inscritstable.setColumnCollapsed("notes2", true);

                inscritstable.setSelectable(false);
                inscritstable.setImmediate(true);
                inscritstable.addStyleName("scrollabletable");
                //Si on n'a pas dj demand  afficher le trombinoscope
                //if(!afficherTrombinoscope){
                //la layout contient la table
                dataLayout.addComponent(inscritstable);
                //}

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

                //Cration du trombinoscope
                displayTrombinoscope();

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

                //Si on a demand  afficher le trombinoscope
                /*if(afficherTrombinoscope){
                   //Le layout contient le trombi  afficher
                   dataLayout.addComponent(verticalLayoutForTrombi);
                }*/
                infoLayout.addComponent(dataLayout);
                infoLayout.setExpandRatio(dataLayout, 1);
                addComponent(infoLayout);
                setExpandRatio(infoLayout, 1);

                //Si on a demand  afficher le trombinoscope
                if (afficherTrombinoscope) {
                    //On execute la procdure d'affichage du trombinoscope
                    executeDisplayTrombinoscope();
                }
            } else {
                Label infoAucuninscrit = new Label(
                        applicationContext.getMessage(NAME + ".message.aucuninscrit", null, getLocale()));
                addComponent(infoAucuninscrit);
                setComponentAlignment(infoAucuninscrit, Alignment.TOP_CENTER);
                setExpandRatio(infoAucuninscrit, 1);
            }

        }
    }
}