Example usage for com.vaadin.ui HorizontalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

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

License:Open Source License

public static void manageMeters(final Main main, final Base base) {

    String currentTime = main.getUIState().time;
    boolean showYears = currentTime.equals(Property.AIKAVALI_KAIKKI);

    final Database database = main.getDatabase();

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/*from  ww w .j av  a 2s.  co m*/
    content.setSpacing(true);

    final Table table = new Table();
    table.setSelectable(true);
    table.setMultiSelect(true);
    table.addStyleName(ValoTheme.TABLE_SMALL);
    table.addStyleName(ValoTheme.TABLE_COMPACT);

    table.addContainerProperty("Mittari", Label.class, null);
    if (showYears)
        table.addContainerProperty("Vuosi", String.class, null);

    table.setWidth("100%");
    table.setHeight("100%");
    table.setNullSelectionAllowed(true);

    table.setEditable(false);
    table.setColumnExpandRatio("Mittari", 2.0f);
    if (showYears)
        table.setColumnExpandRatio("Vuosi", 0.0f);

    makeMeterTable(main, base, table);

    content.addComponent(table);
    content.setExpandRatio(table, 1.0f);

    abstract class MeterButtonListener implements Button.ClickListener {

        private static final long serialVersionUID = -6640950006518632633L;

        protected Meter getPossibleSelection() {
            Object selection = table.getValue();
            Collection<?> selected = (Collection<?>) selection;
            if (selected.size() != 1)
                return null;
            return (Meter) selected.iterator().next();
        }

        @SuppressWarnings("unchecked")
        protected Collection<Meter> getSelection() {
            return (Collection<Meter>) table.getValue();
        }

        protected Map<Base, List<Meter>> getSelectionByParent(Database database) {
            return metersByParent(database, getSelection());
        }

    }

    final Button removeMeters = new Button("Poista", new MeterButtonListener() {

        private static final long serialVersionUID = 2957964892664902859L;

        public void buttonClick(ClickEvent event) {

            for (Meter r : getSelection()) {
                Base owner = r.getOwner(database);
                if (owner != null)
                    owner.removeMeter(r);
            }

            makeMeterTable(main, base, table);
            Updates.update(main, true);

        }

    });
    removeMeters.addStyleName(ValoTheme.BUTTON_TINY);

    final Button moveUp = new Button("Siirr ylemms", new MeterButtonListener() {

        private static final long serialVersionUID = 8434251773337788784L;

        public void buttonClick(ClickEvent event) {

            Map<Base, List<Meter>> sel = getSelectionByParent(database);
            if (sel == null)
                return;

            for (Map.Entry<Base, List<Meter>> entry : sel.entrySet()) {
                entry.getKey().moveMetersUp(entry.getValue());
            }

            makeMeterTable(main, base, table);
            Updates.update(main, true);

        }

    });
    moveUp.addStyleName(ValoTheme.BUTTON_TINY);

    final Button moveDown = new Button("Siirr alemmas", new MeterButtonListener() {

        private static final long serialVersionUID = -5382367112305541842L;

        public void buttonClick(ClickEvent event) {

            for (Map.Entry<Base, List<Meter>> entry : getSelectionByParent(database).entrySet()) {
                entry.getKey().moveMetersDown(entry.getValue());
            }

            makeMeterTable(main, base, table);
            Updates.update(main, true);

        }

    });
    moveDown.addStyleName(ValoTheme.BUTTON_TINY);

    final Button modify = new Button("Mrit");
    modify.addClickListener(new MeterButtonListener() {

        private static final long serialVersionUID = -7109999546516429095L;

        public void buttonClick(ClickEvent event) {

            Meter meter = getPossibleSelection();
            if (meter == null)
                return;

            editMeter(main, base, meter);

        }

    });
    modify.addStyleName(ValoTheme.BUTTON_TINY);

    final ComboBox indicatorSelect = new ComboBox();
    indicatorSelect.setWidth("100%");
    indicatorSelect.setNullSelectionAllowed(false);
    indicatorSelect.addStyleName(ValoTheme.COMBOBOX_TINY);
    indicatorSelect.setCaption("Mrittj");
    final Strategiakartta map = database.getMap(base);

    // Indikaattorit
    for (Indicator i : map.getIndicators(database)) {
        MeterSpec spec = new MeterSpec(database, i);
        indicatorSelect.addItem(spec);
        indicatorSelect.select(spec);
    }
    // Enumeraatiot
    for (Datatype enu : Datatype.enumerate(database)) {
        if (enu instanceof EnumerationDatatype) {
            MeterSpec spec = new MeterSpec(database, enu);
            indicatorSelect.addItem(spec);
            indicatorSelect.select(spec);
        }
    }
    // Sisnrakennetut
    {
        MeterSpec spec = new MeterSpec(database, MeterSpec.IMPLEMENTATION);
        indicatorSelect.addItem(spec);
        indicatorSelect.select(spec);
    }

    indicatorSelect.setTextInputAllowed(false);

    final Button addMeter = new Button("Lis ptasolle", new Button.ClickListener() {

        private static final long serialVersionUID = -5178621686299637238L;

        public void buttonClick(ClickEvent event) {

            MeterSpec spec = (MeterSpec) indicatorSelect.getValue();
            Object source = spec.getSource();
            if (source instanceof Indicator) {
                Indicator ind = (Indicator) source;
                Meter.addIndicatorMeter(main, base, ind, Property.AIKAVALI_KAIKKI);
            } else if (source instanceof EnumerationDatatype) {
                EnumerationDatatype dt = (EnumerationDatatype) source;
                Indicator ind = Indicator.create(database, "Uusi " + dt.getId(database), dt);
                ind.update(main, base, dt.getDefaultValue(), false, "", "Alkuarvo");
                ind.update(main, base, dt.getDefaultForecast(), true, "", "Alkuarvo");
                Meter.addIndicatorMeter(main, base, ind, Property.AIKAVALI_KAIKKI);
            }

            makeMeterTable(main, base, table);
            Updates.update(main, true);

        }

    });
    addMeter.addStyleName(ValoTheme.BUTTON_TINY);

    final Button addSubmeter = new Button("Lis valitun alle", new MeterButtonListener() {

        private static final long serialVersionUID = -1250285092312682737L;

        public void buttonClick(ClickEvent event) {

            Meter meter = getPossibleSelection();
            if (meter == null)
                return;

            MeterSpec spec = (MeterSpec) indicatorSelect.getValue();
            Object source = spec.getSource();
            if (source instanceof Indicator) {
                Indicator ind = (Indicator) source;
                Meter.addIndicatorMeter(main, meter, ind, Property.AIKAVALI_KAIKKI);
            } else if (source instanceof EnumerationDatatype) {
                EnumerationDatatype dt = (EnumerationDatatype) source;
                Indicator ind = Indicator.create(database, "Uusi " + dt.getId(database), dt);
                ind.update(main, base, dt.getDefaultValue(), false, "", "Alkuarvo");
                ind.update(main, base, dt.getDefaultForecast(), true, "", "Alkuarvo");
                Meter.addIndicatorMeter(main, meter, ind, Property.AIKAVALI_KAIKKI);
            }

            makeMeterTable(main, base, table);
            Updates.update(main, true);

        }

    });
    addSubmeter.addStyleName(ValoTheme.BUTTON_TINY);

    final Runnable setStates = new Runnable() {

        @Override
        public void run() {

            Object selection = table.getValue();
            Collection<?> selected = (Collection<?>) selection;
            if (!selected.isEmpty()) {
                removeMeters.setEnabled(true);
                moveUp.setEnabled(true);
                moveDown.setEnabled(true);
                if (selected.size() == 1) {
                    modify.setEnabled(true);
                    addSubmeter.setEnabled(true);
                } else {
                    addSubmeter.setEnabled(false);
                    modify.setEnabled(false);
                }
            } else {
                moveUp.setEnabled(false);
                moveDown.setEnabled(false);
                removeMeters.setEnabled(false);
                addSubmeter.setEnabled(false);
                modify.setEnabled(false);
            }

        }

    };

    table.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 6439090862804667322L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            setStates.run();
        }

    });

    setStates.run();

    HorizontalLayout hl2 = new HorizontalLayout();
    hl2.setSpacing(true);
    hl2.setWidthUndefined();

    hl2.addComponent(modify);
    hl2.setComponentAlignment(modify, Alignment.TOP_LEFT);
    hl2.setExpandRatio(modify, 0.0f);

    hl2.addComponent(removeMeters);
    hl2.setComponentAlignment(removeMeters, Alignment.TOP_LEFT);
    hl2.setExpandRatio(removeMeters, 0.0f);

    hl2.addComponent(moveUp);
    hl2.setComponentAlignment(moveUp, Alignment.TOP_LEFT);
    hl2.setExpandRatio(moveUp, 0.0f);

    hl2.addComponent(moveDown);
    hl2.setComponentAlignment(moveDown, Alignment.TOP_LEFT);
    hl2.setExpandRatio(moveDown, 0.0f);

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

    hl3.addComponent(addMeter);
    hl3.setComponentAlignment(addMeter, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(addMeter, 0.0f);

    hl3.addComponent(addSubmeter);
    hl3.setComponentAlignment(addSubmeter, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(addSubmeter, 0.0f);

    hl3.addComponent(indicatorSelect);
    hl3.setComponentAlignment(indicatorSelect, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(indicatorSelect, 1.0f);

    content.addComponent(hl2);
    content.setComponentAlignment(hl2, Alignment.MIDDLE_CENTER);
    content.setExpandRatio(hl2, 0.0f);

    content.addComponent(hl3);
    content.setComponentAlignment(hl3, Alignment.BOTTOM_LEFT);
    content.setExpandRatio(hl3, 0.0f);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(false);

    final Window dialog = Dialogs.makeDialog(main, "450px", "600px", "Hallitse mittareita", "Sulje", content,
            buttons);

}

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

License:Open Source License

public static void editMeter(final Main main, final Base base, final Meter meter) {

    Database database = main.getDatabase();

    final VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/*  w ww . jav  a2s.  c  o  m*/
    content.setHeightUndefined();
    content.setSpacing(true);

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

    final TextField tf = new TextField();
    tf.setCaption("Lyhytnimi");
    tf.setValue(meter.getId(database));
    tf.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf.setWidth("100%");

    hl.addComponent(tf);
    hl.setComponentAlignment(tf, Alignment.TOP_CENTER);
    hl.setExpandRatio(tf, 1.0f);

    final TextField tf1 = new TextField();
    tf1.setCaption("Teksti");
    tf1.setValue(meter.getText(database));
    tf1.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf1.setWidth("100%");

    hl.addComponent(tf1);
    hl.setComponentAlignment(tf1, Alignment.TOP_CENTER);
    hl.setExpandRatio(tf1, 2.0f);

    content.addComponent(hl);
    content.setComponentAlignment(hl, Alignment.TOP_CENTER);
    content.setExpandRatio(hl, 0.0f);

    final TextField tf2 = new TextField();
    tf2.setCaption("Voimassaolo");
    tf2.setValue(Utils.getValidity(database, meter));
    tf2.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf2.setWidth("100%");

    content.addComponent(tf2);
    content.setComponentAlignment(tf2, Alignment.TOP_CENTER);
    content.setExpandRatio(tf2, 0.0f);

    final TextArea ta = new TextArea();
    ta.setCaption("Mritys");
    ta.setValue(meter.getText(database));
    ta.addStyleName(ValoTheme.TEXTAREA_TINY);
    ta.setHeight("100%");
    ta.setWidth("100%");

    content.addComponent(ta);
    content.setComponentAlignment(ta, Alignment.TOP_CENTER);
    content.setExpandRatio(ta, 1.0f);

    final TrafficValuation valuation = meter.trafficValuation;
    final Runnable onOK = valuation != null ? valuation.getEditor(content, main, meter) : null;

    Indicator indicator = meter.getPossibleIndicator(database);
    if (indicator != null) {
        final Label ta2 = Indicator.makeHistory(database, indicator, main.getUIState().forecastMeters);
        content.addComponent(ta2);
        content.setComponentAlignment(ta2, Alignment.MIDDLE_CENTER);
        content.setExpandRatio(ta2, 1.0f);
    }

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(false);

    Button ok = new Button("Tallenna", new Button.ClickListener() {

        private static final long serialVersionUID = 1992235622970234624L;

        public void buttonClick(ClickEvent event) {
            if (onOK != null)
                onOK.run();
            meter.modifyId(main, tf.getValue());
            meter.modifyText(main, tf1.getValue());
            Utils.modifyValidity(main, meter, tf2.getValue());
            meter.modifyDescription(main, ta.getValue());
            Updates.update(main, true);
            manageMeters(main, main.getUIState().currentItem);
        }

    });
    buttons.addComponent(ok);

    Button close = new Button("Sulje");
    buttons.addComponent(close);

    final Window dialog = Dialogs.makeDialog(main, "500px", "800px", "Mrit mittaria", null, content,
            buttons);
    close.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = -8065367213523520602L;

        public void buttonClick(ClickEvent event) {
            main.removeWindow(dialog);
            manageMeters(main, main.getUIState().currentItem);
        }

    });

}

