Example usage for com.vaadin.ui VerticalLayout setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

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

License:Open Source License

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

    final Database database = main.getDatabase();

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

    if (!(base instanceof Tavoite || base instanceof Painopiste))
        return;//  w ww.j a  v  a2 s  . com

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

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

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

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

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

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

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

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

            String tagId = tag.getId(database);

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

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

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

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

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

            } else {

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

                        private static final long serialVersionUID = -1769769368034323594L;

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

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

            }

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

        }

    }

}

From source file:fr.amapj.view.engine.popup.corepopup.CorePopup.java

License:Open Source License

public void createPopup() {
    // Creation du contenu
    VerticalLayout contentLayout = new VerticalLayout();

    createContent(contentLayout);/*from  ww w .  ja v  a 2  s  .  c  om*/

    // Construction de la barre de boutons
    popupButtonBarLayout = new HorizontalLayout();
    popupButtonBarLayout.setMargin(false);
    popupButtonBarLayout.addStyleName("buttonbar");
    createButtonBar();
    popupButtonBarLayout.setSpacing(true);

    // Creation de la fenetre
    window.setClosable(true);
    window.setResizable(true);
    window.setModal(true);

    // Agencement suivant le type
    if (popupType == PopupType.CENTERFIT) {
        //
        contentLayout.setWidthUndefined();

        // 
        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.addStyleName("corepopup");
        mainLayout.setResponsive(true);
        mainLayout.addStyleName("centerfit-corepopup");
        mainLayout.addStyleName("centerfit-corepopup-" + getWidthRange());
        mainLayout.setWidth(null);

        //
        mainLayout.addComponent(contentLayout);

        //
        popupButtonBarLayout.setWidth(null);
        mainLayout.addComponent(popupButtonBarLayout);
        mainLayout.setComponentAlignment(popupButtonBarLayout, Alignment.MIDDLE_RIGHT);

        //
        window.setContent(mainLayout);
        window.setSizeUndefined();
    } else {
        //
        contentLayout.setWidth("100%");

        // 
        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.addStyleName("corepopup");
        mainLayout.setResponsive(true);
        mainLayout.addStyleName("fill-corepopup");
        mainLayout.addStyleName("fill-corepopup-" + getWidthRange());
        mainLayout.setWidth("100%");

        //
        mainLayout.addComponent(contentLayout);

        //
        popupButtonBarLayout.setWidth(null);
        mainLayout.addComponent(popupButtonBarLayout);
        mainLayout.setComponentAlignment(popupButtonBarLayout, Alignment.MIDDLE_RIGHT);

        //
        window.setContent(mainLayout);
        computeWindowSize();

        //
        window.setHeight(popupHeight);

    }

    // Partie commune dans tous les cas
    window.center();
    window.setCaption(popupTitle);
    window.setStyleName("opaque");

    if (colorStyle == ColorStyle.RED) {
        window.setStyleName("corepopup-red");
    }

}

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

License:Open Source License

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

    layout = this;
    layout.removeAllComponents();//ww w .j av  a  2  s  . c o m

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

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

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

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

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

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

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

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

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

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

        p.setContent(hl);

        layout.addComponent(p);

    }

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

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

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

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

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

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

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

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

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

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

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

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

        p.setContent(hl);

        layout.addComponent(p);

    }

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

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

    }
}

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

License:Open Source License

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

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

        Label lab = new Label("Renouvellement de votre adhsion  l'AMAP");
        lab.addStyleName(MesContratsView.LABEL_RUBRIQUE);
        layout.addComponent(lab);/*from  ww  w  . jav a  2 s. c o m*/

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

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

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

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

        addLinkImpressionBulletin(mesContratsDTO.adhesionDTO, vl);

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

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

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

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

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

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

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

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

    }

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

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

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

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

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

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

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

            vl.addComponent(l);
        }

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

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

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

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

    }
}

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

License:Open Source License

private void drawLine(VerticalLayout contentLayout, List<BlocGrille> line,
        AbstractPeriodePermanenceGrillePart grillePart) {
    HorizontalLayout hl = new HorizontalLayout();

    // On calcule d'abord la hauteur de toutes les lignes 
    SizeInfo sizeInfo = computeSizeInfos(line);

    //// w  w w .  j a va2s  .  co m
    for (int i = 0; i < line.size() - 1; i++) {
        VerticalLayout vl = new VerticalLayout();
        draw(vl, line.get(i), sizeInfo, grillePart);

        hl.addComponent(vl);

        VerticalLayout spacer = new VerticalLayout();
        spacer.setWidth("10px");
        hl.addComponent(spacer);

    }

    VerticalLayout vl = new VerticalLayout();
    draw(vl, line.get(line.size() - 1), sizeInfo, grillePart);
    hl.addComponent(vl);

    contentLayout.addComponent(hl);

}

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

