Example usage for com.vaadin.ui VerticalLayout setStyleName

List of usage examples for com.vaadin.ui VerticalLayout setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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

License:Open Source License

@Override
public Runnable getEditor(VerticalLayout layout, final Main main, final Meter meter) {

    Indicator indicator = meter.getPossibleIndicator(main.getDatabase());
    String unit = indicator.getUnit();

    final ComboBox combo = new ComboBox("Valitse mittarin mritystapa");
    combo.addItem(State.INCREASE3);
    combo.addItem(State.DECREASE3);
    combo.addItem(State.INCREASE2);
    combo.addItem(State.DECREASE2);
    combo.setInvalidAllowed(false);/*from ww w.  j a v a 2  s . c  o  m*/
    combo.setNullSelectionAllowed(false);
    combo.setWidth("100%");
    combo.addStyleName(ValoTheme.COMBOBOX_TINY);
    layout.addComponent(combo);
    layout.setComponentAlignment(combo, Alignment.TOP_CENTER);
    layout.setExpandRatio(combo, 0.0f);

    final VerticalLayout vl1 = new VerticalLayout();
    vl1.setHeight("50px");
    vl1.setWidth("100%");
    vl1.setStyleName("redBlock");
    layout.addComponent(vl1);
    layout.setComponentAlignment(vl1, Alignment.TOP_CENTER);
    layout.setExpandRatio(vl1, 0.0f);
    final Label l1 = new Label(" > " + df.format(greenLimit.doubleValue()) + " " + unit);
    l1.setSizeUndefined();
    l1.addStyleName(ValoTheme.LABEL_LARGE);
    vl1.addComponent(l1);
    vl1.setComponentAlignment(l1, Alignment.MIDDLE_CENTER);

    HorizontalLayout hl1 = new HorizontalLayout();
    hl1.setSpacing(true);
    layout.addComponent(hl1);
    layout.setComponentAlignment(hl1, Alignment.TOP_LEFT);

    final TextField tf1 = new TextField();
    tf1.setValue(df.format(greenLimit.doubleValue()));
    tf1.setWidth("150px");
    tf1.setCaption("Suurempi raja-arvo");
    tf1.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tf1.setValidationVisible(true);
    hl1.addComponent(tf1);

    Label unit1 = new Label();
    unit1.setSizeUndefined();
    unit1.setCaption("");
    unit1.setValue(unit);
    hl1.addComponent(unit1);
    hl1.setComponentAlignment(unit1, Alignment.MIDDLE_LEFT);

    final VerticalLayout vl2 = new VerticalLayout();
    vl2.setHeight("50px");
    vl2.setWidth("100%");
    vl2.addStyleName("yellowBlock");
    layout.addComponent(vl2);
    layout.setComponentAlignment(vl2, Alignment.TOP_CENTER);
    layout.setExpandRatio(vl2, 0.0f);
    final Label l2 = new Label();
    l2.setSizeUndefined();
    l2.addStyleName(ValoTheme.LABEL_LARGE);
    vl2.addComponent(l2);
    vl2.setComponentAlignment(l2, Alignment.MIDDLE_CENTER);

    HorizontalLayout hl2 = new HorizontalLayout();
    hl2.setSpacing(true);
    layout.addComponent(hl2);
    layout.setComponentAlignment(hl2, Alignment.TOP_LEFT);

    final TextField tf2 = new TextField();
    tf2.setWidth("150px");
    tf2.setCaption("Pienempi raja-arvo");
    tf2.setStyleName(ValoTheme.TEXTFIELD_TINY);
    tf2.setValidationVisible(true);
    hl2.addComponent(tf2);
    hl2.setComponentAlignment(tf2, Alignment.TOP_CENTER);

    Label unit2 = new Label();
    unit2.setSizeUndefined();
    unit2.setCaption("");
    unit2.setValue("" + unit);
    hl2.addComponent(unit2);
    hl2.setComponentAlignment(unit2, Alignment.MIDDLE_LEFT);

    final VerticalLayout vl3 = new VerticalLayout();
    vl3.setHeight("50px");
    vl3.setWidth("100%");
    vl3.addStyleName("greenBlock");
    layout.addComponent(vl3);
    layout.setComponentAlignment(vl3, Alignment.TOP_CENTER);
    layout.setExpandRatio(vl3, 0.0f);
    final Label l3 = new Label();
    l3.setSizeUndefined();
    l3.addStyleName(ValoTheme.LABEL_LARGE);
    vl3.addComponent(l3);
    vl3.setComponentAlignment(l3, Alignment.MIDDLE_CENTER);

    applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

    combo.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 8396168732300003038L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (inApply)
                return;

            State currentState = getState();

            if (currentState.equals(combo.getValue()))
                return;

            if (State.DECREASE3.equals(combo.getValue())) {
                makeThree = true;
                if (State.INCREASE3.equals(currentState)) {
                    swap();
                } else if (State.INCREASE2.equals(currentState)) {
                    redLimit = greenLimit;
                    greenLimit = null;
                }
            } else if (State.INCREASE3.equals(combo.getValue())) {
                makeThree = true;
                if (State.DECREASE3.equals(currentState)) {
                    swap();
                } else if (State.DECREASE2.equals(currentState)) {
                    greenLimit = redLimit;
                    redLimit = null;
                }
            } else if (State.INCREASE2.equals(combo.getValue())) {
                if (State.DECREASE3.equals(currentState)) {
                    greenLimit = redLimit;
                } else if (State.DECREASE2.equals(currentState)) {
                    greenLimit = redLimit;
                }
                redLimit = null;
                makeThree = false;
            } else if (State.DECREASE2.equals(combo.getValue())) {
                if (State.INCREASE3.equals(currentState)) {
                    redLimit = greenLimit;
                } else if (State.INCREASE2.equals(currentState)) {
                    redLimit = greenLimit;
                }
                greenLimit = null;
                makeThree = false;
            }

            updateMakeThree();

            applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

        }

    });

    tf1.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = -5484608577999300097L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (inApply)
                return;

            if (State.DECREASE3.equals(combo.getValue())) {
                if (makeThree)
                    greenLimit = redLimit;
                redLimit = new BigDecimal(tf1.getValue());
            } else if (State.INCREASE3.equals(combo.getValue())) {
                if (makeThree)
                    redLimit = greenLimit;
                greenLimit = new BigDecimal(tf1.getValue());
            } else if (State.INCREASE2.equals(combo.getValue())) {
                greenLimit = new BigDecimal(tf1.getValue());
            } else if (State.DECREASE2.equals(combo.getValue())) {
                redLimit = new BigDecimal(tf1.getValue());
            }

            updateMakeThree();

            applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

        }

    });

    tf2.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 5825320869230527588L;

        @Override
        public void valueChange(ValueChangeEvent event) {

            if (inApply)
                return;

            // This should not happen!
            if (State.INCREASE2.equals(combo.getValue()) || State.DECREASE2.equals(combo.getValue()))
                return;

            if (State.DECREASE3.equals(combo.getValue())) {
                greenLimit = new BigDecimal(tf2.getValue());
            } else if (State.INCREASE3.equals(combo.getValue())) {
                redLimit = new BigDecimal(tf2.getValue());
            }

            updateMakeThree();

            applyValues(main, meter, combo, vl1, l1, vl2, l2, vl3, l3, tf1, tf2);

        }

    });

    return null;

}

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