From source file:fi.vtt.RVaadin.RContainer.java

License:Apache License

/**
 * Get a Vaadin Window element that contains the corresponding R plot
 * generated by submitting and evaluating the RPlotCall String. The
 * imageName corresponds to the downloadable .png image name. The full name
 * of the images shown in the browser are of the format
 * {@code imageName_ISODate_runningId_[sessionId].png}, e.g.
 * 'Image_2012-08-29_001_[bmgolmfgvk].png' to keep them chronologically
 * ordered.// www . j av a2s .c  o  m
 * 
 * @param RPlotCall
 *            the String to be evaluated by R
 * @param width
 *            the width of the graphical image
 * @param height
 *            the height of the graphical image
 * @param imageName
 *            the image name attached to the right-click downloadable file
 * @param windowName
 *            the title name of the Vaadin window element
 * @return Vaadin Window object
 */
public Window getGraph(final String RPlotCall, final int width, final int height, final String imageName,
        String windowName) {

    /* Construct a Window to show the graphics */
    Window RGraphics = new Window(windowName);
    HorizontalLayout root = new HorizontalLayout();
    root.setMargin(true);

    RGraphics.setContent(root);
    RGraphics.setSizeUndefined();

    /* Control the image position */
    final int imageXoffset = 180;
    final int imageYoffset = 60;

    int imageYpos = rand.nextInt(50);
    int imageXpos = rand.nextInt(90);

    RGraphics.setPositionX(imageXoffset + imageXpos);
    RGraphics.setPositionY(imageYoffset + imageYpos);

    /* Call R for the graphics */
    Embedded rPlot = getEmbeddedGraph(RPlotCall, width, height, imageName);
    root.addComponent(rPlot);

    /*
     * Button bar to generate PDF (and for other options in the future)
     */
    if (showButtonsInGraph) {
        final HorizontalLayout buttonLayout = new HorizontalLayout();
        Button open = new Button("PDF");
        open.setStyleName(Reindeer.BUTTON_SMALL);
        buttonLayout.addComponent(open);

        Button.ClickListener openClicked = new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                StreamResource s = getImageResource(RPlotCall, width / screen_dpi, height / screen_dpi,
                        imageName, "pdf");

                Link pdfLink = new Link("Open pdf", s);
                pdfLink.setTargetName("_blank");

                buttonLayout.removeAllComponents();
                buttonLayout.addComponent(pdfLink);
            }
        };
        open.addClickListener(openClicked);
        root.addComponent(buttonLayout);
    }

    return RGraphics;
}

