Example usage for com.vaadin.ui HorizontalLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

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

License:Apache License

/**
 * Initialise la vue/*from  ww  w  .j av a 2s .  com*/
 */
@PostConstruct
public void init() {

    //On vrifie le droit d'accder  la vue
    if (userController.isEnseignant()) {
        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

        if (listeBoutonFavoris != null) {
            listeBoutonFavoris.clear();
        } else {
            listeBoutonFavoris = new LinkedList<ReferencedButton>();
        }

        liste_types_favoris = new LinkedList<String>();
        liste_types_favoris.add(Utils.CMP);
        liste_types_favoris.add(Utils.ELP);
        liste_types_favoris.add(Utils.VET);

        liste_types_inscrits = new LinkedList<String>();
        liste_types_inscrits.add(Utils.ELP);
        liste_types_inscrits.add(Utils.VET);

        liste_types_deplier = new LinkedList<String>();
        liste_types_deplier.add(Utils.ELP);
        liste_types_deplier.add(Utils.VET);

        recuperationDesfavoris();

        HorizontalLayout btnLayout = new HorizontalLayout();
        btnLayout.setMargin(false);
        btnLayout.setSpacing(false);
        btnLayout.setWidth("100%");

        comboBoxAnneeUniv = new ComboBox(applicationContext.getMessage(NAME + ".anneeuniv", null, getLocale()));
        comboBoxAnneeUniv.setPageLength(5);
        comboBoxAnneeUniv.setTextInputAllowed(false);
        comboBoxAnneeUniv.setNullSelectionAllowed(false);
        //Initialisation de la liste des annes
        List<String> lanneeUniv = rechercheArborescenteController.recupererLesDernieresAnneeUniversitaire();
        if (lanneeUniv != null && lanneeUniv.size() > 0) {
            for (String anneeUniv : lanneeUniv) {
                comboBoxAnneeUniv.addItem(anneeUniv);
                int anneenplusun = Integer.parseInt(anneeUniv) + 1;
                comboBoxAnneeUniv.setItemCaption(anneeUniv, anneeUniv + "/" + anneenplusun);
            }
            if (annee == null) {
                annee = etudiantController.getAnneeUnivEnCours(MainUI.getCurrent());
                //annee = lanneeUniv.get(0);
            }
        }
        comboBoxAnneeUniv.setValue(annee);
        comboBoxAnneeUniv.setStyleName(ValoTheme.COMBOBOX_SMALL);
        comboBoxAnneeUniv.addValueChangeListener(e -> changerAnnee((String) comboBoxAnneeUniv.getValue()));

        reinitButton = new Button();
        reinitButton.setDescription(
                applicationContext.getMessage(NAME + ".reinitbutton.description", null, getLocale()));
        reinitButton.addClickListener(e -> {
            initFromScratch();
        });
        reinitButton.setStyleName(ValoTheme.BUTTON_DANGER);
        reinitButton.setIcon(FontAwesome.TIMES);
        if (!StringUtils.hasText(code)) {
            reinitButton.setVisible(false);
        }
        labelLigneSelectionneeLabel = new Label();
        labelLigneSelectionneeLabel
                .setValue(applicationContext.getMessage(NAME + ".ligneselectionnee", null, getLocale()));
        labelLigneSelectionneeLabel.addStyleName("label-align-right");
        labelLigneSelectionneeLabel.setVisible(false);

        HorizontalLayout btnLeftLayout = new HorizontalLayout();
        btnLeftLayout.setWidth("100%");
        btnLeftLayout.setMargin(true);
        btnLeftLayout.addComponent(comboBoxAnneeUniv);
        btnLeftLayout.setComponentAlignment(comboBoxAnneeUniv, Alignment.MIDDLE_LEFT);
        /*btnLeftLayout.addComponent(reinitButton);
        btnLeftLayout.setComponentAlignment(reinitButton, Alignment.BOTTOM_RIGHT);*/
        btnLeftLayout.addComponent(labelLigneSelectionneeLabel);
        btnLeftLayout.setComponentAlignment(labelLigneSelectionneeLabel, Alignment.MIDDLE_CENTER);
        btnLayout.addComponent(btnLeftLayout);

        ligneSelectionneeLabel = new Label();
        //ligneSelectionneeLabel.setCaption(applicationContext.getMessage(NAME+".ligneselectionnee", null, getLocale()));
        ligneSelectionneeLabel.setVisible(false);
        elpLayout = new FormLayout();
        elpLayout.setMargin(false);
        vetElpSelectionneLabel = new Label();
        vetElpSelectionneLabel.setVisible(false);
        elpLayout.addComponent(vetElpSelectionneLabel);
        elpLayout.setVisible(false);
        VerticalLayout ligneLayout = new VerticalLayout();
        ligneLayout.addComponent(ligneSelectionneeLabel);
        ligneLayout.addComponent(elpLayout);

        HorizontalLayout rightLayout = new HorizontalLayout();
        rightLayout.setSizeFull();
        rightLayout.setSpacing(true);
        rightLayout.setMargin(true);
        rightLayout.addComponent(ligneLayout);
        rightLayout.setComponentAlignment(ligneLayout, Alignment.MIDDLE_LEFT);
        rightLayout.addComponent(reinitButton);
        rightLayout.setComponentAlignment(reinitButton, Alignment.MIDDLE_RIGHT);
        rightLayout.setExpandRatio(ligneLayout, 1);
        btnLayout.addComponent(rightLayout);
        btnLayout.setComponentAlignment(rightLayout, Alignment.MIDDLE_LEFT);

        addComponent(btnLayout);

        if (code != null && type != null) {
            Label elementRecherche = new Label(code + " " + type);
            elementRecherche.addStyleName(ValoTheme.LABEL_H1);
            //addComponent(elementRecherche);

        }

        table = new TreeTable();
        table.setSizeFull();
        table.setStyleName("scrollabletable");
        table.setSelectable(true);

        initComposantes();

        //gestion du style pour les lignes en favori
        table.setCellStyleGenerator(new CellStyleGenerator() {
            @Override
            public String getStyle(final Table source, final Object itemId, final Object propertyId) {
                String style = null;
                if (propertyId == null && markedRows.contains(itemId)) {
                    style = "marked";
                }
                return style;
            }
        });

        table.addItemClickListener(new ItemClickListener() {

            @Override
            public void itemClick(ItemClickEvent event) {
                selectionnerLigne(event.getItemId());
            }

        });

        //gestion du clic sur la fleche pour dplier une entre
        table.addExpandListener(new ExpandListener() {
            private static final long serialVersionUID = 8532342540008245348L;

            @Override
            public void nodeExpand(ExpandEvent event) {
                if (event != null && event.getItemId() != null && hc != null
                        && hc.getItem(event.getItemId()) != null
                        && hc.getItem(event.getItemId()).getItemProperty(TYPE_PROPERTY) != null) {
                    selectionnerLigne(event.getItemId());
                    deplierNoeud((String) event.getItemId(), true);
                }
            }
        });

        VerticalLayout tableVerticalLayout = new VerticalLayout();
        tableVerticalLayout.setMargin(new MarginInfo(false, true, true, true));
        tableVerticalLayout.setSizeFull();
        tableVerticalLayout.addComponent(table);
        tableVerticalLayout.setExpandRatio(table, 1);
        addComponent(tableVerticalLayout);
        setExpandRatio(tableVerticalLayout, 1);

    }
}

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

License:Apache License

/**
 * Initialise la vue//from   w  w w.ja  v a  2s  . co m
 */