License:Open Source License

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

    layout = this;
    layout.removeAllComponents();/*ww  w  .  j  av  a  2 s. c  om*/

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

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

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

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

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

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

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

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

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

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

            p.setContent(hl);

            layout.addComponent(p);

        }
    }

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

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

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

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

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

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

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

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

}

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

License:Apache License

/**
 * Cre une fentre d'dition des preferences applicative
 * @param prfrence  diter// w w w  . ja  va2 s. c om
 */
public PreferencesApplicationWindow(PreferencesApplication prefApp) {
    /* Style */
    setModal(true);
    setResizable(false);
    setClosable(false);
    setWidth("50%");

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("100%");
    setContent(layout);

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

    /* Formulaire */
    fieldGroup = new BeanFieldGroup<>(PreferencesApplication.class);
    fieldGroup.setItemDataSource(prefApp);

    fieldGroup.setFieldFactory(new FieldGroupFieldFactory() {
        private static final long serialVersionUID = 1L;

        @Override
        @SuppressWarnings("rawtypes")
        public <T extends Field> T createField(Class<?> dataType, Class<T> fieldType) {
            if (fieldType == NativeSelect.class) {
                final NativeSelect field = new NativeSelect();
                field.addItem("true");
                field.addItem("false");
                field.setNullSelectionAllowed(false);
                field.setImmediate(true);
                //field.setValue(centre.getTemSrv());
                field.addValueChangeListener(new ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        field.setValue(event.getProperty().getValue());
                    }
                });
                return fieldType.cast(field);
            } else {
                final TextField field = new TextField();
                field.setImmediate(true);
                field.addTextChangeListener(new FieldEvents.TextChangeListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void textChange(TextChangeEvent event) {
                        if (!field.isReadOnly()) {
                            field.setValue(event.getText());
                        }
                    }
                });
                return fieldType.cast(field);
            }

        }
    });

    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(true);
    formLayout.setSizeUndefined();
    formLayout.setWidth("100%");
    for (String fieldName : CONF_APP_FIELDS_ORDER) {
        String caption = applicationContext.getMessage(NAME + ".confAppTable." + fieldName, null, getLocale());
        //Si on est sur un parametre booleen
        if (fieldName.equals("valeur") && estUneValeurBooleenne(prefApp.getValeur())) {
            //On forme le nativeSelect
            Field<?> field = fieldGroup.buildAndBind(caption, fieldName, NativeSelect.class);
            formLayout.addComponent(field);
        } else {
            Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
            if (field instanceof AbstractTextField) {
                ((AbstractTextField) field).setNullRepresentation("");
                field.setWidth("100%");
            }
            formLayout.addComponent(field);
        }
    }

    fieldGroup.getField("prefId").setReadOnly(prefApp.getPrefId() != null);
    fieldGroup.getField("prefDesc").setReadOnly(prefApp.getPrefDesc() != null);

    layout.addComponent(formLayout);

    /* Ajoute les boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    buttonsLayout.setMargin(true);
    layout.addComponent(buttonsLayout);

    btnAnnuler = new Button(applicationContext.getMessage(NAME + ".btnAnnuler", null, getLocale()),
            FontAwesome.TIMES);
    btnAnnuler.addClickListener(e -> close());
    buttonsLayout.addComponent(btnAnnuler);
    buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

    btnEnregistrer = new Button(applicationContext.getMessage(NAME + ".btnSave", null, getLocale()),
            FontAwesome.SAVE);
    btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnEnregistrer.addClickListener(e -> {
        try {
            /* Valide la saisie */
            fieldGroup.commit();
            /* Enregistre la conf saisie */
            configController.saveAppParameter(prefApp);
            /* Ferme la fentre */
            close();
        } catch (CommitException ce) {
        }
    });
    buttonsLayout.addComponent(btnEnregistrer);
    buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

    /* Centre la fentre */
    center();
}

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

License:Apache License

/**
 * Cre une fentre//  www.  ja va  2s . co  m
 */