From source file:fr.amapj.view.engine.popup.copypopup.CopyPopup.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {
    // Calcul du texte a afficher
    String str = contentSupplier.get();

    // Construction de la zone d'affichage du texte
    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);/*  w  w  w .j  a  va  2  s.co  m*/
    hlTexte.setWidth("100%");

    TextArea listeMails = new TextArea("");
    listeMails.setValue(str);
    listeMails.setReadOnly(true);
    listeMails.selectAll();
    listeMails.setWidth("80%");
    listeMails.setHeight(5, Unit.CM);

    hlTexte.addComponent(listeMails);
    hlTexte.setExpandRatio(listeMails, 1);
    hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

}

From source file:fr.amapj.view.engine.popup.errorpopup.ErrorPopup.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {
    setColorStyle(ColorStyle.RED);/*from w w  w  . j a  v  a2 s.  co  m*/

    // Message logg 
    SessionParameters p = SessionManager.getSessionParameters();
    String debugMessage = null;
    if (p != null) {
        debugMessage = p.userNom + " " + p.userPrenom + " a rencontr une erreur :" + message;
        p.incNbError();
    } else {
        debugMessage = "Pas d'utilisateur encore logg. Erreur :" + message;
    }
    logger.info(debugMessage, throwable);

    String constraintInfo = getConstraintInfo(throwable);
    if (constraintInfo != null) {
        logger.info("Constraint Information:" + constraintInfo);
    }

    // Message utilisateur
    String msg = "Dsol, une erreur est survenue.<br/>";
    if (message != null) {
        msg = msg + "Information supplmentaire:<br/>" + message + "<br/>";
    }
    if (constraintInfo != null) {
        msg = msg + "<br/>" + constraintInfo + "<br/>";
    }

    msg = msg + "Veuillez cliquer sur OK pour continuer<br/>";

    // Construction de la zone de texte
    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    Label textArea = new Label(msg, ContentMode.HTML);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);
}

