Example usage for com.vaadin.ui Button setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

From source file:com.logicbomb.newschool.MyAppWidgetSet.MenuWidget.java

public MenuWidget(String Width) {

    Panel iPanel = new Panel();
    iPanel.setWidth(Width);//ww w .ja  v a  2  s. co  m
    iPanel.setStyleName("backColorWhite");

    addComponent(iPanel);

    VerticalLayout iVerticalLayout = new VerticalLayout();
    for (int i = 1; i <= 8; i++) {
        Button iButton = new Button();
        iButton.setWidth(Width);
        iButton.setHeight("50px");
        iVerticalLayout.addComponent(iButton);
    }
    iPanel.setContent(iVerticalLayout);

}

From source file:com.mycollab.mobile.ui.ConfirmDialog.java

License:Open Source License

private void constructUI(final String message, final String okCaption, final String cancelCaption) {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();/*  w w w .ja  v  a  2 s  .co m*/
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    VerticalLayout messageWrapper = new VerticalLayout();
    messageWrapper.setStyleName("message-wrapper");
    messageWrapper.setWidth("100%");
    messageWrapper.setMargin(true);

    final Label messageDisplay = new Label(message);
    messageDisplay.setWidth("100%");
    messageWrapper.addComponent(messageDisplay);
    layout.addComponent(messageWrapper);

    HorizontalLayout controlBtn = new HorizontalLayout();
    controlBtn.setWidth("100%");

    final Button okBtn = new Button(okCaption);
    okBtn.setWidth("100%");
    okBtn.setHeight("35px");
    final Button cancelBtn = new Button(cancelCaption);
    cancelBtn.setWidth("100%");
    cancelBtn.setHeight("35px");

    ClickListener listener = (clickEvent) -> {
        ConfirmDialog.this.setConfirmed(clickEvent.getButton() == okBtn);
        if (ConfirmDialog.this.getListener() != null) {
            ConfirmDialog.this.getListener().onClose(ConfirmDialog.this);
        }
        close();
    };

    okBtn.addClickListener(listener);
    cancelBtn.addClickListener(listener);

    controlBtn.addComponent(cancelBtn);
    controlBtn.addComponent(okBtn);

    layout.addComponent(controlBtn);
    this.setContent(layout);
}

From source file:com.salsaw.msalsa.HomePageView.java

License:Apache License

/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor./* w w  w  .  jav  a 2 s .  c  om*/
 * @param navigator 
 */
public HomePageView(SalsaParameters salsaParameters) {
    if (salsaParameters == null) {
        throw new IllegalArgumentException("salsaParameters");
    }

    buildMainLayout();

    // Create form with salsa parameters
    BeanItem<SalsaParameters> salsaParametersBeanItem = new BeanItem<SalsaParameters>(salsaParameters);
    SalsaParametersForm salsaParametersForm = new SalsaParametersForm(salsaParametersBeanItem);

    Button toogleSalsaParametersButton = new Button("Show/Hide M-SALSA Parameters");
    toogleSalsaParametersButton.addClickListener(new Button.ClickListener() {
        /**
        * 
        */
        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            salsaParametersForm.setVisible(!salsaParametersForm.isVisible());
        }
    });

    toogleSalsaParametersButton.setWidth("-1px");
    toogleSalsaParametersButton.setHeight("-1px");
    mainLayout.addComponent(toogleSalsaParametersButton);
    mainLayout.setComponentAlignment(toogleSalsaParametersButton, new Alignment(48));

    salsaParametersForm.setWidth("-1px");
    salsaParametersForm.setHeight("-1px");
    mainLayout.addComponent(salsaParametersForm);
    mainLayout.setComponentAlignment(salsaParametersForm, new Alignment(48));

    setCompositionRoot(mainLayout);

    // TODO add user code here      

    // Implement both receiver that saves upload in a file and
    // listener for successful upload
    class AligmentUploader implements Receiver, SucceededListener {
        /**
        * 
        */
        private static final long serialVersionUID = 1L;

        public File file;

        public OutputStream receiveUpload(String filename, String mimeType) {
            // Create upload stream
            FileOutputStream fos = null; // Stream to write to
            try {
                // Load server configuration
                String tmpFolder = ConfigurationManager.getInstance().getServerConfiguration()
                        .getTemporaryFilePath();

                // Open the file for writing.
                file = Paths.get(tmpFolder, filename).toFile();
                fos = new FileOutputStream(file);
            } catch (final java.io.FileNotFoundException e) {
                new Notification("Could not open file<br/>", e.getMessage(), Notification.Type.ERROR_MESSAGE)
                        .show(Page.getCurrent());
                return null;
            }
            return fos; // Return the output stream to write to
        }

        public void uploadSucceeded(SucceededEvent event) {
            try {
                for (IHomePageListener listener : listeners) {
                    listener.buttonClick(file);
                }

            } catch (SALSAException | IOException | InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();

                new Notification("ERROR: ", e.getMessage(), Notification.Type.ERROR_MESSAGE)
                        .show(Page.getCurrent());
            }
        }
    }
    ;

    AligmentUploader receiver = new AligmentUploader();

    uploadInput.setReceiver(receiver);
    uploadInput.addSucceededListener(receiver);

}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.SearchEngineView.java