@PostConstruct
public void init() {

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

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

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

        //Bouton retour
        returnButton = new Button();
        returnButton.setIcon(FontAwesome.ARROW_LEFT);
        returnButton.setStyleName("v-nav-button");
        returnButton.addClickListener(e -> {
            MdwTouchkitUI.getCurrent().backFromSearch();
        });
        navbar.addComponent(returnButton);
        navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);

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

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

        //BOUTON DE RECHERCHE
        btnRecherche = new Button();
        btnRecherche.setIcon(FontAwesome.SEARCH);
        btnRecherche.setStyleName(ValoTheme.BUTTON_PRIMARY);
        btnRecherche.addStyleName("v-popover-button");
        btnRecherche.addStyleName("v-button-without-padding");
        btnRecherche.setEnabled(true);
        btnRecherche.addClickListener(e -> search(false));

        //CHAMP DE RECHERCHE
        champRechercheLayout = new HorizontalLayout();
        champRechercheLayout.setWidth("100%");
        mainVerticalLayout = new VerticalLayout();
        mainVerticalLayout.setImmediate(true);
        mainVerticalLayout.setSizeFull();

        //Init connexion  ES, pour gain perf au premiere lettre tapes
        if (ElasticSearchService.initConnexion(true)) {

            //Cration du champ autoComplete
            champRecherche = new AutoComplete();
            champRecherche.setWidth(100, Unit.PERCENTAGE);
            champRecherche.setEnabled(true);
            champRecherche.setImmediate(true);
            champRecherche.focus();
            champRecherche.setTextChangeEventMode(TextChangeEventMode.EAGER);
            champRecherche.addTextChangeListener(new TextChangeListener() {
                @Override
                public void textChange(TextChangeEvent event) {
                    /*if(event.getText()!=null){
                    resetButton.setIcon(FontAwesome.TIMES);
                    }*/

                    champRecherche.showChoices(quickSearch(event.getText()), mainVerticalLayout, btnRecherche,
                            true);

                }
            });
            champRecherche.setImmediate(true);
            champRecherche.addShortcutListener(
                    new ShortcutListener("Enter Shortcut", ShortcutAction.KeyCode.ENTER, null) {
                        @Override
                        public void handleAction(Object sender, Object target) {
                            if (target == champRecherche) {
                                //Si on tait sur une ligne propose sous le champ de recherche
                                if (champRecherche.getSelectedItem() > 0) {
                                    //On remplie d'abord le champ avec la ligne slectionne
                                    champRecherche.setValue(champRecherche.getChoices()
                                            .getItem(champRecherche.getSelectedItem()).getItemProperty("lib")
                                            .getValue().toString());
                                }
                                search(false);
                            }
                        }
                    });

            champRecherche.addShortcutListener(
                    new ShortcutListener("Bottom Arrow", ShortcutAction.KeyCode.ARROW_DOWN, null) {
                        @Override
                        public void handleAction(Object sender, Object target) {
                            if (target == champRecherche) {
                                if (champRecherche.getChoices().getItemIds() != null) {
                                    champRecherche.getChoicesPopup().setVisible(true);
                                    champRecherche.getChoices().setValue(champRecherche.getNextItem());

                                }
                            }
                        }
                    });

            champRecherche.addShortcutListener(
                    new ShortcutListener("Top Arrow", ShortcutAction.KeyCode.ARROW_UP, null) {
                        @Override
                        public void handleAction(Object sender, Object target) {
                            if (target == champRecherche) {
                                if (champRecherche.getChoices().getItemIds() != null) {
                                    champRecherche.getChoicesPopup().setVisible(true);
                                    Integer champSelectionne = champRecherche.getPreviousItem();
                                    if (champSelectionne > 0) {
                                        champRecherche.getChoices().setValue(champSelectionne);
                                    } else {
                                        champRecherche.getChoices().setValue(null);
                                    }

                                }
                            }
                        }
                    });

            champRechercheLayout.addComponent(champRecherche);
            champRechercheLayout.setComponentAlignment(champRecherche, Alignment.MIDDLE_LEFT);

            //BOUTON RESET
            champRecherche.addStyleName("textfield-resetable");
            resetButton = new Button();
            resetButton.setIcon(FontAwesome.TIMES);
            resetButton.setStyleName(ValoTheme.BUTTON_BORDERLESS);
            resetButton.addStyleName("v-popover-button");
            resetButton.addStyleName("v-button-without-padding");
            resetButton.addStyleName("btn-reset");
            resetButton.addClickListener(e -> {
                champRecherche.setValue("");
                //search1.setValue("");
                resetButton.setIcon(FontAwesome.TIMES);
                champRecherche.focus();
            });
            champRechercheLayout.addComponent(resetButton);
            champRechercheLayout.setComponentAlignment(resetButton, Alignment.MIDDLE_LEFT);

            //Ajout du bouton de recherche au layout
            champRechercheLayout.addComponent(btnRecherche);
            mainVerticalLayout.addComponent(champRechercheLayout);
            mainVerticalLayout.setComponentAlignment(champRechercheLayout, Alignment.MIDDLE_LEFT);
            champRechercheLayout.setMargin(true);
            champRechercheLayout.setExpandRatio(champRecherche, 1);

            HorizontalLayout checkBoxVetLayout = new HorizontalLayout();
            Label etapeLabel = new Label(
                    applicationContext.getMessage(NAME + ".etapes.checkbox", null, getLocale()));
            etapeLabel.setStyleName(ValoTheme.LABEL_SMALL);
            checkBoxVetLayout.addComponent(etapeLabel);

            HorizontalLayout checkBoxElpLayout = new HorizontalLayout();
            Label elpLabel = new Label(
                    applicationContext.getMessage(NAME + ".elps.checkbox", null, getLocale()));
            elpLabel.setStyleName(ValoTheme.LABEL_SMALL);
            checkBoxElpLayout.addComponent(elpLabel);

            HorizontalLayout checkBoxEtuLayout = new HorizontalLayout();
            Label etuLabel = new Label(
                    applicationContext.getMessage(NAME + ".etudiants.checkbox", null, getLocale()));
            etuLabel.setStyleName(ValoTheme.LABEL_SMALL);
            checkBoxEtuLayout.addComponent(etuLabel);

            checkBoxVetLayout.setSizeFull();
            checkBoxElpLayout.setSizeFull();
            checkBoxEtuLayout.setSizeFull();

            if (casesAcocherVet) {
                checkBoxVetLayout.setStyleName("layout-checkbox-checked");
                etapeLabel.setStyleName(ValoTheme.LABEL_SMALL);
            } else {
                checkBoxVetLayout.setStyleName("layout-checkbox-unchecked");
                etapeLabel.addStyleName("label-line-through");
            }

            if (casesAcocherElp) {
                checkBoxElpLayout.setStyleName("layout-checkbox-checked");
                elpLabel.setStyleName(ValoTheme.LABEL_SMALL);
            } else {
                checkBoxElpLayout.setStyleName("layout-checkbox-unchecked");
                elpLabel.addStyleName("label-line-through");
            }

            if (casesAcocherEtudiant) {
                checkBoxEtuLayout.setStyleName("layout-checkbox-checked");
                etuLabel.setStyleName(ValoTheme.LABEL_SMALL);
            } else {
                checkBoxEtuLayout.setStyleName("layout-checkbox-unchecked");
                etuLabel.addStyleName("label-line-through");
            }

            checkBoxVetLayout.addListener(new LayoutClickListener() {
                public void layoutClick(LayoutClickEvent event) {
                    if (casesAcocherVet) {
                        casesAcocherVet = false;
                        checkBoxVetLayout.setStyleName("layout-checkbox-unchecked");
                        etapeLabel.addStyleName("label-line-through");
                    } else {
                        casesAcocherVet = true;
                        checkBoxVetLayout.setStyleName("layout-checkbox-checked");
                        etapeLabel.setStyleName(ValoTheme.LABEL_SMALL);
                    }
                    tuneSearch();
                }
            });

            checkBoxElpLayout.addListener(new LayoutClickListener() {
                public void layoutClick(LayoutClickEvent event) {
                    if (casesAcocherElp) {
                        casesAcocherElp = false;
                        checkBoxElpLayout.setStyleName("layout-checkbox-unchecked");
                        elpLabel.addStyleName("label-line-through");
                    } else {
                        casesAcocherElp = true;
                        checkBoxElpLayout.setStyleName("layout-checkbox-checked");
                        elpLabel.setStyleName(ValoTheme.LABEL_SMALL);
                    }
                    tuneSearch();
                }
            });

            checkBoxEtuLayout.addListener(new LayoutClickListener() {
                public void layoutClick(LayoutClickEvent event) {
                    if (casesAcocherEtudiant) {
                        casesAcocherEtudiant = false;
                        checkBoxEtuLayout.setStyleName("layout-checkbox-unchecked");
                        etuLabel.addStyleName("label-line-through");
                    } else {
                        casesAcocherEtudiant = true;
                        checkBoxEtuLayout.setStyleName("layout-checkbox-checked");
                        etuLabel.setStyleName(ValoTheme.LABEL_SMALL);
                    }
                    tuneSearch();
                }
            });

            HorizontalLayout checkBoxLayout = new HorizontalLayout();
            checkBoxLayout.setWidth("100%");
            checkBoxLayout.setHeight("50px");
            checkBoxLayout.setMargin(true);
            checkBoxLayout.setSpacing(true);
            checkBoxLayout.addComponent(checkBoxVetLayout);
            checkBoxLayout.addComponent(checkBoxElpLayout);
            checkBoxLayout.addComponent(checkBoxEtuLayout);

            mainVerticalLayout.addComponent(checkBoxLayout);

            //TABLE DE RESULTATS
            rrContainer = new HierarchicalContainer();
            rrContainer.addContainerProperty("lib", String.class, "");
            rrContainer.addContainerProperty("code", String.class, "");
            rrContainer.addContainerProperty("type", String.class, "");
            tableResultats = new TreeTable();
            tableResultats.setWidth("100%");
            tableResultats.setSelectable(false);
            tableResultats.setMultiSelect(false);
            tableResultats.setImmediate(true);
            columnHeaders = new String[FIELDS_ORDER.length];
            for (int fieldIndex = 0; fieldIndex < FIELDS_ORDER.length; fieldIndex++) {
                columnHeaders[fieldIndex] = applicationContext
                        .getMessage("result.table." + FIELDS_ORDER[fieldIndex], null, Locale.getDefault());
            }

            tableResultats.addGeneratedColumn("type", new DisplayTypeColumnGenerator());
            tableResultats.addGeneratedColumn("lib", new DisplayNameColumnGenerator());
            tableResultats.setContainerDataSource(rrContainer);
            tableResultats.setVisibleColumns(FIELDS_ORDER);
            tableResultats.setStyleName("nohscrollabletable");
            tableResultats.setColumnHeaders(columnHeaders);
            tableResultats.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
            tableResultats.setColumnWidth("type", 100);

            /*mainVerticalLayout.addComponent(searchBoxFilter);
            mainVerticalLayout.setComponentAlignment(searchBoxFilter, Alignment.MIDDLE_RIGHT);*/
            VerticalLayout tableVerticalLayout = new VerticalLayout();
            tableVerticalLayout.setMargin(true);
            tableVerticalLayout.setSizeFull();
            tableVerticalLayout.addComponent(tableResultats);
            mainVerticalLayout.addComponent(tableVerticalLayout);
            mainVerticalLayout.setExpandRatio(tableVerticalLayout, 1);
            tableResultats.setVisible(false);

            addComponent(mainVerticalLayout);
            setExpandRatio(mainVerticalLayout, 1);
        } else {
            //Message fonctionnalit indisponible
            addComponent(
                    new Label(applicationContext.getMessage(NAME + ".indisponible.message", null, getLocale()),
                            ContentMode.HTML));
        }
    }
}