License:Open Source License

private void applyValues(Main main, Meter meter, ComboBox combo, VerticalLayout vl1, Label l1,
        VerticalLayout vl2, Label l2, VerticalLayout vl3, Label l3, TextField tf1, TextField tf2) {

    inApply = true;//  ww w  .  j ava 2 s . c  o  m

    Indicator indicator = meter.getPossibleIndicator(main.getDatabase());
    String unit = indicator.getUnit();

    combo.select(getState());

    final double highDouble = getHighLimit().doubleValue();
    final double lowDouble = getLowLimit().doubleValue();

    String highLimit = df.format(highDouble);
    String lowLimit = df.format(lowDouble);

    tf1.setValue(highLimit);
    l1.setValue(highLimit + " < arvo " + unit);

    if (isIncrease()) {
        vl1.setStyleName("greenBlock");
    } else {
        vl1.setStyleName("redBlock");
    }

    tf1.removeAllValidators();
    tf1.addValidator(new Validator() {

        private static final long serialVersionUID = 5929569929930454714L;

        @Override
        public void validate(Object value) throws InvalidValueException {
            try {
                double d = Double.parseDouble((String) value);
                if (d < lowDouble)
                    throw new InvalidValueException("Value is too small");
            } catch (NumberFormatException e) {
                throw new InvalidValueException(e.getMessage());
            }
        }

    });

    if (isTwo()) {

        l3.setVisible(false);
        vl3.setVisible(false);
        tf2.setVisible(false);
        tf1.setCaption("Raja-arvo");

        if (isIncrease()) {
            vl2.setStyleName("redBlock");
        } else {
            vl2.setStyleName("greenBlock");
        }

        l2.setValue("arvo < " + lowLimit + " " + unit);

    } else {

        vl3.setVisible(true);
        l3.setVisible(true);
        tf2.setVisible(true);
        tf1.setCaption("Suurempi raja-arvo");
        tf2.setCaption("Pienempi raja-arvo");
        vl2.setStyleName("yellowBlock");

        l2.setValue(lowLimit + " < arvo < " + highLimit + " " + unit);
        l3.setValue("arvo < " + lowLimit + " " + unit);
        tf2.setValue(lowLimit);

        if (isIncrease()) {
            vl3.setStyleName("redBlock");
        } else {
            vl3.setStyleName("greenBlock");
        }

        tf2.removeAllValidators();
        tf2.addValidator(new Validator() {

            private static final long serialVersionUID = 5929569929930454714L;

            @Override
            public void validate(Object value) throws InvalidValueException {
                try {
                    double d = Double.parseDouble((String) value);
                    if (d > highDouble)
                        throw new InvalidValueException("Value is too large");
                } catch (NumberFormatException e) {
                    throw new InvalidValueException(e.getMessage());
                }
            }

        });

    }

    inApply = false;

}

From source file:foo.MyVaadinApplication.java

License:Apache License

/**
 * Initializes the main layout of the page
 * //w w  w  .  j a v a  2  s  . c om
 * @return initialized main layout of the page
 */
private VerticalLayout initLayout() {
    VerticalLayout v = new VerticalLayout();
    v.setStyleName(Reindeer.LAYOUT_BLUE);
    v.setSpacing(false);

    Panel topBanner = initTopBanner();
    v.addComponent(topBanner);
    v.setComponentAlignment(topBanner, Alignment.TOP_CENTER);

    Panel middlePanel = initMiddlePanel();
    v.addComponent(middlePanel);
    v.setComponentAlignment(middlePanel, Alignment.MIDDLE_CENTER);

    Panel bottomBanner = initBottomBanner();
    v.addComponent(bottomBanner);
    v.setComponentAlignment(bottomBanner, Alignment.BOTTOM_CENTER);
    return v;
}

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

License:Apache License