License:Open Source License

public void initUI() {

    mainlayout = new Panel();
    mainlayout.addStyleName(ValoTheme.PANEL_BORDERLESS);

    // Search bar
    // *----------- search text field .... search button-----------*
    VerticalLayout searchbar = new VerticalLayout();
    searchbar.setWidth(100, Unit.PERCENTAGE);
    setResponsive(true);//w  ww  .j  a  v  a2s .co  m
    searchbar.setResponsive(true);
    // searchbar.setWidth();

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setResponsive(true);
    buttonLayout.setWidth(75, Unit.PERCENTAGE);

    // searchbar.setSpacing(true);
    final TextField searchfield = new TextField();
    searchfield.setHeight("44px");
    searchfield.setImmediate(true);
    searchfield.setResponsive(true);
    searchfield.setWidth(75, Unit.PERCENTAGE);

    buttonLayout.setSpacing(true);

    searchfield.setInputPrompt("search DB");
    // searchfield.setCaption("QSearch");
    // searchfield.setWidth(25.0f, Unit.EM);
    // searchfield.setWidth(60, Unit.PERCENTAGE);

    // TODO would be nice to have a autofill or something similar
    // searchFieldLayout.addComponent(searchfield);
    searchbar.addComponent(searchfield);
    searchbar.setComponentAlignment(searchfield, Alignment.MIDDLE_RIGHT);

    final NativeSelect navsel = new NativeSelect();
    navsel.addItem("Whole DB");
    navsel.addItem("Projects Only");
    navsel.addItem("Experiments Only");
    navsel.addItem("Samples Only");
    navsel.setValue("Whole DB");
    navsel.setHeight("20px");
    navsel.setNullSelectionAllowed(false);
    navsel.setResponsive(true);
    navsel.setWidth(100, Unit.PERCENTAGE);

    navsel.addValueChangeListener(new Property.ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = -6896454887050432147L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            // TODO Auto-generated method stub
            Notification.show((String) navsel.getValue());

            switch ((String) navsel.getValue()) {
            case "Whole DB":
                datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples"));
                break;
            case "Projects Only":
                datahandler.setShowOptions(Arrays.asList("Projects"));
                break;
            case "Experiments Only":
                datahandler.setShowOptions(Arrays.asList("Experiments"));
                break;
            case "Samples Only":
                datahandler.setShowOptions(Arrays.asList("Samples"));
                break;
            default:
                datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples"));
                break;
            }

        }
    });

    searchbar.addComponent(buttonLayout);
    searchbar.setComponentAlignment(buttonLayout, Alignment.MIDDLE_RIGHT);
    Button searchOk = new Button("");
    searchOk.setStyleName(ValoTheme.BUTTON_TINY);
    // searchOk.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    searchOk.setIcon(FontAwesome.SEARCH);
    searchOk.setSizeUndefined();
    // searchOk.setWidth(15.0f, Unit.EM);
    searchOk.setResponsive(true);
    searchOk.setHeight("20px");

    searchOk.addClickListener(new ClickListener() {
        private static final long serialVersionUID = -2409450448301908214L;

        @Override
        public void buttonClick(ClickEvent event) {
            String queryString = (String) searchfield.getValue().toString();

            LOGGER.debug("the query was " + queryString);

            if (searchfield.getValue() == null || searchfield.getValue().toString().equals("")
                    || searchfield.getValue().toString().trim().length() == 0) {
                Notification.show("Query field was empty!", Type.WARNING_MESSAGE);
            } else {

                try {
                    /**
                     * Sample foundSample = datahandler.getOpenBisClient() .getSampleByIdentifier(
                     * matcher.group(0).toString());
                     */

                    datahandler.setSampleResults(querySamples(queryString));
                    datahandler.setExpResults(queryExperiments(queryString));
                    datahandler.setProjResults(queryProjects(queryString));
                    datahandler.setLastQueryString(queryString);

                    State state = (State) UI.getCurrent().getSession().getAttribute("state");
                    ArrayList<String> message = new ArrayList<String>();
                    message.add("clicked");
                    message.add("view" + queryString);
                    message.add("searchresults");
                    state.notifyObservers(message);

                } catch (Exception e) {
                    LOGGER.error("after query: ", e);
                    Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE);
                }
            }

        }

    });

    // setClickShortcut() would add global shortcut, instead we
    // 'scope' the shortcut to the panel:
    mainlayout.addAction(new com.vaadin.ui.Button.ClickShortcut(searchOk, KeyCode.ENTER));
    // searchfield.addItems(this.getSearchResults("Q"));
    searchfield.setDescription(infotext);
    searchfield.addValidator(new NullValidator("Field must not be empty", false));
    searchfield.setValidationVisible(false);

    buttonLayout.addComponent(navsel);
    // buttonLayout.addComponent(new Label(""));
    buttonLayout.addComponent(searchOk);

    // searchFieldLayout.setComponentAlignment(searchOk, Alignment.TOP_RIGHT);
    // buttonLayout.setExpandRatio(searchOk, 1);
    // buttonLayout.setExpandRatio(navsel, 1);

    // searchFieldLayout.setSpacing(true);
    buttonLayout.setComponentAlignment(searchOk, Alignment.BOTTOM_RIGHT);
    // buttonLayout.setComponentAlignment(navsel, Alignment.BOTTOM_LEFT);

    buttonLayout.setExpandRatio(searchOk, 1);
    buttonLayout.setExpandRatio(navsel, 2);

    // searchbar.setMargin(new MarginInfo(true, false, true, false));
    mainlayout.setContent(searchbar);
    // mainlayout.setComponentAlignment(searchbar, Alignment.MIDDLE_RIGHT);
    // mainlayout.setWidth(100, Unit.PERCENTAGE);
    setCompositionRoot(mainlayout);
}

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