From source file:fr.univlorraine.mondossierweb.views.windows.DetailGroupesWindow.java

License:Apache License

private void init() {

    /* Style *///w  ww  .  j a v a2 s .  c  om
    setWidth(80, Unit.PERCENTAGE);
    setHeight(95, Unit.PERCENTAGE);
    setModal(true);
    setResizable(false);

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setMargin(true);
    layout.setSpacing(true);

    /* Titre */
    setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

    //Sous titre avec l'anne 
    HorizontalLayout titleLayout = new HorizontalLayout();
    titleLayout.setSizeFull();
    titleLayout.setHeight("20px");
    Label labelAnneeUniv = new Label();
    labelAnneeUniv.setValue(applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>"
            + annee + "</b>");
    labelAnneeUniv.setContentMode(ContentMode.HTML);
    titleLayout.addComponent(labelAnneeUniv);
    titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_LEFT);

    if (StringUtils.hasText(vetLibelle)) {
        Label labelEtape = new Label();
        labelEtape.setValue(applicationContext.getMessage(NAME + ".label.vet", null, getLocale()) + " : <b>"
                + vetLibelle + "</b>");
        labelEtape.setContentMode(ContentMode.HTML);
        titleLayout.addComponent(labelEtape);
        titleLayout.setComponentAlignment(labelEtape, Alignment.MIDDLE_RIGHT);
    }

    layout.addComponent(titleLayout);

    Panel panelDetailGroupes = new Panel(elpLibelle);
    panelDetailGroupes.setSizeFull();

    if (lgroupes != null && lgroupes.size() > 0) {
        TreeTable detailGroupesTable = new TreeTable();
        detailGroupesTable.setSizeFull();
        HierarchicalContainer hc = new HierarchicalContainer();
        hc.addContainerProperty(ID_PROPERTY, String.class, "");
        hc.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, "");
        hc.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, "");
        hc.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, "");
        hc.addContainerProperty(CAP_MAX_PROPERTY, String.class, "");
        hc.addContainerProperty(CAP_INT_PROPERTY, String.class, "");
        hc.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, "");
        detailGroupesTable.setContainerDataSource(hc);
        int id = 0;
        for (ElpDeCollection edc : lgroupes) {
            id++;
            for (CollectionDeGroupes cdg : edc.getListeCollection()) {
                id++;
                ObjetBaseCollectionGroupe obj = new ObjetBaseCollectionGroupe();
                obj.setId("" + id);
                obj.setCod_coll(cdg.getCodCollection());
                obj.setCap_max("");
                obj.setCap_int("");
                obj.setNb_inscrits("");
                Item itemCollection = hc.addItem(obj.getId());
                renseignerItem(itemCollection, obj);

                for (Groupe gpe : cdg.getListeGroupes()) {
                    id++;
                    ObjetBaseCollectionGroupe objgpe = new ObjetBaseCollectionGroupe();
                    objgpe.setId("" + id);
                    objgpe.setCod_gpe(gpe.getCodGroupe());
                    objgpe.setLib_gpe(gpe.getLibGroupe());
                    objgpe.setCap_max("" + gpe.getCapMaxGpe());
                    objgpe.setCap_int("" + gpe.getCapIntGpe());
                    objgpe.setNb_inscrits("" + gpe.getNbInscrits());
                    Item i = hc.addItem(objgpe.getId());
                    renseignerItem(i, objgpe);
                    detailGroupesTable.setParent(objgpe.getId(), obj.getId());
                    detailGroupesTable.setChildrenAllowed(objgpe.getId(), false);
                }

                detailGroupesTable.setCollapsed(obj.getId(), false);

            }
        }

        detailGroupesTable.addContainerProperty(ID_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CODE_COLLECTION_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CODE_GROUPE_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(LIBELLE_GROUPE_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CAP_MAX_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(CAP_INT_PROPERTY, String.class, "");
        detailGroupesTable.addContainerProperty(NB_INSCRITS_PROPERTY, String.class, "");

        detailGroupesTable.setVisibleColumns(DETAIL_FIELDS_ORDER);

        detailGroupesTable.setColumnHeader(CODE_COLLECTION_PROPERTY,
                applicationContext.getMessage(NAME + ".table.codecollection", null, getLocale()));
        detailGroupesTable.setColumnHeader(CODE_GROUPE_PROPERTY,
                applicationContext.getMessage(NAME + ".table.codegroupe", null, getLocale()));
        detailGroupesTable.setColumnHeader(LIBELLE_GROUPE_PROPERTY,
                applicationContext.getMessage(NAME + ".table.libgroupe", null, getLocale()));
        detailGroupesTable.setColumnHeader(CAP_MAX_PROPERTY,
                applicationContext.getMessage(NAME + ".table.capmax", null, getLocale()));
        detailGroupesTable.setColumnHeader(CAP_INT_PROPERTY,
                applicationContext.getMessage(NAME + ".table.capint", null, getLocale()));
        detailGroupesTable.setColumnHeader(NB_INSCRITS_PROPERTY,
                applicationContext.getMessage(NAME + ".table.nbinscrits", null, getLocale()));

        detailGroupesTable.setColumnCollapsingAllowed(true);
        detailGroupesTable.setColumnReorderingAllowed(false);
        detailGroupesTable.setSelectable(false);
        detailGroupesTable.setImmediate(true);
        detailGroupesTable.addStyleName("scrollabletable");

        panelDetailGroupes.setContent(detailGroupesTable);

    }

    layout.addComponent(panelDetailGroupes);

    Panel panelCollectionInfo = new Panel(
            applicationContext.getMessage(NAME + ".info.title", null, getLocale()));
    panelCollectionInfo.setIcon(FontAwesome.INFO_CIRCLE);

    panelCollectionInfo.addStyleName("significationpanel");

    VerticalLayout significationLayout = new VerticalLayout();
    significationLayout.setMargin(true);
    significationLayout.setSpacing(true);

    Label mapSignificationLabel = new Label(
            applicationContext.getMessage(NAME + ".collection.info", null, getLocale()));
    mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
    mapSignificationLabel.setContentMode(ContentMode.HTML);

    significationLayout.addComponent(mapSignificationLabel);

    panelCollectionInfo.setContent(significationLayout);

    layout.addComponent(panelCollectionInfo);

    layout.setExpandRatio(panelDetailGroupes, 1);

    setContent(layout);

    /* Centre la fentre */
    center();

}

