Example usage for com.vaadin.ui TextArea setValueChangeMode

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

Introduction

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

Prototype

@Override
    public void setValueChangeMode(ValueChangeMode mode) 

Source Link

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();/*  www  . j  av  a 2 s. com*/
    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);
}