public void refresh() {
    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI
            && (userController.isEnseignant() || userController.isEtudiant())
            && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) {
        removeAllComponents();/*  w  ww  .java  2  s  . c o m*/

        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

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

        //Bouton retour
        if (userController.isEnseignant()) {
            returnButton = new Button();
            returnButton.setIcon(FontAwesome.ARROW_LEFT);
            //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            returnButton.setStyleName("v-nav-button");
            returnButton.addClickListener(e -> {
                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToListeInscrits();
                }

                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToRecherche(null);
                }
            });
            navbar.addComponent(returnButton);
            navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);
        }

        //Title
        Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelNavBar.setStyleName("v-label-navbar");
        navbar.addComponent(labelNavBar);
        navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER);

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

        VerticalLayout globalLayout = new VerticalLayout();
        //globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);
        globalLayout.setStyleName("v-scrollableelement");

        if (MdwTouchkitUI.getCurrent().getEtudiant() != null
                && MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier() != null
                && MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier().size() > 0) {

            List<Examen> listeExam = MdwTouchkitUI.getCurrent().getEtudiant().getCalendrier();

            for (Examen exam : listeExam) {
                Panel panelCalendrier = new Panel();
                panelCalendrier.setSizeFull();
                HorizontalLayout labelExamenLayout = new HorizontalLayout();
                labelExamenLayout.setMargin(true);
                labelExamenLayout.setSpacing(true);
                labelExamenLayout.setSizeFull();

                //Dtail de l'preuve
                VerticalLayout detailLayout = new VerticalLayout();
                detailLayout.setSizeFull();
                //ajout de la date
                Label dateLabel = new Label(exam.getDatedeb());
                dateLabel.setStyleName(ValoTheme.LABEL_BOLD);
                detailLayout.addComponent(dateLabel);
                dateLabel.addStyleName("v-label-align-right");

                //ajout de l'heure
                Label heureLabel = new Label(exam.getHeure());
                detailLayout.addComponent(heureLabel);
                heureLabel.setStyleName("v-label-align-right");

                //ajout de la salle
                Label salleLabel = new Label(exam.getLibsalle());
                detailLayout.addComponent(salleLabel);
                salleLabel.setStyleName("v-label-align-right");

                //ajout du batiment
                Label batimentLabel = new Label(exam.getBatiment());
                detailLayout.addComponent(batimentLabel);
                batimentLabel.setStyleName("v-label-align-right");

                //Libelle de l'preuve
                VerticalLayout libelleLayout = new VerticalLayout();
                libelleLayout.setSizeFull();
                Label libLabel = new Label(exam.getEpreuve());
                libLabel.setSizeFull();
                libLabel.setStyleName(ValoTheme.LABEL_BOLD);
                libelleLayout.addComponent(new Label(""));
                libelleLayout.addComponent(libLabel);

                //Ajout des 2 layouts dans le layout principal 
                labelExamenLayout.addComponent(detailLayout);
                labelExamenLayout.addComponent(libelleLayout);

                //Ajout du layout principal dans le panel
                panelCalendrier.setContent(labelExamenLayout);

                //Ajout du panel  la vue
                globalLayout.addComponent(panelCalendrier);

            }

        } else {
            Panel panelCalendrier = new Panel();
            panelCalendrier.setSizeFull();
            HorizontalLayout labelExamenLayout = new HorizontalLayout();
            labelExamenLayout.setMargin(true);
            labelExamenLayout.setSizeFull();
            Label aucunExamen = new Label(
                    applicationContext.getMessage(NAME + ".examen.aucun", null, getLocale()));
            aucunExamen.setStyleName(ValoTheme.LABEL_COLORED);
            aucunExamen.addStyleName(ValoTheme.LABEL_BOLD);
            aucunExamen.setWidth("100%");
            aucunExamen.addStyleName("label-centre");
            labelExamenLayout.addComponent(aucunExamen);
            panelCalendrier.setContent(labelExamenLayout);
            globalLayout.addComponent(panelCalendrier);
        }

        addComponent(globalLayout);
        setExpandRatio(globalLayout, 1);
    }
}

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

License:Apache License