From source file:fr.univlorraine.mondossierweb.views.windows.DetailInscriptionWindow.java

License:Apache License

private void init() {

    //On vrifie le droit d'accder  la vue
    if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null
            && MainUI.getCurrent().getEtudiant() != null) {

        /* Style */
        setWidth(80, Unit.PERCENTAGE);//from   w w  w  . j  ava  2  s.co m
        setHeight(95, Unit.PERCENTAGE);
        setModal(true);
        setResizable(false);

        //Test si user enseignant et en vue Enseignant
        if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
            //On recupere les notes pour un enseignant
            etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape);
        } else {
            //On rcupre les notes pour un tudiant
            etudiantController.renseigneDetailNotesEtResultats(etape);
        }

        /* Layout */
        VerticalLayout layout = new VerticalLayout();
        layout.setSizeFull();
        layout.setMargin(true);
        layout.setSpacing(true);

        /* Titre */
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

        //Sous titre avec l'anne
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setSizeFull();
        titleLayout.setHeight("20px");
        Label labelAnneeUniv = new Label(
                applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " <b>"
                        + etape.getAnnee() + "</b>");
        labelAnneeUniv.setContentMode(ContentMode.HTML);
        titleLayout.addComponent(labelAnneeUniv);
        titleLayout.setComponentAlignment(labelAnneeUniv, Alignment.MIDDLE_CENTER);
        layout.addComponent(titleLayout);

        Panel panelDetailInscription = new Panel(etape.getLibelle());
        panelDetailInscription.setSizeFull();
        panelDetailInscription.addStyleName("small-font-element");

        List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques();
        if (lelp != null && lelp.size() > 0) {
            Table detailInscriptionTable = new Table(null,
                    new BeanItemContainer<>(ElementPedagogique.class, lelp));
            detailInscriptionTable.setSizeFull();
            detailInscriptionTable.setVisibleColumns(new String[0]);
            detailInscriptionTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()),
                    new CodeElpColumnGenerator());
            detailInscriptionTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()),
                    new LibelleElpColumnGenerator());
            if (configController.isAffECTSEtudiant()) {
                detailInscriptionTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()),
                        new ECTSColumnGenerator());
            }
            detailInscriptionTable.setColumnCollapsingAllowed(true);
            detailInscriptionTable.setColumnReorderingAllowed(false);
            detailInscriptionTable.setSelectable(false);
            detailInscriptionTable.setImmediate(true);
            detailInscriptionTable.addStyleName("scrollabletable");
            panelDetailInscription.setContent(detailInscriptionTable);
        } else {
            setHeight(30, Unit.PERCENTAGE);
            HorizontalLayout messageLayout = new HorizontalLayout();
            messageLayout.setSpacing(true);
            messageLayout.setMargin(true);
            Label labelAucuneIp = new Label(
                    applicationContext.getMessage(NAME + ".message.aucuneip", null, getLocale()));
            labelAucuneIp.setStyleName(ValoTheme.LABEL_BOLD);
            messageLayout.addComponent(labelAucuneIp);
            panelDetailInscription.setContent(messageLayout);
        }

        layout.addComponent(panelDetailInscription);

        layout.setExpandRatio(panelDetailInscription, 1);

        setContent(layout);

        /* Centre la fentre */
        center();

    }
}

From source file:fr.univlorraine.mondossierweb.views.windows.DetailNotesWindow.java

License:Apache License

