Example usage for com.vaadin.ui TextArea setValue

List of usage examples for com.vaadin.ui TextArea setValue

Introduction

In this page you can find the example usage for com.vaadin.ui TextArea setValue.

Prototype

@Override
public void setValue(String value) 

Source Link

Document

Sets the value of this text field.

Usage

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

License:Open Source License

public static void editIndicator(final Main main, final Base base, final Indicator indicator) {

    final Database database = main.getDatabase();

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/*w w  w .jav  a2s.  c  om*/
    content.setHeightUndefined();
    content.setSpacing(true);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setWidth("100%");
    content.addComponent(hl);
    content.setExpandRatio(hl, 0.0f);

    final TextField tf = new TextField("Tunniste");
    tf.setValue(indicator.getId(database));
    tf.setWidth("100%");
    tf.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    hl.addComponent(tf);
    hl.setComponentAlignment(tf, Alignment.MIDDLE_CENTER);
    hl.setExpandRatio(tf, 2.0f);

    final TextField tf1 = new TextField("Teksti");
    tf1.setValue(indicator.getText(database));
    tf1.setWidth("100%");
    tf1.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    hl.addComponent(tf1);
    hl.setComponentAlignment(tf1, Alignment.MIDDLE_CENTER);
    hl.setExpandRatio(tf1, 2.0f);

    final TextField unit = makeUnit(database, hl, indicator);

    final TextField tf2 = new TextField();
    tf2.setCaption("Voimassaolo");
    tf2.setValue(Utils.getValidity(database, indicator));
    tf2.addStyleName(ValoTheme.TEXTFIELD_TINY);
    tf2.setWidth("100%");
    hl.addComponent(tf2);
    hl.setComponentAlignment(tf2, Alignment.MIDDLE_CENTER);
    hl.setExpandRatio(tf2, 1.0f);

    final TextArea ta = new TextArea("Mritys");
    ta.setValue(indicator.getText(database));
    ta.setWidth("100%");
    ta.setHeight("100px");
    content.addComponent(ta);
    content.setComponentAlignment(ta, Alignment.MIDDLE_CENTER);
    content.setExpandRatio(ta, 0.0f);

    final Label ta2 = 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) {
            indicator.modifyId(main, tf.getValue());
            Utils.modifyValidity(main, indicator, tf2.getValue());
            indicator.modifyText(main, tf1.getValue());
            indicator.modifyDescription(main, ta.getValue());
            if (unit != null) {
                indicator.modifyUnit(main, unit.getValue());
            }
            Updates.update(main, true);
            manageIndicators(main, main.getUIState().currentItem);
        }

    });
    buttons.addComponent(ok);

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

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

        private static final long serialVersionUID = 1992235622970234624L;

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

    });

}

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();//from w  w w .  ja  v a 2s  . com
    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: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);/*w  w w  .j  a  v a  2 s.com*/
    hlTexte.setSpacing(true);
    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.views.advanced.devtools.PopupDecodeZipField.java

License:Open Source License

private void addFieldAffichage() {
    setStepTitle("Rsultat");

    String str = tf.getValue();//from   ww w.  j  a v  a  2  s .  co  m
    str = GzipUtils.uncompress(str);

    TextArea textArea = new TextArea();
    textArea.setHeight(8, Unit.CM);
    textArea.setValue(str);
    textArea.setWidth("90%");
    form.addComponent(textArea);

}

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);//from   ww w . j  av a2 s  .co  m
    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);

}

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);//from ww w  . j  a  va2  s  .co m
    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);

    // 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);/*from   w  w  w.j a  v a 2 s  . c om*/
    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);

    // 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);

}

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

License:Open Source License

private Popover getPopoverTextArea(String val, String title) {
    Popover popover = new Popover();
    popover.setModal(true);/*from w  w w.j  a  v a2  s.c  o m*/
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("100%");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();
    popLayout.setMargin(true);

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    TextArea textArea = new TextArea();
    textArea.setWidth("100%");
    textArea.setHeight("700px");
    textArea.setValue(val);
    textArea.setReadOnly(true);
    layout2.addComponent(textArea);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow());
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}

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

License:Open Source License

private Popover getPopoverTextArea(String val, String title) {
    Popover popover = new Popover();
    popover.setModal(true);//from w  w  w . j a  va  2  s.com
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("100%");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();
    popLayout.setMargin(true);

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    TextArea textArea = new TextArea();
    textArea.setWidth("100%");
    textArea.setHeight("700px");
    textArea.setValue(val);
    textArea.setReadOnly(true);
    layout2.addComponent(textArea);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new ClickListener() {

        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow());
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}

From source file:gov.va.ehtac.appsonfhir.ui.HCSLogs.java

private Popover getPopoverTextArea(String val, String title) {
    popover = new Popover();
    popover.setModal(true);//from w  w  w.  java 2s  . c o m
    popover.setClosable(true);
    popover.setWidth("700px");
    popover.setHeight("550px");

    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption(title);

    CssLayout layout2 = new CssLayout();
    TextArea textArea = new TextArea();
    textArea.setWidth("100%");
    textArea.setHeight("490px");
    textArea.setValue(val);
    //        textArea.setReadOnly(true);
    //        textArea.setStyleName(Runo.LABEL_SMALL);
    layout2.addComponent(textArea);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent event) {
            popover.removeFromParent();
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);

    popover.setContent(navView);

    return popover;
}