From source file:fr.amapj.view.engine.popup.suppressionpopup.SuppressionPopup.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    setWidth(40, 450);//from  w  ww .  j  a  v  a2  s  .  com

    // Construction de la zone de texte
    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    Label textArea = new Label(message);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

    if (secured) {
        hlTexte = new HorizontalLayout();
        hlTexte.setMargin(true);
        hlTexte.setSpacing(true);
        hlTexte.setWidth("100%");

        textArea = new Label(
                "Veuillez confirmer en saississant le mot SUPPRIMER dans le champ de saisie ci dessous");
        textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
        textArea.setWidth("80%");

        hlTexte.addComponent(textArea);
        hlTexte.setExpandRatio(textArea, 1);
        hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

        contentLayout.addComponent(hlTexte);

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

        TextField textField = new TextField();
        textField.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
        textField.setWidth("80%");
        textField.setImmediate(true);
        textField.setBuffered(false);

        hlTexte.addComponent(textField);
        hlTexte.setExpandRatio(textField, 1);
        hlTexte.setComponentAlignment(textField, Alignment.MIDDLE_CENTER);

        textField.addTextChangeListener(new TextChangeListener() {
            @Override
            public void textChange(TextChangeEvent event) {
                if (event.getText().equals("SUPPRIMER")) {
                    okButton.setEnabled(true);
                } else {
                    okButton.setEnabled(false);
                }
            }
        });

        contentLayout.addComponent(hlTexte);
    }

}