private void init() {

    //On vrifie le droit d'accder  la vue
    if ((userController.isEnseignant() || userController.isEtudiant()) && MainUI.getCurrent() != null
            && MainUI.getCurrent().getEtudiant() != null) {

        /* Style */
        setWidth(80, Unit.PERCENTAGE);//from  ww  w . j  a  va  2  s.  c  o m
        setHeight(95, Unit.PERCENTAGE);
        setModal(true);
        setResizable(false);

        //Test si user enseignant et en vue Enseignant
        if (userController.isEnseignant() && MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
            //On recupere les notes pour un enseignant
            etudiantController.renseigneDetailNotesEtResultatsEnseignant(etape);
        } else {
            //On rcupre les notes pour un tudiant
            etudiantController.renseigneDetailNotesEtResultats(etape);
        }

        /* Layout */
        VerticalLayout layout = new VerticalLayout();
        layout.setSizeFull();
        layout.setMargin(true);
        layout.setSpacing(true);

        /* Titre */
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));

        List<ElementPedagogique> lelp = MainUI.getCurrent().getEtudiant().getElementsPedagogiques();

        //Sous titre avec l'anne
        HorizontalLayout titleLayout = new HorizontalLayout();
        titleLayout.setSizeFull();
        titleLayout.setHeight("20px");
        Label messageLabel = new Label(
                applicationContext.getMessage(NAME + ".label.messageinfo", null, getLocale()));
        messageLabel.setContentMode(ContentMode.HTML);
        messageLabel.setStyleName(ValoTheme.LABEL_SMALL);
        titleLayout.addComponent(messageLabel);
        titleLayout.setExpandRatio(messageLabel, 1);
        titleLayout.setComponentAlignment(messageLabel, Alignment.MIDDLE_LEFT);

        //Test si user enseignant
        if (userController.isEnseignant() && lelp != null && lelp.size() > 0) {
            //Bouton pour afficher les filtres
            btnDisplayFiltres = new Button();
            btnDisplayFiltres.setWidth("52px");
            btnDisplayFiltres.setHeight("32px");
            btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                btnDisplayFiltres.setStyleName(ValoTheme.BUTTON_FRIENDLY);
            }
            btnDisplayFiltres.setIcon(FontAwesome.FILTER);
            btnDisplayFiltres.setDescription(
                    applicationContext.getMessage(NAME + ".btn.displayFilters", null, getLocale()));
            btnDisplayFiltres.addClickListener(e -> {
                btnDisplayFiltres.setVisible(false);
                panelVue.setVisible(true);
            });
            titleLayout.addComponent(btnDisplayFiltres);
            titleLayout.setComponentAlignment(btnDisplayFiltres, Alignment.MIDDLE_RIGHT);
            //titleLayout.setExpandRatio(btnDisplayFiltres, 1);
            btnDisplayFiltres.setVisible(true);
        }

        if (lelp != null && lelp.size() > 0 && configController.isPdfNotesActive()) {
            Button pdfButton = new Button();
            pdfButton.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
            pdfButton.addStyleName("button-icon");
            pdfButton.addStyleName("red-button-icon");
            pdfButton.setIcon(FontAwesome.FILE_PDF_O);
            pdfButton.setDescription(
                    applicationContext.getMessage(NAME + ".btn.pdf.description", null, getLocale()));

            if (PropertyUtils.isPushEnabled()) {
                MyFileDownloader fd = new MyFileDownloader(noteController.exportPdfDetail(etape));
                fd.extend(pdfButton);
            } else {
                FileDownloader fd = new FileDownloader(noteController.exportPdfDetail(etape));
                fd.extend(pdfButton);
            }

            titleLayout.addComponent(pdfButton);
            titleLayout.setComponentAlignment(pdfButton, Alignment.MIDDLE_RIGHT);
        }
        layout.addComponent(titleLayout);

        //Test si user enseignant
        if (userController.isEnseignant() && lelp != null && lelp.size() > 0) {
            panelVue = new Panel();

            HorizontalLayout vueLayout = new HorizontalLayout();
            vueLayout.setMargin(true);
            vueLayout.setSpacing(true);
            vueLayout.setSizeFull();

            Button changerVueButton = new Button(
                    applicationContext.getMessage(NAME + ".button.vueEnseignant", null, getLocale()));
            changerVueButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                changerVueButton.setStyleName(ValoTheme.BUTTON_FRIENDLY);
                changerVueButton.setCaption(
                        applicationContext.getMessage(NAME + ".button.vueEtudiant", null, getLocale()));
            }
            //On change la variable vueEnseignantNotesEtResultats et on recr la vue en cours
            changerVueButton.addClickListener(e -> {
                etudiantController.changerVueNotesEtResultats();
                init();
            });

            Label vueLabel = new Label(
                    applicationContext.getMessage(NAME + ".label.vueEtudiant", null, getLocale()));
            if (MainUI.getCurrent().isVueEnseignantNotesEtResultats()) {
                vueLabel.setValue(
                        applicationContext.getMessage(NAME + ".label.vueEnseignant", null, getLocale()));
            }
            vueLabel.setContentMode(ContentMode.HTML);
            vueLabel.setStyleName(ValoTheme.LABEL_SMALL);

            vueLayout.addComponent(changerVueButton);
            vueLayout.setComponentAlignment(changerVueButton, Alignment.MIDDLE_CENTER);
            vueLayout.addComponent(vueLabel);
            vueLayout.setExpandRatio(vueLabel, 1);

            panelVue.setContent(vueLayout);
            layout.addComponent(panelVue);
            panelVue.setVisible(false);
        }

        Panel panelDetailNotes = new Panel(etape.getLibelle() + " - "
                + applicationContext.getMessage(NAME + ".label.anneeuniv", null, getLocale()) + " "
                + etape.getAnnee());
        panelDetailNotes.addStyleName("small-font-element");
        panelDetailNotes.setSizeFull();

        if (lelp != null && lelp.size() > 0) {
            Table detailNotesTable = new Table(null, new BeanItemContainer<>(ElementPedagogique.class, lelp));
            detailNotesTable.setSizeFull();
            detailNotesTable.setVisibleColumns(new String[0]);
            if (contientElpObtenusPrecedemment(lelp)) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.annee", null, getLocale()),
                        new AnneeColumnGenerator());
            }
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.code", null, getLocale()),
                    new CodeElpColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.libelle", null, getLocale()),
                    new LibelleElpColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.notesession1", null, getLocale()),
                    new Session1ColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.resultatsession1", null, getLocale()),
                    new ResultatSession1ColumnGenerator());
            detailNotesTable.addGeneratedColumn(
                    applicationContext.getMessage(NAME + ".table.elp.notesession2", null, getLocale()),
                    new Session2ColumnGenerator());
            detailNotesTable.addGeneratedColumn("resultatsession2", new ResultatSession2ColumnGenerator());
            detailNotesTable.setColumnHeader("resultatsession2",
                    applicationContext.getMessage(NAME + ".table.elp.resultatsession2", null, getLocale()));
            if (configController.isAffRangEtudiant() || etudiantController.isAfficherRangElpEpr()) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.rang", null, getLocale()),
                        new RangColumnGenerator());
            }
            if (configController.isAffECTSEtudiant()) {
                detailNotesTable.addGeneratedColumn(
                        applicationContext.getMessage(NAME + ".table.elp.ects", null, getLocale()),
                        new ECTSColumnGenerator());
            }
            detailNotesTable.setColumnCollapsingAllowed(true);
            detailNotesTable.setColumnReorderingAllowed(false);
            detailNotesTable.setSelectable(false);
            detailNotesTable.setImmediate(true);
            detailNotesTable.addStyleName("scrollabletable");
            panelDetailNotes.setContent(detailNotesTable);
        } else {
            setHeight(30, Unit.PERCENTAGE);
            HorizontalLayout messageLayout = new HorizontalLayout();
            messageLayout.setSpacing(true);
            messageLayout.setMargin(true);
            Label labelAucunResultat = new Label(
                    applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale()));
            labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD);
            messageLayout.addComponent(labelAucunResultat);
            panelDetailNotes.setContent(messageLayout);

        }
        layout.addComponent(panelDetailNotes);

        if (lelp != null && lelp.size() > 0
                && MainUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
            Panel panelSignificationResultats = new Panel(
                    applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale()));

            panelSignificationResultats.addStyleName("significationpanel");
            panelSignificationResultats.addStyleName("small-font-element");
            panelSignificationResultats.setIcon(FontAwesome.INFO_CIRCLE);

            VerticalLayout significationLayout = new VerticalLayout();
            significationLayout.setMargin(true);
            significationLayout.setSpacing(true);

            String grilleSignficationResultats = "";
            //grilleSignficationResultats = significationResultats.toString().substring(1,significationResultats.toString().length()-1);
            Set<String> ss = MainUI.getCurrent().getEtudiant().getSignificationResultats().keySet();
            for (String k : ss) {
                if (k != null && !k.equals("") && !k.equals(" ")) {
                    grilleSignficationResultats = grilleSignficationResultats + "<b>" + k + "</b>&#160;:&#160;"
                            + MainUI.getCurrent().getEtudiant().getSignificationResultats().get(k);
                    grilleSignficationResultats = grilleSignficationResultats + "&#160;&#160;&#160;";
                }
            }
            Label mapSignificationLabel = new Label(grilleSignficationResultats);
            mapSignificationLabel.setStyleName(ValoTheme.LABEL_SMALL);
            mapSignificationLabel.setContentMode(ContentMode.HTML);
            significationLayout.addComponent(mapSignificationLabel);

            panelSignificationResultats.setContent(significationLayout);
            layout.addComponent(panelSignificationResultats);

        }

        layout.setExpandRatio(panelDetailNotes, 1);

        setContent(layout);

        /* Centre la fentre */
        center();

    }

}

From source file:fr.univlorraine.mondossierweb.views.windows.FiltreInscritsMobileWindow.java

License:Apache License

/**
 * Cre une fentre/*  ww  w  .  j  a  va  2s  .c o m*/
 */