License:Apache License

/**
 * Initialise la vue/*from ww w .  j  av  a2 s  .  com*/
 */
@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();//from   w ww . j ava 2 s  .  c o m
        listeEtapes = null;
        listeGroupes = null;

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

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

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

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

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

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

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

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

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

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

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

            }

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

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

                        listeEtapes.setValue(TOUTES_LES_ETAPES_LABEL);
                    }

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

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

                        }
                    });
                    formInscritLayout.addComponent(listeEtapes);

                }

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

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

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

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

                        }
                    });

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

                    formInscritLayout.addComponent(gpLayout);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    @Override
                    public InputStream getStream() {

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

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

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

                resumeLayout.addComponent(leftResumeLayout);

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

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

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

                resumeLayout.addComponent(middleResumeLayout);

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

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

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

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

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

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

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

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

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

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

                resumeLayout.addComponent(buttonResumeLayout);

                infoLayout.addComponent(resumeLayout);

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

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

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

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

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

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

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

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

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

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

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

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

                //Cration du trombinoscope
                displayTrombinoscope();

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

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

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

        }
    }
}

From source file:kn.uni.gis.ui.AdminWindow.java

License:Apache License

private Component loginComponent() {
    final VerticalLayout layout = new VerticalLayout();

    final PasswordField passwordField = new PasswordField("Old Hunters Age");
    passwordField.setWidth("-1px");
    passwordField.setHeight("-1px");
    passwordField.focus();//from  w w w .  jav  a 2s.co  m

    Button button_2 = new Button();
    button_2.setCaption("Login");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (password.equals(passwordField.getValue())) {
                AdminWindow.this.removeComponent(layout);
                AdminWindow.this.addComponent(createTable());
            } else {
                AdminWindow.this.showNotification("Wrong age!");
            }
        }
    });

    layout.addComponent(passwordField);
    layout.addComponent(button_2);

    layout.setComponentAlignment(passwordField, Alignment.TOP_CENTER);
    layout.setComponentAlignment(button_2, Alignment.BOTTOM_CENTER);

    return layout;
}