From source file:fr.amapj.view.views.appinstance.PopupCopyAllMail.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    // Construction de la zone d'affichage des mails
    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);//ww w .jav  a 2s.  c  o m
    hlTexte.setWidth("100%");

    TextArea listeMails = new TextArea("");
    listeMails.setValue(mails);
    listeMails.setReadOnly(true);
    listeMails.selectAll();
    listeMails.setWidth("80%");
    listeMails.setHeight(5, Unit.CM);

    hlTexte.addComponent(listeMails);
    hlTexte.setExpandRatio(listeMails, 1);
    hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

}

From source file:fr.amapj.view.views.cotisation.PeriodeCotisationSelectorPart.java

License:Open Source License

public HorizontalLayout getChoixPeriodeComponent() {
    // Partie choix 
    HorizontalLayout toolbar1 = new HorizontalLayout();
    toolbar1.addStyleName("periode-selectorpart");

    Label pLabel = new Label("Priode de cotisation");
    pLabel.addStyleName("periode");
    pLabel.setSizeUndefined();/*from   ww w .ja v a 2  s .  c o m*/

    toolbar1.addComponent(pLabel);

    constructMultiplePeriode(toolbar1);

    toolbar1.setSpacing(true);
    toolbar1.setMargin(false);
    toolbar1.setWidth("100%");

    return toolbar1;
}