public FiltreInscritsMobileWindow() {
    setWidth("95%");
    setModal(true);
    setResizable(false);
    setClosable(true);

    setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));
    setStyleName("v-popover-blank");

    typeFavori = MdwTouchkitUI.getCurrent().getTypeObjListInscrits();

    GridLayout layout = new GridLayout(1, 2);
    layout.setWidth("100%");
    layout.setSpacing(true);
    layout.setMargin(true);
    setContent(layout);

    //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()) {

        //GESTION DES ETAPES
        List<VersionEtape> letapes = MdwTouchkitUI.getCurrent().getListeEtapesInscrits();
        if (letapes != null && letapes.size() > 0) {

            Label etapeLabel = new Label(applicationContext.getMessage(NAME + ".etape", null, getLocale()));
            layout.addComponent(etapeLabel);
            layout.setComponentAlignment(etapeLabel, Alignment.BOTTOM_LEFT);
            listeEtapes = new NativeSelect();
            listeEtapes.setNullSelectionAllowed(false);
            listeEtapes.setRequired(false);
            listeEtapes.setWidth("100%");
            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 (MdwTouchkitUI.getCurrent().getEtapeInscrits() != null) {
                listeEtapes.setValue(MdwTouchkitUI.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) {
                    vetSelectionnee = (String) event.getProperty().getValue();
                    if (vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) {
                        vetSelectionnee = null;
                    }
                    MdwTouchkitUI.getCurrent().setEtapeInscrits(vetSelectionnee);
                    //faire le changement
                    groupeSelectionne = ((listeGroupes != null && listeGroupes.getValue() != null)
                            ? (String) listeGroupes.getValue()
                            : null);
                    if (groupeSelectionne != null && groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) {
                        groupeSelectionne = null;
                    }

                    //update de l'affichage
                    //initListe();

                }
            });
            layout.addComponent(listeEtapes);

        }

        //GESTION DES GROUPES
        List<ElpDeCollection> lgroupes = MdwTouchkitUI.getCurrent().getListeGroupesInscrits();
        if (lgroupes != null && lgroupes.size() > 0) {

            // Label "GROUPE"
            HorizontalLayout gLayout = new HorizontalLayout();
            gLayout.setSizeFull();
            Label groupeLabel = new Label(applicationContext.getMessage(NAME + ".groupe", null, getLocale()));
            gLayout.addComponent(groupeLabel);
            gLayout.setComponentAlignment(groupeLabel, Alignment.MIDDLE_LEFT);
            layout.addComponent(gLayout);

            //Liste droulante pour choisir le groupe
            listeGroupes = new NativeSelect();
            listeGroupes.setNullSelectionAllowed(false);
            listeGroupes.setRequired(false);
            listeGroupes.setWidth("100%");
            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());

                    }
                }
            }
            //On pr-remplie le groupe choisi si on en a dj choisi un
            if (MdwTouchkitUI.getCurrent().getGroupeInscrits() != null) {
                listeGroupes.setValue(MdwTouchkitUI.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) {
                    groupeSelectionne = (String) event.getProperty().getValue();
                    if (groupeSelectionne.equals(TOUS_LES_GROUPES_LABEL)) {
                        groupeSelectionne = null;
                    }
                    MdwTouchkitUI.getCurrent().setGroupeInscrits(groupeSelectionne);
                    //faire le changement
                    vetSelectionnee = ((listeEtapes != null && listeEtapes.getValue() != null)
                            ? (String) listeEtapes.getValue()
                            : null);
                    if (vetSelectionnee != null && vetSelectionnee.equals(TOUTES_LES_ETAPES_LABEL)) {
                        vetSelectionnee = null;
                    }

                }
            });

            layout.addComponent(listeGroupes);

        }
    }

    // Bouton "Filtrer"
    HorizontalLayout bLayout = new HorizontalLayout();
    bLayout.setSizeFull();
    Button closeButton = new Button(applicationContext.getMessage(NAME + ".filtrerBtn", null, getLocale()));
    closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    closeButton.addStyleName("v-popover-button");
    demandeFiltrage = false;
    closeButton.addClickListener(e -> {
        //retourner vetSelectionnee et groupeSelectionne;
        demandeFiltrage = true;
        close();
    });
    bLayout.addComponent(closeButton);
    bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER);
    layout.addComponent(bLayout);

}

From source file:fr.univlorraine.mondossierweb.views.windows.SignificationsMobileWindow.java

License:Apache License

/**
 * Cre une fentre/* ww  w .j ava 2s.com*/
 */
public SignificationsMobileWindow(boolean afficherSignificationIndicateurProfondeur) {

    setWidth("95%");
    setHeight("95%");

    setCaption(applicationContext.getMessage("significationsWindow.title", null, getLocale()));
    setModal(true);
    setResizable(false);
    setClosable(false);
    setStyleName("v-popover-blank");

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    setContent(layout);

    VerticalLayout panelLayout = new VerticalLayout();
    panelLayout.setWidth("100%");
    panelLayout.setStyleName("v-scrollableelement");
    panelLayout.setSpacing(true);
    panelLayout.setMargin(true);

    if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {

        Panel panelSignificationResultats = new Panel();
        panelSignificationResultats.setCaption(
                applicationContext.getMessage(NAME + ".info.significations.resultats", null, getLocale()));
        panelSignificationResultats.addStyleName("significationpanel");
        panelSignificationResultats.setWidth("100%");

        VerticalLayout significationLayout = new VerticalLayout();
        significationLayout.setWidth("100%");
        significationLayout.setMargin(true);
        significationLayout.setSpacing(true);

        Set<String> ss = MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().keySet();
        for (String k : ss) {
            if (k != null && !k.equals("") && !k.equals(" ")) {
                HorizontalLayout signLayout = new HorizontalLayout();
                signLayout.setSizeFull();
                signLayout.setMargin(true);
                signLayout.setSpacing(true);
                Label codeLabel = new Label(k);
                codeLabel.setStyleName(ValoTheme.LABEL_BOLD);
                codeLabel.addStyleName("v-label-align-right");
                signLayout.addComponent(codeLabel);
                Label valueLabel = new Label(
                        "" + MdwTouchkitUI.getCurrent().getEtudiant().getSignificationResultats().get(k));
                signLayout.addComponent(valueLabel);
                significationLayout.addComponent(signLayout);
            }
        }

        panelSignificationResultats.setContent(significationLayout);
        panelLayout.addComponent(panelSignificationResultats);

    }

    if (afficherSignificationIndicateurProfondeur) {

        Panel panelSignificationIndicateurs = new Panel();
        panelSignificationIndicateurs.setCaption(
                applicationContext.getMessage(NAME + ".info.significations.indicateurs", null, getLocale()));
        panelSignificationIndicateurs.addStyleName("significationpanel");
        panelSignificationIndicateurs.setWidth("100%");

        VerticalLayout significationLayout = new VerticalLayout();
        significationLayout.setMargin(true);
        significationLayout.setSpacing(true);
        significationLayout.setWidth("100%");

        //1er NIVEAU
        HorizontalLayout levelLayout1 = new HorizontalLayout();
        levelLayout1.setWidth("100%");
        HorizontalLayout levelMainLayout1 = new HorizontalLayout();
        levelMainLayout1.setWidth("100%");
        levelMainLayout1.setSpacing(true);
        levelMainLayout1.setStyleName("level-indicator-layout");
        int k = 0;
        for (int i = 0; i < 1; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout1.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout1.addComponent(libLevelSpaceLayout);
        }

        levelLayout1.addComponent(levelMainLayout1);
        levelLayout1.addComponent(new Label("1er niveau"));
        significationLayout.addComponent(levelLayout1);

        //2em NIVEAU
        HorizontalLayout levelLayout2 = new HorizontalLayout();
        levelLayout2.setSizeFull();
        HorizontalLayout levelMainLayout2 = new HorizontalLayout();
        levelMainLayout2.setSizeFull();
        levelMainLayout2.setSpacing(true);
        levelMainLayout2.setStyleName("level-indicator-layout");
        k = 0;
        for (int i = 0; i < 2; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout2.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout2.addComponent(libLevelSpaceLayout);
        }

        levelLayout2.addComponent(levelMainLayout2);
        levelLayout2.addComponent(new Label("2em niveau"));
        significationLayout.addComponent(levelLayout2);

        //3em NIVEAU
        HorizontalLayout levelLayout3 = new HorizontalLayout();
        levelLayout3.setSizeFull();
        HorizontalLayout levelMainLayout3 = new HorizontalLayout();
        levelMainLayout3.setSizeFull();
        levelMainLayout3.setSpacing(true);
        levelMainLayout3.setStyleName("level-indicator-layout");
        k = 0;
        for (int i = 0; i < 3; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout3.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout3.addComponent(libLevelSpaceLayout);
        }

        levelLayout3.addComponent(levelMainLayout3);
        levelLayout3.addComponent(new Label("3em niveau"));
        significationLayout.addComponent(levelLayout3);

        //4em NIVEAU
        HorizontalLayout levelLayout4 = new HorizontalLayout();
        levelLayout4.setSizeFull();
        HorizontalLayout levelMainLayout4 = new HorizontalLayout();
        levelMainLayout4.setSizeFull();
        levelMainLayout4.setSpacing(true);
        levelMainLayout4.setStyleName("level-indicator-layout");
        k = 0;
        for (int i = 0; i < 4; i++) {
            //Ajout d'un level
            k++;
            Label libLevelLayout = new Label();
            libLevelLayout.setSizeFull();
            libLevelLayout.setHeight("8px");
            libLevelLayout.setStyleName("layout-level-green-indicator");
            levelMainLayout4.addComponent(libLevelLayout);
        }
        //On pense avoir 7 level maxi 
        for (int j = k; j < 8; j++) {
            Label libLevelSpaceLayout = new Label();
            libLevelSpaceLayout.setSizeFull();
            libLevelSpaceLayout.setHeight("8px");
            levelMainLayout4.addComponent(libLevelSpaceLayout);
        }

        levelLayout4.addComponent(levelMainLayout4);
        levelLayout4.addComponent(new Label("4em niveau"));
        significationLayout.addComponent(levelLayout4);

        //ETC
        HorizontalLayout levelLayoutEtc = new HorizontalLayout();
        levelLayoutEtc.setSizeFull();

        levelLayoutEtc.addComponent(new Label("..."));
        levelLayoutEtc.addComponent(new Label(""));
        significationLayout.addComponent(levelLayoutEtc);

        panelSignificationIndicateurs.setContent(significationLayout);
        panelLayout.addComponent(panelSignificationIndicateurs);

    }

    layout.addComponent(panelLayout);

    // close button
    HorizontalLayout bLayout = new HorizontalLayout();
    bLayout.setSizeFull();
    bLayout.setHeight("50px");

    Button closeButton = new Button();
    //closeButton.setCaption(applicationContext.getMessage("significationsWindow.btnFermer", null, getLocale()));
    closeButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    closeButton.addStyleName("v-popover-button");
    closeButton.setIcon(FontAwesome.CHECK);
    closeButton.addClickListener(e -> {
        close();

    });

    bLayout.addComponent(closeButton);
    bLayout.setComponentAlignment(closeButton, Alignment.MIDDLE_CENTER);
    layout.addComponent(bLayout);

    layout.setExpandRatio(panelLayout, 1);

}