public void refresh() {

    //On vrifie le droit d'accder  la vue
    if (UI.getCurrent() instanceof MdwTouchkitUI
            && (userController.isEnseignant() || userController.isEtudiant())
            && MdwTouchkitUI.getCurrent() != null && MdwTouchkitUI.getCurrent().getEtudiant() != null) {
        removeAllComponents();/*  w  ww  . j  a  v  a  2s  .c o m*/

        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

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

        //Bouton retour
        if (userController.isEnseignant()) {
            returnButton = new Button();
            returnButton.setIcon(FontAwesome.ARROW_LEFT);
            //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            returnButton.setStyleName("v-nav-button");
            returnButton.addClickListener(e -> {
                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToListeInscrits();
                } else {

                    if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                            .getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                        MdwTouchkitUI.getCurrent().navigateToRecherche(null);
                    }
                }
            });
            navbar.addComponent(returnButton);
            navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);
        }

        //Title
        Label labelTrombi = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelTrombi.setStyleName("v-label-navbar");
        navbar.addComponent(labelTrombi);
        navbar.setComponentAlignment(labelTrombi, Alignment.MIDDLE_CENTER);

        if (userController.isEnseignant()) {
            //Si on ne peut pas dj revenir sur la recherche via le bouton 'retour'
            if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() == null
                    || !MdwTouchkitUI.getCurrent().getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                //Bouton Search
                Button searchButton = new Button();
                searchButton.setIcon(FontAwesome.SEARCH);
                searchButton.setStyleName("v-nav-button");
                navbar.addComponent(searchButton);
                navbar.setComponentAlignment(searchButton, Alignment.MIDDLE_RIGHT);
                searchButton.addClickListener(e -> {
                    ((MdwTouchkitUI) MdwTouchkitUI.getCurrent()).navigateToRecherche(NAME);
                });
            }
        }

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

        VerticalLayout globalLayout = new VerticalLayout();
        //globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);
        globalLayout.setStyleName("v-scrollableelement");

        VerticalLayout slimLayout = new VerticalLayout();
        slimLayout.setSpacing(false);
        slimLayout.setMargin(false);
        //slimLayout.setStyleName("v-scrollableelement");

        String mail = MdwTouchkitUI.getCurrent().getEtudiant().getEmail();
        if (StringUtils.hasText(mail)) {
            Panel mailPanel = new Panel();
            mailPanel.setStyleName("panel-without-bottom-line-separator");
            HorizontalLayout mailLayout = new HorizontalLayout();
            mailLayout.setSizeFull();
            mailLayout.setHeight("25px");
            Label mailLabel = new Label();

            mail = "<a href=\"mailto:" + mail + "\">" + mail + "</a>";
            mailLabel.setValue(mail);
            mailLabel.setContentMode(ContentMode.HTML);

            mailLabel.setSizeFull();
            mailLabel.addStyleName("label-centre");
            mailLayout.addComponent(mailLabel);
            mailLayout.setComponentAlignment(mailLabel, Alignment.MIDDLE_CENTER);
            mailPanel.setContent(mailLayout);
            slimLayout.addComponent(mailPanel);
            slimLayout.setComponentAlignment(mailPanel, Alignment.MIDDLE_CENTER);
        }

        Panel etuPanel = new Panel();
        HorizontalLayout photoLayout = new HorizontalLayout();
        photoLayout.setId(MdwTouchkitUI.getCurrent().getEtudiant().getCod_ind());
        photoLayout.setSizeFull();
        if (MdwTouchkitUI.getCurrent().getEtudiant().getPhoto() != null) {
            Image fotoEtudiant = new Image(null,
                    new ExternalResource(MdwTouchkitUI.getCurrent().getEtudiant().getPhoto()));
            fotoEtudiant.setWidth("120px");
            fotoEtudiant.setStyleName(ValoTheme.BUTTON_LINK);
            photoLayout.addComponent(fotoEtudiant);

        }
        VerticalLayout nomCodeLayout = new VerticalLayout();
        //nomCodeLayout.setSizeFull();
        nomCodeLayout.setSpacing(false);

        Label labelNomEtudiant = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelNomEtudiant.setSizeFull();
        labelNomEtudiant.setStyleName(ValoTheme.LABEL_BOLD);
        labelNomEtudiant.addStyleName("label-centre");
        nomCodeLayout.addComponent(labelNomEtudiant);
        nomCodeLayout.setComponentAlignment(labelNomEtudiant, Alignment.MIDDLE_CENTER);
        //nomCodeLayout.setExpandRatio(labelNomEtudiant, 1);

        Label codetuLabel = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getCod_etu());
        codetuLabel.setSizeFull();
        codetuLabel.setStyleName(ValoTheme.LABEL_TINY);
        codetuLabel.addStyleName("label-centre");
        nomCodeLayout.addComponent(codetuLabel);
        nomCodeLayout.setComponentAlignment(codetuLabel, Alignment.MIDDLE_CENTER);

        photoLayout.addComponent(nomCodeLayout);
        photoLayout.setComponentAlignment(nomCodeLayout, Alignment.MIDDLE_CENTER);
        photoLayout.setExpandRatio(nomCodeLayout, 1);

        etuPanel.setContent(photoLayout);

        slimLayout.addComponent(etuPanel);
        slimLayout.setComponentAlignment(etuPanel, Alignment.MIDDLE_CENTER);

        globalLayout.addComponent(slimLayout);

        Panel panelInfos = new Panel(applicationContext.getMessage(NAME + ".infos.title", null, getLocale())
                + " " + Utils.getAnneeUniversitaireEnCours(
                        etudiantController.getAnneeUnivEnCours(MdwTouchkitUI.getCurrent())));
        panelInfos.setStyleName("centertitle-panel");
        panelInfos.addStyleName("v-colored-panel-caption");

        //Si l'tudiant est inscrit pour l'anne en cours
        if (MdwTouchkitUI.getCurrent().getEtudiant().isInscritPourAnneeEnCours()) {

            FormLayout formInfosLayout = new FormLayout();
            formInfosLayout.setSpacing(true);
            formInfosLayout.setMargin(true);

            //Numro Anonymat visible que si l'utilisateur est tudiant
            List<Anonymat> lano = null;
            if (!userController.isEnseignant() && userController.isEtudiant()) {
                lano = MdwTouchkitUI.getCurrent().getEtudiant().getNumerosAnonymat();
                if (lano != null) {
                    //Si l'tudiant n'a qu'un seul numro d'anonymat
                    if (lano.size() == 1) {
                        String captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymat.title",
                                null, getLocale());
                        TextField fieldNumAnonymat = new TextField(captionNumAnonymat, MdwTouchkitUI
                                .getCurrent().getEtudiant().getNumerosAnonymat().get(0).getCod_etu_ano());
                        formatTextField(fieldNumAnonymat);
                        //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE);
                        //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale()));
                        formInfosLayout.addComponent(fieldNumAnonymat);
                    }
                    //Si l'tudiant a plusieurs numros d'anonymat
                    if (lano.size() > 1) {
                        int i = 0;
                        for (Anonymat ano : lano) {
                            String captionNumAnonymat = "";
                            if (i == 0) {
                                //Pour le premier numro affich on affiche le libell du champ
                                captionNumAnonymat = applicationContext.getMessage(NAME + ".numanonymats.title",
                                        null, getLocale());
                            }
                            TextField fieldNumAnonymat = new TextField(captionNumAnonymat,
                                    ano.getCod_etu_ano() + " (" + ano.getLib_man() + ")");
                            formatTextField(fieldNumAnonymat);
                            if (i == 0) {
                                //Pour le premier numro affich on affiche l'info bulle
                                //fieldNumAnonymat.setIcon(FontAwesome.INFO_CIRCLE);
                                //fieldNumAnonymat.setDescription(applicationContext.getMessage(NAME+".numanonymat.description", null, getLocale()));
                            }
                            formInfosLayout.addComponent(fieldNumAnonymat);
                            i++;
                        }
                    }
                }
            }

            String captionBousier = applicationContext.getMessage(NAME + ".boursier.title", null, getLocale());
            TextField fieldNumBoursier = new TextField(captionBousier,
                    MdwTouchkitUI.getCurrent().getEtudiant().isBoursier()
                            ? applicationContext.getMessage(NAME + ".boursier.oui", null, getLocale())
                            : applicationContext.getMessage(NAME + ".boursier.non", null, getLocale()));
            formatTextField(fieldNumBoursier);
            formInfosLayout.addComponent(fieldNumBoursier);

            String captionSalarie = applicationContext.getMessage(NAME + ".salarie.title", null, getLocale());
            TextField fieldSalarie = new TextField(captionSalarie,
                    MdwTouchkitUI.getCurrent().getEtudiant().isTemSalarie() == true
                            ? applicationContext.getMessage(NAME + ".salarie.oui", null, getLocale())
                            : applicationContext.getMessage(NAME + ".salarie.non", null, getLocale()));
            formatTextField(fieldSalarie);
            formInfosLayout.addComponent(fieldSalarie);

            String captionAmenagementEtude = applicationContext.getMessage(NAME + ".amenagementetude.title",
                    null, getLocale());
            TextField fieldAmenagementEtude = new TextField(captionAmenagementEtude,
                    MdwTouchkitUI.getCurrent().getEtudiant().isTemAmenagementEtude() == true
                            ? applicationContext.getMessage(NAME + ".amenagementetude.oui", null, getLocale())
                            : applicationContext.getMessage(NAME + ".amenagementetude.non", null, getLocale()));
            formatTextField(fieldAmenagementEtude);
            formInfosLayout.addComponent(fieldAmenagementEtude);

            panelInfos.setContent(formInfosLayout);
        } else {

            HorizontalLayout labelNonInscritLayout = new HorizontalLayout();
            labelNonInscritLayout.setMargin(true);
            labelNonInscritLayout.setSizeFull();
            Label labelNonInscrit = new Label(
                    applicationContext.getMessage(NAME + ".inscrit.non", null, getLocale()));
            labelNonInscrit.setStyleName(ValoTheme.LABEL_COLORED);
            labelNonInscrit.addStyleName(ValoTheme.LABEL_BOLD);
            labelNonInscrit.setWidth("100%");
            labelNonInscrit.addStyleName("label-centre");
            labelNonInscritLayout.addComponent(labelNonInscrit);
            panelInfos.setContent(labelNonInscritLayout);

        }
        globalLayout.addComponent(panelInfos);

        addComponent(globalLayout);
        setExpandRatio(globalLayout, 1);

    }
}

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