From source file:fr.amapj.view.views.gestioncontratsignes.PopupCopyAllMailForContrat.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    List<String> mails = new GestionContratSigneService().getAllMails(idModeleContrat);

    // Construction de la zone de texte explicative
    String msg = "Pour envoyer un mail  tous adhrents de ce contrat , vous devez :<br/><ul>"
            + "<li>Faire un copier de toutes les adresses e-mail en faisant Ctrl+C ou en faisant clic droit + Copier sur la zone bleue ci dessous</li>"
            + "<li>Ouvrir votre outil favori pour l'envoi des mails (Thunderbird, Gmail, Outlook, ...)</li>"
            + "<li>Faire nouveau message</li>"
            + "<li>Faire un coller de toutes les adresses e-mail en faisant Ctrl+V ou en faisant clic droit + Coller dans la liste des destinataires du message.</li></ul>";

    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);//from   w w  w  .j ava  2s. c o  m
    hlTexte.setWidth("100%");

    Label textArea = new Label(msg, ContentMode.HTML);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

    // Construction de la zone d'affichage des mails
    hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    TextArea listeMails = new TextArea("");
    listeMails.setValue(CollectionUtils.asString(mails, ","));
    listeMails.setReadOnly(true);
    listeMails.selectAll();
    listeMails.setWidth("80%");
    listeMails.setHeight(5, Unit.CM);

    hlTexte.addComponent(listeMails);
    hlTexte.setExpandRatio(listeMails, 1);
    hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

}

From source file:fr.amapj.view.views.listeadherents.PopupCopyAllMail.java

License:Open Source License

protected void createContent(VerticalLayout contentLayout) {

    // Construction de la zone de texte explicative
    String msg = "Pour envoyer un mail  tous les amapiens, vous devez :<br/><ul>"
            + "<li>Faire un copier de toutes les adresses e-mail en faisant Ctrl+C ou en faisant clic droit + Copier sur la zone bleue ci dessous</li>"
            + "<li>Ouvrir votre outil favori pour l'envoi des mails (Thunderbird, Gmail, Outlook, ...)</li>"
            + "<li>Faire nouveau message</li>"
            + "<li>Faire un coller de toutes les adresses e-mail en faisant Ctrl+V ou en faisant clic droit + Coller dans la liste des destinataires du message.</li></ul>";

    HorizontalLayout hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);/*  w w w . java2  s .  co m*/
    hlTexte.setWidth("100%");

    Label textArea = new Label(msg, ContentMode.HTML);
    textArea.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    textArea.setWidth("80%");

    hlTexte.addComponent(textArea);
    hlTexte.setExpandRatio(textArea, 1);
    hlTexte.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

    // Construction de la zone d'affichage des mails
    hlTexte = new HorizontalLayout();
    hlTexte.setMargin(true);
    hlTexte.setSpacing(true);
    hlTexte.setWidth("100%");

    TextArea listeMails = new TextArea("");
    listeMails.setValue(mails);
    listeMails.setReadOnly(true);
    listeMails.selectAll();
    listeMails.setWidth("80%");
    listeMails.setHeight(5, Unit.CM);

    hlTexte.addComponent(listeMails);
    hlTexte.setExpandRatio(listeMails, 1);
    hlTexte.setComponentAlignment(listeMails, Alignment.MIDDLE_CENTER);

    contentLayout.addComponent(hlTexte);

}