public SignificationsMobileWindow(boolean afficherSignificationIndicateurProfondeur) {

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

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

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

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

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

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

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

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

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

    }

    if (afficherSignificationIndicateurProfondeur) {

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

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

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

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

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

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

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

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

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

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

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

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

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

    }

    layout.addComponent(panelLayout);

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

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

    });

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

    layout.setExpandRatio(panelLayout, 1);

}

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

License:Apache License

/**
 * Cre une fentre d'dition du swap utilisateur
 * @param swap utilisateur  diter//from  w w  w. j  a  va  2s  .co  m
 */
public SwapUtilisateurWindow(UtilisateurSwap swap, boolean ajout) {
    /* Style */
    setModal(true);
    setResizable(false);
    setClosable(false);
    setWidth("50%");

    /* Layout */
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth("100%");
    setContent(layout);

    /* Titre */
    if (ajout) {
        setCaption(applicationContext.getMessage(NAME + ".title.ajout", null, getLocale()));
    } else {
        setCaption(applicationContext.getMessage(NAME + ".title", null, getLocale()));
    }

    /* Formulaire */
    fieldGroup = new BeanFieldGroup<>(UtilisateurSwap.class);
    fieldGroup.setItemDataSource(swap);
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(true);
    formLayout.setSizeUndefined();
    formLayout.setWidth("100%");
    for (String fieldName : CONF_APP_FIELDS_ORDER) {
        String caption = applicationContext.getMessage(NAME + ".swapUserTable." + fieldName, null, getLocale());
        Field<?> field = fieldGroup.buildAndBind(caption, fieldName);
        if (field instanceof AbstractTextField) {
            ((AbstractTextField) field).setNullRepresentation("");
            field.setWidth("100%");
        }
        if (field instanceof DateField) {
            ((DateField) field).setResolution(DateField.RESOLUTION_MIN);
        }
        formLayout.addComponent(field);
    }

    //fieldGroup.getField("loginCible").setReadOnly(swap.getLoginCible() != null);
    fieldGroup.getField("loginSource").setReadOnly(swap.getLoginSource() != null);

    layout.addComponent(formLayout);

    /* Ajoute les boutons */
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100, Unit.PERCENTAGE);
    buttonsLayout.setSpacing(true);
    buttonsLayout.setMargin(true);
    layout.addComponent(buttonsLayout);

    btnAnnuler = new Button(applicationContext.getMessage(NAME + ".btnAnnuler", null, getLocale()),
            FontAwesome.TIMES);
    btnAnnuler.addClickListener(e -> close());
    buttonsLayout.addComponent(btnAnnuler);
    buttonsLayout.setComponentAlignment(btnAnnuler, Alignment.MIDDLE_LEFT);

    btnEnregistrer = new Button(applicationContext.getMessage(NAME + ".btnSave", null, getLocale()),
            FontAwesome.SAVE);
    btnEnregistrer.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnEnregistrer.addClickListener(e -> {
        try {
            /* Valide la saisie */
            fieldGroup.commit();
            boolean commitok = true;
            if (ajout) {
                //On regarde si le login source n'est pas dj dans la table
                String loginSource = (String) fieldGroup.getField("loginSource").getValue();
                if (configController.getSwapUtilisateur(loginSource) != null) {
                    commitok = false;
                    //afficher message d'erreur
                    Notification.show(applicationContext.getMessage(NAME + ".error.loginexistant", null,
                            UI.getCurrent().getLocale()), Notification.Type.ERROR_MESSAGE);
                }
            }
            if (commitok) {
                /* Enregistre le swap saisie */
                configController.saveSwap(swap);

                /* Ferme la fentre */
                close();
            }
        } catch (CommitException ce) {
        }
    });
    buttonsLayout.addComponent(btnEnregistrer);
    buttonsLayout.setComponentAlignment(btnEnregistrer, Alignment.MIDDLE_RIGHT);

    /* Centre la fentre */
    center();
}

From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java

License:Open Source License

private Panel createHTMLVersionOfC32(String c32) {
    Panel p = new Panel();
    p.setStyleName(Runo.PANEL_LIGHT);/*from w ww  . j  av  a  2 s  .co m*/
    VerticalLayout v = (VerticalLayout) p.getContent();
    v.setSpacing(true);
    v.setHeight("100%");
    v.setWidth("100%");
    Label l = new Label();
    l.setContentMode(Label.CONTENT_XHTML);
    l.setValue(getHTMLVersionOfCDA(c32));
    v.addComponent(l);
    return p;
}