License:Apache License

@SuppressWarnings("deprecation")
public void refresh(Etape etapeToDisplay, String codetuToDisplay) {

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

        //On repassera dans la cration que si on n'a pas dej cr la vue
        if (codetu == null || !codetuToDisplay.equals(codetu)) {
            codetu = null;//w  w w  .ja  va 2  s  . c  om
        }
        //On repassera dans la cration que si on n'a pas dej cr la vue
        if (etape == null || !etapeToDisplay.getAnnee().equals(etape.getAnnee())
                || !etapeToDisplay.getCode().equals(etape.getCode())
                || !etapeToDisplay.getVersion().equals(etape.getVersion())) {
            etape = null;
        }
        //On repassera dans la cration que si on n'a pas dej cr la vue
        if (codetu == null || etape == null) {
            compteurElp = 0;

            removeAllComponents();

            /* Style */
            setMargin(false);
            setSpacing(false);
            setSizeFull();

            //Test si user enseignant
            if (userController.isEnseignant()) {
                //On recupere les notes pour un enseignant
                etudiantController.renseigneDetailNotesEtResultatsEnseignant(etapeToDisplay);
            } else {
                //On rcupre les notes pour un tudiant
                etudiantController.renseigneDetailNotesEtResultats(etapeToDisplay);
            }

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

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

            //Titre
            Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
            labelNavBar.setStyleName("v-label-navbar");
            navbar.addComponent(labelNavBar);
            navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER);

            navbar.setExpandRatio(labelNavBar, 1);

            //Significations
            if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
                significationButton = new Button();
                significationButton.setIcon(FontAwesome.INFO_CIRCLE);
                significationButton.setStyleName("v-nav-button");
                significationButton.addClickListener(e -> {
                    //afficher les significations
                    SignificationsMobileWindow w = new SignificationsMobileWindow(true);
                    UI.getCurrent().addWindow(w);
                });
                navbar.addComponent(significationButton);
                navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT);
            }

            addComponent(navbar);

            layoutList = new HashMap<String, LinkedList<HorizontalLayout>>();

            etape = etapeToDisplay;
            codetu = codetuToDisplay;

            /* Layout */
            VerticalLayout layout = new VerticalLayout();
            layout.setSizeFull();
            layout.setMargin(true);
            layout.setSpacing(true);
            layout.setStyleName("v-scrollableelement");

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

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

            if (lelp != null && lelp.size() > 0) {
                //Panel notesPanel = new Panel();
                //notesPanel.setSizeFull();

                VerticalLayout notesLayout = new VerticalLayout();
                //notesLayout.setSpacing(true);

                HorizontalLayout libSessionLayout = new HorizontalLayout();
                libSessionLayout.setSizeFull();
                libSessionLayout.addComponent(new Label());

                HorizontalLayout sessionLayout = new HorizontalLayout();
                sessionLayout.setSizeFull();
                Label session1 = new Label("Session1");
                session1.setStyleName("label-bold-with-bottom");
                sessionLayout.addComponent(session1);
                Label session2 = new Label("Session2");
                session2.setStyleName("label-bold-with-bottom");
                sessionLayout.addComponent(session2);

                libSessionLayout.addComponent(sessionLayout);

                notesLayout.addComponent(libSessionLayout);

                boolean blueLevel = false;

                compteurElp = 0;
                elpPere = "";

                HorizontalLayout layoutPere = null;
                int nbFils = 0;

                for (ElementPedagogique elp : lelp) {

                    compteurElp++;

                    //Si on est sur un element de niveau 1, diffrent du premier element de la liste (qui est un rappel de l'etape)
                    if (elp.getLevel() == 1 && compteurElp > 1) {
                        blueLevel = !blueLevel;
                    }
                    HorizontalLayout libElpLayout = new HorizontalLayout();

                    if (compteurElp > 1) {
                        if (elp.getLevel() == 1) {

                            //Si le pere prcdent n'avait aucun fils
                            if (layoutPere != null && nbFils == 0) {
                                layoutPere.setStyleName("layout-bottom-line-separator");
                            }

                            layoutPere = libElpLayout;
                            nbFils = 0;
                            //Sur un elp de niveau 1, il est sur fond sombre
                            libElpLayout.addStyleName("main-layout-bottom-line-separator");

                            //ajout dans la hashMap
                            layoutList.put(elp.getCode(), new LinkedList<HorizontalLayout>());
                            elpPere = elp.getCode();

                            libElpLayout.setId("layout_pere_" + elp.getCode());

                        } else {
                            nbFils++;
                            libElpLayout.addStyleName("layout-bottom-line-separator");
                            libElpLayout.setId(compteurElp + "_" + elp.getCode() + "_layout_fils_" + elpPere);
                            //ajout dans la hashMap
                            layoutList.get(elpPere).add(libElpLayout);

                        }
                    } else {
                        //on affiche la racine (qui est un rappel de l'etape) en blanc sur un fond trs sombre
                        libElpLayout.addStyleName("root-layout-bottom-line-separator");
                    }
                    libElpLayout.setSizeFull();
                    libElpLayout.setHeight("100%");

                    VerticalLayout libVerticalLayout = new VerticalLayout();

                    Label libElpLabel = new Label(elp.getLibelle());
                    if (elp.isEpreuve()) {
                        libElpLabel.setStyleName("bold-italic-label");
                    } else {
                        libElpLabel.setStyleName("bold-label");
                    }
                    libVerticalLayout.addComponent(libElpLabel);

                    //Si on n'est pas sur le premier elp de la liste (rappel de l'tape) on affiche un indicateur de niveau
                    if (compteurElp > 1) {
                        HorizontalLayout levelMainLayout = new HorizontalLayout();
                        levelMainLayout.setSizeFull();
                        levelMainLayout.setSpacing(true);
                        levelMainLayout.setStyleName("level-indicator-layout");

                        int k = 0;
                        for (int i = 0; i < elp.getLevel(); i++) {
                            //Ajout d'un level
                            k++;
                            Label libLevelLayout = new Label();
                            libLevelLayout.setSizeFull();
                            libLevelLayout.setHeight("8px");
                            if (blueLevel) {
                                libLevelLayout.setStyleName("layout-level-blue-indicator");
                            } else {
                                libLevelLayout.setStyleName("layout-level-green-indicator");
                            }
                            levelMainLayout.addComponent(libLevelLayout);
                        }
                        //On pense avoir 7 level maxi 
                        for (int j = k; j < 8; j++) {
                            Label libLevelSpaceLayout = new Label();
                            libLevelSpaceLayout.setSizeFull();
                            libLevelSpaceLayout.setHeight("8px");
                            levelMainLayout.addComponent(libLevelSpaceLayout);
                        }

                        libVerticalLayout.addComponent(levelMainLayout);
                    }
                    libElpLayout.addComponent(libVerticalLayout);

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

                    VerticalLayout vlsession1 = new VerticalLayout();
                    Label note1 = new Label(elp.getNote1());
                    if (!StringUtils.hasText(elp.getNote2())) {
                        if (elp.isEpreuve()) {
                            note1.setStyleName("bold-italic-label");
                        } else {
                            note1.setStyleName("bold-label");
                        }
                    }
                    vlsession1.addComponent(note1);
                    if (StringUtils.hasText(elp.getRes1())) {
                        Label adm1 = new Label(elp.getRes1());
                        if (!StringUtils.hasText(elp.getRes2())) {
                            if (elp.isEpreuve()) {
                                adm1.setStyleName("bold-italic-label");
                            } else {
                                adm1.setStyleName("bold-label");
                            }
                        }
                        vlsession1.addComponent(adm1);
                    }
                    noteLayout.addComponent(vlsession1);

                    VerticalLayout vlsession2 = new VerticalLayout();
                    Label note2 = new Label(elp.getNote2());
                    if (StringUtils.hasText(elp.getNote2())) {
                        if (elp.isEpreuve()) {
                            note2.setStyleName("bold-italic-label");
                        } else {
                            note2.setStyleName("bold-label");
                        }
                    }
                    vlsession2.addComponent(note2);
                    if (StringUtils.hasText(elp.getRes2())) {
                        Label adm2 = new Label(elp.getRes2());
                        if (StringUtils.hasText(elp.getRes2())) {
                            if (elp.isEpreuve()) {
                                adm2.setStyleName("bold-italic-label");
                            } else {
                                adm2.setStyleName("bold-label");
                            }
                        }
                        vlsession2.addComponent(adm2);
                    }
                    noteLayout.addComponent(vlsession2);

                    libElpLayout.addComponent(noteLayout);

                    notesLayout.addComponent(libElpLayout);

                    //Au dpart, on cache les lments de niveau suprieur  1
                    if (compteurElp > 1 && elp.getLevel() > 1) {
                        //libElpLayout.setVisible(false);
                        Page.getCurrent().getJavaScript().execute("document.getElementById('"
                                + libElpLayout.getId() + "').style.display=\"none\";");

                    }
                }

                //Cas o le dernier lment tait un lment le pere qui n'avait aucun fils
                if (layoutPere != null && nbFils == 0) {
                    layoutPere.setStyleName("layout-bottom-line-separator");
                }

                //Ajout du javascript
                for (Entry<String, LinkedList<HorizontalLayout>> entry : layoutList.entrySet()) {
                    String pere = entry.getKey();
                    LinkedList<HorizontalLayout> listeLayoutFils = entry.getValue();
                    // traitements
                    if (listeLayoutFils != null && listeLayoutFils.size() > 0) {
                        String affichagejavascriptfils = "";
                        for (HorizontalLayout hl : listeLayoutFils) {
                            affichagejavascriptfils += "if(document.getElementById('" + hl.getId()
                                    + "').style.display==\"none\"){document.getElementById('" + hl.getId()
                                    + "').style.display = \"block\";}else{document.getElementById('"
                                    + hl.getId() + "').style.display = \"none\";}";
                        }
                        //sur le clic du layout pere, on affiche les fils
                        Page.getCurrent().getJavaScript().execute("document.getElementById('" + "layout_pere_"
                                + pere + "').onclick=function(){ " + affichagejavascriptfils + "};");
                    }
                }

                layout.addComponent(notesLayout);
                layout.setExpandRatio(notesLayout, 1);

            } else {
                setHeight(30, Unit.PERCENTAGE);
                HorizontalLayout messageLayout = new HorizontalLayout();
                messageLayout.setSpacing(true);
                messageLayout.setMargin(true);
                Label labelAucunResultat = new Label(
                        applicationContext.getMessage(NAME + ".message.aucuneresultat", null, getLocale()));
                labelAucunResultat.setStyleName(ValoTheme.LABEL_BOLD);
                messageLayout.addComponent(labelAucunResultat);
                layout.addComponent(messageLayout);

            }

            addComponent(layout);

            setExpandRatio(layout, 1);

        } else {
            refreshJavascript();
        }
    }
}

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