From source file:infodoc.ui.module.help.AboutWindow.java

License:Open Source License

public AboutWindow() {
    super(InfodocConstants.uiAbout);
    addStyleName(InfodocTheme.WINDOW_OPAQUE);
    setIcon(new ThemeResource(InfodocTheme.iconAbout));
    setSizeUndefined();//from   w w w  .  jav a 2  s  .  c  o  m
    setWidth("580px");
    setResizable(false);

    String installedModules = InfodocConstants.infodocModules.replace(" ", "");
    String installedModulesHtml = "";

    for (String module : installedModules.split(",")) {
        installedModulesHtml += "<span style='margin-left: 20px;'>" + module + "</span><br/>";
    }

    String top = "<h2><i>InfoDoc " + InfodocConstants.infodocVersion + "</i></h2>" + "Modules:" + "<pre><small>"
            + installedModulesHtml + "</small></pre>" + "<br/>License granted to:"
            + "<pre><small><span style='margin-left: 20px;'>" + InfodocConstants.infodocCompanyName + "</span>"
            + (InfodocConstants.infodocCompanyId == null ? ""
                    : "<br/><span style='margin-left: 20px;'> " + InfodocConstants.infodocCompanyId + "</span>")
            + (InfodocConstants.infodocCompanyAddress == null ? ""
                    : "<br/><span style='margin-left: 20px;'>" + InfodocConstants.infodocCompanyAddress
                            + "</span></pre></small>")
            + "<br/><br/>";

    String lower = "<br/>Contact the developer: <a href='" + InfodocConstants.infodocDeveloperUrl + "'>"
            + InfodocConstants.infodocDeveloperUrl + "</a>," + "<br/><b>All rights reserved</b>.";

    Label topLabel = new Label(top, Label.CONTENT_XHTML);
    Label lowerLabel = new Label(lower, Label.CONTENT_XHTML);
    lowerLabel.addStyleName(InfodocTheme.LABEL_TINY);

    VerticalLayout rightLayout = new VerticalLayout();
    rightLayout.setMargin(true);
    rightLayout.setStyleName(InfodocTheme.PANEL_LIGHT);
    rightLayout.addStyleName(InfodocTheme.PANEL_BORDERLESS);
    rightLayout.addStyleName(InfodocTheme.COOL_FONT);
    rightLayout.addComponent(topLabel);
    rightLayout.addComponent(lowerLabel);

    VerticalLayout leftLayout = new VerticalLayout();
    leftLayout.setWidth("130px");
    leftLayout.addComponent(new Label("<h2></h2>", Label.CONTENT_XHTML));
    leftLayout.addComponent(new Embedded(null, new ThemeResource(InfodocTheme.infodocBoxImage)));

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();
    layout.addComponent(leftLayout);
    layout.addComponent(rightLayout);
    layout.setExpandRatio(rightLayout, 1);

    Panel panel = new Panel();
    panel.addComponent(layout);

    setContent(panel);
}

From source file:lifetime.component.welcome.HomeView.java

License:Apache License