From source file:kn.uni.gis.ui.GameApplication.java

License:Apache License

private Window createGameWindow() {

    tabsheet = new TabSheet();
    tabsheet.setImmediate(true);//  w w w.  jav a2  s  .co  m
    tabsheet.setCloseHandler(new CloseHandler() {
        @Override
        public void onTabClose(TabSheet tabsheet, Component tabContent) {

            Game game = ((GameComposite) tabContent).getGame();

            GameComposite remove = gameMap.remove(game);

            // closes the game and the running thread!
            remove.getLayer().handleApplicationClosedEvent(new ApplicationClosedEvent());

            eventBus.unregister(remove);
            eventBus.unregister(remove.getLayer());

            map.removeLayer(remove.getLayer());

            tabsheet.removeComponent(tabContent);

            if (gameMap.isEmpty()) {
                pi.setVisible(false);
            }
        }
    });

    final Window mywindow = new Window("Games");
    mywindow.setPositionX(0);
    mywindow.setPositionY(0);
    mywindow.setHeight("50%");
    mywindow.setWidth("25%");
    VerticalLayout layout = new VerticalLayout();
    HorizontalLayout lay = new HorizontalLayout();

    final Button button_1 = new Button();
    button_1.setCaption("Open Game");
    button_1.setWidth("-1px");
    button_1.setHeight("-1px");

    button_1.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            final String id = textField_1.getValue().toString();

            if (id.length() < 5) {
                window.showNotification("id must have at least 5 characters", Notification.TYPE_ERROR_MESSAGE);
            } else {
                String sql = String.format("select player_id,player_name,min(timestamp),max(timestamp) from %s"
                        + " where id LIKE ? group by player_id, player_name", GisResource.FOX_HUNTER);

                final Game game = new Game(id);
                final PreparedStatement statement = geoUtil.getConn()
                        .prepareStatement("select poly_geom,timestamp from " + GisResource.FOX_HUNTER
                                + " where id LIKE ? and player_id=? and timestamp > ? order by timestamp LIMIT "
                                + MAX_STATES_IN_MEM);

                try {
                    geoUtil.getConn().executeSafeQuery(sql, new DoWithin() {

                        @Override
                        public void doIt(ResultSet executeQuery) throws SQLException {

                            while (executeQuery.next()) {
                                if (statement == null) {

                                }
                                String playerId = executeQuery.getString(1);
                                Timestamp min = executeQuery.getTimestamp(3);
                                Timestamp max = executeQuery.getTimestamp(4);
                                game.addPlayer(playerId, executeQuery.getString(2), min, max,
                                        new TimingIterator(geoUtil, id, playerId, min.getTime(), statement));
                            }
                        }
                    }, id + "%");
                } catch (SQLException e) {
                    LOGGER.info("error on sql!", e);

                }

                game.finish(statement);

                if (!!!gameMap.containsKey(game)) {
                    if (game.getStates().size() == 0) {
                        window.showNotification("game not found!");
                    } else {
                        LOGGER.info("received game info: {},{} ", game.getId(), game.getStates().size());

                        GameVectorLayer gameVectorLayer = new GameVectorLayer(GameApplication.this, eventBus,
                                game, createColorMap(game));

                        final GameComposite gameComposite = new GameComposite(GameApplication.this, game,
                                gameVectorLayer, eventBus);

                        eventBus.register(gameComposite);
                        eventBus.register(gameVectorLayer);

                        map.addLayer(gameVectorLayer);
                        gameMap.put(game, gameComposite);

                        // Add the component to the tab sheet as a new tab.
                        Tab addTab = tabsheet.addTab(gameComposite);
                        addTab.setCaption(game.getId().substring(0, 5));
                        addTab.setClosable(true);

                        pi.setVisible(true);
                        // pl.get
                        PlayerState playerState = game.getStates().get(game.getFox()).peek();
                        map.zoomToExtent(new Bounds(CPOINT_TO_POINT.apply(playerState.getPoint())));
                    }
                }
            }
        }

        private Map<Player, Integer> createColorMap(Game game) {
            Function<Double, Double> scale = HardTasks.scale(0, game.getStates().size());

            ImmutableMap.Builder<Player, Integer> builder = ImmutableMap.builder();

            int i = 0;

            for (Player play : game.getStates().keySet()) {
                builder.put(play, getColor(scale.apply((double) i++)));
            }

            return builder.build();
        }

        private Integer getColor(double dob) {

            int toReturn = 0;
            toReturn = toReturn | 255 - (int) Math.round(255 * dob);
            toReturn = toReturn | (int) ((Math.round(255 * dob)) << 16);
            return toReturn;
            // return (int) (10000 + 35000 * dob + 5000 * dob + 1000 * dob +
            // 5 * dob);
        }

    });

    Button button_2 = new Button();
    button_2.setCaption("All seeing Hunter");
    button_2.setImmediate(false);
    button_2.setWidth("-1px");
    button_2.setHeight("-1px");
    button_2.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (adminWindow == null) {
                adminWindow = new AdminWindow(password, geoUtil, new ItemClickListener() {
                    @Override
                    public void itemClick(ItemClickEvent event) {

                        textField_1.setValue(event.getItemId().toString());
                        mywindow.bringToFront();
                        button_1.focus();
                    }
                });
                window.addWindow(adminWindow);
                adminWindow.setWidth("30%");
                adminWindow.setHeight("40%");
                adminWindow.addListener(new CloseListener() {
                    @Override
                    public void windowClose(CloseEvent e) {
                        adminWindow = null;
                    }
                });
            }
        }
    });

    lay.addComponent(button_1);
    textField_1 = new TextField();
    textField_1.setImmediate(false);
    textField_1.setWidth("-1px");
    textField_1.setHeight("-1px");
    lay.addComponent(textField_1);
    lay.addComponent(button_2);
    lay.addComponent(pi);

    lay.setComponentAlignment(pi, Alignment.TOP_RIGHT);

    layout.addComponent(lay);
    layout.addComponent(tabsheet);

    mywindow.addComponent(layout);
    mywindow.setClosable(false);

    /* Add the window inside the main window. */
    return mywindow;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Button createImageFixedHeight() {
    final Button button = new Button("zen");
    button.setWidth("100%");
    button.setHeight("50px");
    return button;
}