License:Apache License

public void refresh() {

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

        removeAllComponents();//from w  w  w  . j  a va2 s.com

        /* Style */
        setMargin(false);
        setSpacing(false);
        setSizeFull();

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

        //Bouton retour
        if (userController.isEnseignant()) {
            returnButton = new Button();
            returnButton.setIcon(FontAwesome.ARROW_LEFT);
            //returnButton.setStyleName(ValoTheme.BUTTON_ICON_ONLY);
            returnButton.setStyleName("v-nav-button");
            returnButton.addClickListener(e -> {
                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(ListeInscritsMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToListeInscrits();
                }

                if (MdwTouchkitUI.getCurrent().getDossierEtuFromView() != null && MdwTouchkitUI.getCurrent()
                        .getDossierEtuFromView().equals(RechercheMobileView.NAME)) {
                    MdwTouchkitUI.getCurrent().navigateToRecherche(null);
                }
            });
            navbar.addComponent(returnButton);
            navbar.setComponentAlignment(returnButton, Alignment.MIDDLE_LEFT);
        }

        //Titre
        Label labelNavBar = new Label(MdwTouchkitUI.getCurrent().getEtudiant().getNom());
        labelNavBar.setStyleName("v-label-navbar");
        navbar.addComponent(labelNavBar);
        navbar.setComponentAlignment(labelNavBar, Alignment.MIDDLE_CENTER);

        navbar.setExpandRatio(labelNavBar, 1);

        //Significations
        if (MdwTouchkitUI.getCurrent().getEtudiant().isSignificationResultatsUtilisee()) {
            significationButton = new Button();
            significationButton.setIcon(FontAwesome.INFO_CIRCLE);
            significationButton.setStyleName("v-nav-button");
            significationButton.addClickListener(e -> {
                //afficher les significations
                SignificationsMobileWindow w = new SignificationsMobileWindow(false);
                UI.getCurrent().addWindow(w);
            });
            navbar.addComponent(significationButton);
            navbar.setComponentAlignment(significationButton, Alignment.MIDDLE_RIGHT);
        }

        addComponent(navbar);

        VerticalLayout globalLayout = new VerticalLayout();
        //globalLayout.setSizeFull();
        globalLayout.setSpacing(true);
        globalLayout.setMargin(true);
        globalLayout.setStyleName("v-scrollableelement");

        List<Diplome> ldiplomes = MdwTouchkitUI.getCurrent().getEtudiant().getDiplomes();
        if (ldiplomes != null && ldiplomes.size() > 0) {
            Panel diplomesPanel = new Panel(
                    applicationContext.getMessage(NAME + ".table.diplomes", null, getLocale()));
            diplomesPanel.setStyleName("centertitle-panel");
            diplomesPanel.addStyleName("v-colored-panel-caption");
            VerticalLayout diplomesLayout = new VerticalLayout();
            for (Diplome diplome : ldiplomes) {
                Panel panelEnCours = null;

                panelEnCours = new Panel(diplome.getAnnee());
                panelEnCours.setStyleName("v-panel-caption-centertitle-panel");

                HorizontalLayout noteLayout = new HorizontalLayout();
                noteLayout.setSizeFull();
                noteLayout.setSpacing(true);

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

                Label libelleButton = new Label(diplome.getLib_web_vdi());
                libelleButton.setHeight("100%");
                libelleButton.setWidth("100%");
                libelleButton.addStyleName("label-centre");

                //Appel de la window contenant le dtail des notes
                if (diplome.getResultats() != null && diplome.getResultats().size() > 0) {
                    libelleLayout.addComponent(new Label(""));
                }
                libelleLayout.addComponent(libelleButton);
                libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER);

                HorizontalLayout notesessionLayout = new HorizontalLayout();
                notesessionLayout.setSizeFull();
                notesessionLayout.setSpacing(true);

                if (diplome.getResultats() != null && diplome.getResultats().size() > 0) {
                    int i = 0;
                    for (Resultat r : diplome.getResultats()) {
                        i++;
                        VerticalLayout resultatLayout = new VerticalLayout();
                        resultatLayout.setSizeFull();
                        Label session = new Label(r.getSession());
                        session.setStyleName("label-bold-with-bottom");
                        resultatLayout.addComponent(session);
                        Label note = new Label(r.getNote());
                        resultatLayout.addComponent(note);
                        Label resultat = new Label(r.getAdmission());
                        resultatLayout.addComponent(resultat);
                        //Si c'est la dernire session
                        if (i == diplome.getResultats().size()) {
                            //On affiche les infos en gras
                            note.setStyleName(ValoTheme.LABEL_BOLD);
                            resultat.setStyleName(ValoTheme.LABEL_BOLD);
                        }
                        notesessionLayout.addComponent(resultatLayout);
                    }
                } else {
                    Label resultat = new Label("Aucun rsultat");
                    resultat.setStyleName(ValoTheme.LABEL_SMALL);
                    notesessionLayout.addComponent(resultat);
                }

                noteLayout.addComponent(libelleLayout);

                noteLayout.addComponent(notesessionLayout);

                panelEnCours.setContent(noteLayout);
                diplomesLayout.addComponent(panelEnCours);
            }
            diplomesPanel.setContent(diplomesLayout);
            globalLayout.addComponent(diplomesPanel);
        }

        List<Etape> letapes = MdwTouchkitUI.getCurrent().getEtudiant().getEtapes();

        if (letapes != null && letapes.size() > 0) {
            Panel elpsPanel = new Panel(
                    applicationContext.getMessage(NAME + ".table.etapes", null, getLocale()));
            elpsPanel.setStyleName("centertitle-panel");
            elpsPanel.addStyleName("v-colored-panel-caption");
            VerticalLayout elpsLayout = new VerticalLayout();

            for (Etape etape : letapes) {
                Panel panelEnCours = null;

                panelEnCours = new Panel(etape.getAnnee());
                panelEnCours.setStyleName("v-panel-caption-centertitle-panel");

                HorizontalLayout noteLayout = new HorizontalLayout();
                noteLayout.setSizeFull();
                noteLayout.setSpacing(true);

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

                Button libelleButton = new Button(etape.getLibelle());
                Utils.setButtonStyle(libelleButton);
                libelleButton.setHeight("100%");
                libelleButton.setWidth("100%");

                //Appel de la window contenant le dtail des notes
                prepareBoutonAppelDetailDesNotes(libelleButton, etape);
                if (etape.getResultats() != null && etape.getResultats().size() > 0) {
                    libelleLayout.addComponent(new Label(""));
                }
                libelleLayout.addComponent(libelleButton);
                libelleLayout.setComponentAlignment(libelleButton, Alignment.MIDDLE_CENTER);

                HorizontalLayout notesessionLayout = new HorizontalLayout();
                notesessionLayout.setSizeFull();
                notesessionLayout.setSpacing(true);

                if (etape.getResultats() != null && etape.getResultats().size() > 0) {
                    int i = 0;
                    for (Resultat r : etape.getResultats()) {
                        i++;
                        VerticalLayout resultatLayout = new VerticalLayout();
                        resultatLayout.setSizeFull();
                        Label session = new Label(r.getSession());
                        session.setStyleName("label-bold-with-bottom");
                        resultatLayout.addComponent(session);
                        Label note = new Label(r.getNote());
                        resultatLayout.addComponent(note);
                        Label resultat = new Label(r.getAdmission());
                        resultatLayout.addComponent(resultat);
                        //Si c'est la dernire session
                        if (i == etape.getResultats().size()) {
                            //On affiche les infos en gras
                            note.setStyleName(ValoTheme.LABEL_BOLD);
                            resultat.setStyleName(ValoTheme.LABEL_BOLD);
                        }
                        notesessionLayout.addComponent(resultatLayout);
                    }
                } else {
                    Label resultat = new Label("Aucun rsultat");
                    resultat.setStyleName(ValoTheme.LABEL_SMALL);
                    notesessionLayout.addComponent(resultat);
                }

                noteLayout.addComponent(libelleLayout);

                noteLayout.addComponent(notesessionLayout);

                panelEnCours.setContent(noteLayout);
                elpsLayout.addComponent(panelEnCours);
            }
            elpsPanel.setContent(elpsLayout);
            globalLayout.addComponent(elpsPanel);

        }

        addComponent(globalLayout);
        setExpandRatio(globalLayout, 1);
    }
}

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