private Component getInfoView() {
    HorizontalLayout layout = new HorizontalLayout(nUsers, nJobs, nCourses);
    layout.setSizeFull();
    layout.setComponentAlignment(nUsers, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(nJobs, Alignment.MIDDLE_CENTER);
    layout.setComponentAlignment(nCourses, Alignment.MIDDLE_CENTER);
    return layout;
}

From source file:lu.uni.lassy.excalibur.examples.icrash.dev.web.java.views.AdminAuthView.java

License:Open Source License

public AdminAuthView() {

    setSizeFull();/*w ww  .java2 s .c o m*/

    VerticalLayout header = new VerticalLayout();
    header.setSizeFull();

    HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();

    addComponents(header, content);
    setExpandRatio(header, 1);
    setExpandRatio(content, 6);

    welcomeText.setValue("<h1>Welcome to the iCrash Administrator console!</h1>");
    welcomeText.setContentMode(ContentMode.HTML);
    welcomeText.setSizeUndefined();
    header.addComponent(welcomeText);
    header.setComponentAlignment(welcomeText, Alignment.MIDDLE_CENTER);

    Panel controlPanel = new Panel("Administrator control panel");
    controlPanel.setSizeUndefined();

    Panel addCoordPanel = new Panel("Create a new coordinator");
    addCoordPanel.setSizeUndefined();

    Panel messagesPanel = new Panel("Administrator messages");
    messagesPanel.setWidth("580px");

    Table adminMessagesTable = new Table();

    adminMessagesTable.setContainerDataSource(actAdmin.getMessagesDataSource());

    adminMessagesTable.setColumnWidth("inputEvent", 180);
    adminMessagesTable.setSizeFull();

    VerticalLayout controlLayout = new VerticalLayout(controlPanel);
    controlLayout.setSizeFull();
    controlLayout.setMargin(false);
    controlLayout.setComponentAlignment(controlPanel, Alignment.TOP_CENTER);

    VerticalLayout coordOperationsLayout = new VerticalLayout(addCoordPanel);
    coordOperationsLayout.setSizeFull();
    coordOperationsLayout.setMargin(false);
    coordOperationsLayout.setComponentAlignment(addCoordPanel, Alignment.TOP_CENTER);

    /******************************************/
    coordOperationsLayout.setVisible(true); // main layout in the middle
    addCoordPanel.setVisible(false); // ...which contains the panel "Create a new coordinator"
    /******************************************/

    HorizontalLayout messagesExternalLayout = new HorizontalLayout(messagesPanel);
    VerticalLayout messagesInternalLayout = new VerticalLayout(adminMessagesTable);

    messagesExternalLayout.setSizeFull();
    messagesExternalLayout.setMargin(false);
    messagesExternalLayout.setComponentAlignment(messagesPanel, Alignment.TOP_CENTER);

    messagesInternalLayout.setMargin(false);
    messagesInternalLayout.setSizeFull();
    messagesInternalLayout.setComponentAlignment(adminMessagesTable, Alignment.TOP_CENTER);

    messagesPanel.setContent(messagesInternalLayout);

    TextField idCoordAdd = new TextField();
    TextField loginCoord = new TextField();
    PasswordField pwdCoord = new PasswordField();

    Label idCaptionAdd = new Label("ID");
    Label loginCaption = new Label("Login");
    Label pwdCaption = new Label("Password");

    idCaptionAdd.setSizeUndefined();
    idCoordAdd.setSizeUndefined();

    loginCaption.setSizeUndefined();
    loginCoord.setSizeUndefined();

    pwdCaption.setSizeUndefined();
    pwdCoord.setSizeUndefined();

    Button validateNewCoord = new Button("Validate");
    validateNewCoord.setClickShortcut(KeyCode.ENTER);
    validateNewCoord.setStyleName(ValoTheme.BUTTON_PRIMARY);

    GridLayout addCoordinatorLayout = new GridLayout(2, 4);
    addCoordinatorLayout.setSpacing(true);
    addCoordinatorLayout.setMargin(true);
    addCoordinatorLayout.setSizeFull();

    addCoordinatorLayout.addComponents(idCaptionAdd, idCoordAdd, loginCaption, loginCoord, pwdCaption,
            pwdCoord);

    addCoordinatorLayout.addComponent(validateNewCoord, 1, 3);

    addCoordinatorLayout.setComponentAlignment(idCaptionAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(idCoordAdd, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(loginCoord, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCaption, Alignment.MIDDLE_LEFT);
    addCoordinatorLayout.setComponentAlignment(pwdCoord, Alignment.MIDDLE_LEFT);

    addCoordPanel.setContent(addCoordinatorLayout);

    content.addComponents(controlLayout, coordOperationsLayout, messagesExternalLayout);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(controlLayout, Alignment.TOP_CENTER);
    content.setComponentAlignment(messagesExternalLayout, Alignment.TOP_CENTER);

    content.setExpandRatio(controlLayout, 20);
    content.setExpandRatio(coordOperationsLayout, 10);
    content.setExpandRatio(messagesExternalLayout, 28);

    Button addCoordinator = new Button("Add coordinator");
    Button deleteCoordinator = new Button("Delete coordinator");

    addCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    deleteCoordinator.addStyleName(ValoTheme.BUTTON_HUGE);
    logoutBtn.addStyleName(ValoTheme.BUTTON_HUGE);

    VerticalLayout buttons = new VerticalLayout();

    buttons.setMargin(true);
    buttons.setSpacing(true);
    buttons.setSizeFull();

    buttons.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);

    controlPanel.setContent(buttons);

    buttons.addComponents(addCoordinator, deleteCoordinator, logoutBtn);

    /******* DELETE COORDINATOR PANEL BEGIN *********/
    Label idCaptionDel = new Label("ID");
    TextField idCoordDel = new TextField();

    Panel delCoordPanel = new Panel("Delete a coordinator");

    coordOperationsLayout.addComponent(delCoordPanel);
    delCoordPanel.setVisible(false);

    coordOperationsLayout.setComponentAlignment(delCoordPanel, Alignment.TOP_CENTER);
    delCoordPanel.setSizeUndefined();

    GridLayout delCoordinatorLayout = new GridLayout(2, 2);
    delCoordinatorLayout.setSpacing(true);
    delCoordinatorLayout.setMargin(true);
    delCoordinatorLayout.setSizeFull();

    Button deleteCoordBtn = new Button("Delete");
    deleteCoordBtn.setClickShortcut(KeyCode.ENTER);
    deleteCoordBtn.setStyleName(ValoTheme.BUTTON_PRIMARY);

    delCoordinatorLayout.addComponents(idCaptionDel, idCoordDel);

    delCoordinatorLayout.addComponent(deleteCoordBtn, 1, 1);

    delCoordinatorLayout.setComponentAlignment(idCaptionDel, Alignment.MIDDLE_LEFT);
    delCoordinatorLayout.setComponentAlignment(idCoordDel, Alignment.MIDDLE_LEFT);

    delCoordPanel.setContent(delCoordinatorLayout);
    /******* DELETE COORDINATOR PANEL END *********/

    /************************************************* MAIN BUTTONS LOGIC BEGIN *************************************************/

    addCoordinator.addClickListener(event -> {
        if (!addCoordPanel.isVisible()) {
            delCoordPanel.setVisible(false);
            addCoordPanel.setVisible(true);
            idCoordAdd.focus();
        } else
            addCoordPanel.setVisible(false);
    });

    deleteCoordinator.addClickListener(event -> {
        if (!delCoordPanel.isVisible()) {
            addCoordPanel.setVisible(false);
            delCoordPanel.setVisible(true);
            idCoordDel.focus();
        } else
            delCoordPanel.setVisible(false);
    });

    /************************************************* MAIN BUTTONS LOGIC END *************************************************/

    /************************************************* ADD COORDINATOR FORM LOGIC BEGIN *************************************************/
    validateNewCoord.addClickListener(event -> {

        String currentURL = Page.getCurrent().getLocation().toString();
        int strIndexCreator = currentURL.lastIndexOf(AdministratorLauncher.adminPageName);
        String iCrashURL = currentURL.substring(0, strIndexCreator);
        String googleShebang = "#!";
        String coordURL = iCrashURL + CoordinatorServlet.coordinatorsName + googleShebang;

        try {
            sys.oeAddCoordinator(new DtCoordinatorID(new PtString(idCoordAdd.getValue())),
                    new DtLogin(new PtString(loginCoord.getValue())),
                    new DtPassword(new PtString(pwdCoord.getValue())));

            // open new browser tab with the newly created coordinator console...
            // "_blank" instructs the browser to open a new tab instead of a new window...
            // unhappily not all browsers interpret it correctly,
            // some versions of some browsers might still open a new window instead (notably Firefox)!
            Page.getCurrent().open(coordURL + idCoordAdd.getValue(), "_blank");

        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordAdd.setValue("");
        loginCoord.setValue("");
        pwdCoord.setValue("");

        idCoordAdd.focus();
    });
    /************************************************* ADD COORDINATOR FORM LOGIC END *************************************************/
    /************************************************* DELETE COORDINATOR FORM LOGIC BEGIN *************************************************/
    deleteCoordBtn.addClickListener(event -> {
        IcrashSystem sys = IcrashSystem.getInstance();

        try {
            sys.oeDeleteCoordinator(new DtCoordinatorID(new PtString(idCoordDel.getValue())));
        } catch (Exception e) {
            e.printStackTrace();
        }

        idCoordDel.setValue("");
        idCoordDel.focus();
    });
    /************************************************* DELETE COORDINATOR FORM LOGIC END *************************************************/
}