Example usage for com.vaadin.ui TextArea TextArea

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

Introduction

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

Prototype

public TextArea(ValueChangeListener<String> valueChangeListener) 

Source Link

Document

Constructs a new TextArea with a value change listener.

Usage

From source file:fi.jasoft.qrcode.demo.QRCodeDemo.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//  w  ww  .  j  a v  a  2 s . c o m
    setContent(content);

    Label header = new Label("QR Code Generator");
    header.setStyleName(ValoTheme.LABEL_H2);
    content.addComponent(header);

    HorizontalSplitPanel root = new HorizontalSplitPanel();
    root.setSizeFull();
    root.setSplitPosition(50, Unit.PERCENTAGE);
    root.setLocked(true);

    Panel panel = new Panel(root);
    panel.setSizeFull();
    content.addComponent(panel);
    content.setExpandRatio(panel, 1);

    VerticalLayout first = new VerticalLayout();
    first.setSizeFull();
    root.setFirstComponent(first);

    first.addComponent(
            new HorizontalLayout(createPrimaryColorSelect(), createSecondaryColorSelect(), createSizeSelect()));

    code = new QRCode();
    code.setWidth("100px");
    code.setHeight("100px");

    final TextArea text = new TextArea("Text embedded in QR Code");
    text.setPlaceholder("Type the message of the QR code here");
    text.setSizeFull();
    text.setValueChangeMode(ValueChangeMode.LAZY);
    text.addValueChangeListener(e -> {
        code.setValue(e.getValue());
    });

    first.addComponent(text);
    first.setExpandRatio(text, 1);

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

    vl.addComponent(code);
    vl.setComponentAlignment(code, Alignment.MIDDLE_CENTER);

    root.setSecondComponent(vl);
}

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();/*from   w  ww  .j a v a  2 s  .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: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.jav a2 s .  c  o  m*/
    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.engine.popup.formpopup.AbstractFormPopup.java

License:Open Source License

protected TextArea addTextAeraField(String title, Object propertyId) {
    TextArea f = new TextArea(title);
    f.setId("amapj.popup." + propertyId);
    binder.bind(f, propertyId);/*ww  w .j  av a  2s.co m*/

    f.setNullRepresentation("");
    f.setStyleName(ChameleonTheme.TEXTFIELD_BIG);
    f.setWidth("80%");
    form.addComponent(f);

    return f;
}

From source file:fr.amapj.view.views.advanced.devtools.PopupHtmlToPdf.java

License:Open Source License

private void addFieldSaisie() {
    setStepTitle("Conversion");

    tf = new TextArea("Contenu html");
    tf.setWidth("90%");
    tf.setHeight(10, Unit.CM);//from   w  ww.j ava  2s  . co m
    tf.setImmediate(true);
    form.addComponent(tf);

    StreamResource streamResource = new StreamResource(new PdfResource(tf), "test.pdf");
    streamResource.setCacheTime(1000);

    Link extractFile = new Link("Tlcharger le pdf", streamResource);
    extractFile.setIcon(FontAwesome.DOWNLOAD);
    extractFile.setTargetName("_blank");

    form.addComponent(extractFile);
}

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);/*w ww. jav  a  2  s .c  o 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);//  w  ww . ja 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(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   www . j  ava 2  s .c o  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(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:info.magnolia.messages.app.MessagesViewImpl.java

License:Open Source License

private Field<String> createMessageBodyTextField() {
    final TextArea messageField = new TextArea(i18n.translate("messages-app.app.field.messageBody"));
    messageField.setWidth(100, Unit.PERCENTAGE);
    return messageField;
}

From source file:io.subutai.plugin.accumulo.ui.manager.AddNodeWindow.java

public AddNodeWindow(final Accumulo accumulo, final ExecutorService executorService, final Tracker tracker,
        final AccumuloClusterConfig accumuloClusterConfig, Set<EnvironmentContainerHost> nodes,
        final NodeType nodeType) {
    super("Add New Node");
    setModal(true);/* w w  w .  j  a v  a2 s.c  om*/

    setWidth(650, Unit.PIXELS);
    setHeight(450, Unit.PIXELS);

    GridLayout content = new GridLayout(1, 3);
    content.setSizeFull();
    content.setMargin(true);
    content.setSpacing(true);

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

    content.addComponent(topContent);
    topContent.addComponent(new Label("Nodes:"));

    final ComboBox hadoopNodes = new ComboBox();
    hadoopNodes.setId("HadoopNodesCb");
    hadoopNodes.setImmediate(true);
    hadoopNodes.setTextInputAllowed(false);
    hadoopNodes.setNullSelectionAllowed(false);
    hadoopNodes.setRequired(true);
    hadoopNodes.setWidth(200, Unit.PIXELS);
    for (EnvironmentContainerHost node : nodes) {
        hadoopNodes.addItem(node);
        hadoopNodes.setItemCaption(node, node.getHostname());
    }

    if (nodes.size() == 0) {
        return;
    }
    hadoopNodes.setValue(nodes.iterator().next());

    topContent.addComponent(hadoopNodes);

    final Button addNodeBtn = new Button("Add");
    addNodeBtn.setId("AddSelectedNode");
    topContent.addComponent(addNodeBtn);

    final Button ok = new Button("Ok");

    addNodeBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            addNodeBtn.setEnabled(false);
            ok.setEnabled(false);
            showProgress();
            EnvironmentContainerHost containerHost = (EnvironmentContainerHost) hadoopNodes.getValue();
            final UUID trackID = accumulo.addNode(accumuloClusterConfig.getClusterName(),
                    containerHost.getHostname(), nodeType);
            executorService.execute(new Runnable() {
                public void run() {
                    while (track) {
                        TrackerOperationView po = tracker.getTrackerOperation(AccumuloClusterConfig.PRODUCT_KEY,
                                trackID);
                        if (po != null) {
                            setOutput(po.getDescription() + "\nState: " + po.getState() + "\nLogs:\n"
                                    + po.getLog());
                            if (po.getState() != OperationState.RUNNING) {
                                hideProgress();
                                ok.setEnabled(true);
                                break;
                            }
                        } else {
                            setOutput("Product operation not found. Check logs");
                            break;
                        }
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException ex) {
                            break;
                        }
                    }
                }
            });
        }
    });

    outputTxtArea = new TextArea("Operation output");
    outputTxtArea.setId("outputTxtArea");
    outputTxtArea.setRows(13);
    outputTxtArea.setColumns(43);
    outputTxtArea.setImmediate(true);
    outputTxtArea.setWordwrap(true);

    content.addComponent(outputTxtArea);

    indicator = new Label();
    indicator.setId("indicator");
    indicator.setIcon(new ThemeResource("img/spinner.gif"));
    indicator.setContentMode(ContentMode.HTML);
    indicator.setHeight(11, Unit.PIXELS);
    indicator.setWidth(50, Unit.PIXELS);
    indicator.setVisible(false);

    ok.setId("btnOk");
    ok.setStyleName("default");
    ok.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            //close window
            track = false;
            close();
        }
    });

    HorizontalLayout bottomContent = new HorizontalLayout();
    bottomContent.addComponent(indicator);
    bottomContent.setComponentAlignment(indicator, Alignment.MIDDLE_RIGHT);
    bottomContent.addComponent(ok);

    content.addComponent(bottomContent);
    content.setComponentAlignment(bottomContent, Alignment.MIDDLE_RIGHT);

    setContent(content);
}