License:Apache License

/**
 * Cre une fentre//from ww  w  .  jav  a 2s  .c  om
 */
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:info.magnolia.configuration.app.problem.toolbar.ProblemToolbarViewImpl.java

License:Open Source License

private void iniSearchField() {
    Button clearSearchBoxButton = new Button();
    clearSearchBoxButton.setStyleName("m-closebutton");
    clearSearchBoxButton.addStyleName("icon-delete-search");
    clearSearchBoxButton.addStyleName("searchbox-clearbutton");
    // Preventing the button to spoil the tab-navigation due to its changing display value.
    clearSearchBoxButton.setTabIndex(-1);
    clearSearchBoxButton.addClickListener(new Button.ClickListener() {

        @Override//from   www.  java 2s .co  m
        public void buttonClick(Button.ClickEvent event) {
            searchField.setValue("");
        }
    });

    Icon searchIcon = new Icon("search");
    searchIcon.addStyleName("searchbox-icon");

    Icon searchArrow = new Icon("arrow2_s");
    searchArrow.addStyleName("searchbox-arrow");

    searchField = buildSearchField();

    searchLayout.setVisible(true);
    searchLayout.addComponent(searchField);
    searchLayout.addComponent(clearSearchBoxButton);
    searchLayout.addComponent(searchIcon);
    searchLayout.addComponent(searchArrow);
    searchLayout.setStyleName("searchbox");

    VerticalLayout searchLayoutWrapper = new VerticalLayout();
    searchLayoutWrapper.setStyleName("workbench");
    searchLayoutWrapper.addComponent(searchLayout);

    addComponent(searchLayoutWrapper);
}

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.ja  v  a2 s .  c  om
    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);
}