From source file:nl.amc.biolab.nsg.display.component.ProcessingForm.java

License:Open Source License

public void setButtons() {
    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setHeight("40px");
    buttons.setSpacing(true);/*from   w w w .  ja v  a 2 s  .c om*/
    getLayout().addComponent(buttons);

    final Button startButton = new NativeButton();

    startButton.setCaption(SUBMIT);
    startButton.setImmediate(true);
    startButton.setWidth("-1px");
    startButton.setHeight("-1px");
    startButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1906358615316029946L;

        public void buttonClick(ClickEvent event) {
            System.out.println(app.getValue());

            Set<Long> inputDbIds = new HashSet<Long>();

            for (Object iid : inputData.getItemIds()) {
                inputData.select(iid);

                inputDbIds.add(((DataElement) iid).getDbId());
            }

            ((VaadinTestApplication) getApplication()).getUserDataService().setDataElementDbIds(inputDbIds);

            form.commit();

            processing.setApplication((Application) app.getValue());

            startButton.setData(processing);

            form.fireEvent(new Event(startButton));
        }
    });

    buttons.addComponent(startButton);
    buttons.setComponentAlignment(startButton, Alignment.TOP_RIGHT);

    final Button delButton = new NativeButton();
    delButton.setCaption("remove inputs");
    delButton.setImmediate(true);
    delButton.setWidth("-1px");
    delButton.setHeight("-1px");
    delButton.addListener(new Button.ClickListener() {
        private static final long serialVersionUID = -3377452914254101817L;

        @SuppressWarnings("unchecked")
        public void buttonClick(ClickEvent event) {
            if (inputData.getValue() != null) {
                for (DataElement de : (Set<DataElement>) inputData.getValue()) {
                    inputData.removeItem(de);
                    dataElements.remove(de);
                }
            }
        }
    });
    buttons.addComponent(delButton);
    buttons.setComponentAlignment(delButton, Alignment.TOP_RIGHT);
}