Package com.vaadin.ui

Examples of com.vaadin.ui.TextArea


    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        final TextArea message = new TextArea("",
                "The system is going down for maintenance in 10 minutes");
        layout.addComponent(message);

        final Button button = new Button("Broadcast");
        layout.addComponent(button);
        button.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Broadcaster.broadcast(message.getValue());
            }
        });

        // Register broadcast listener
        Broadcaster.register(this);
View Full Code Here


        Label hello = new Label(
                "<span class='hello'>Hello</span> <span class='world'>world</span>",
                ContentMode.HTML);
        addComponent(hello);

        final TextArea cssToInject = new TextArea();
        cssToInject.setImmediate(true);
        addComponent(cssToInject);

        Button inject = new Button("Inject!", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                stylesheet.add(cssToInject.getValue());
                cssToInject.setValue("");
            }
        });
        addComponent(inject);

        Button injectRandom = new Button("Inject as resource!",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {

                        final String css = cssToInject.getValue();

                        stylesheet.add(new StreamResource(
                                new StreamResource.StreamSource() {

                                    @Override
                                    public InputStream getStream() {
                                        return new ByteArrayInputStream(css
                                                .getBytes());
                                    }
                                }, UUID.randomUUID().toString() + ".css"));

                        cssToInject.setValue("");
                    }
                });
        addComponent(injectRandom);

        addComponent(new Button("Inject initial again!",
View Full Code Here

@Push
public class SendMultibyteCharacters extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        TextArea textArea = new TextArea();
        textArea.setImmediate(true);

        addComponent(textArea);
    }
View Full Code Here

        // ol.setWidth("500px");
        ol.setMargin(true);
        ol.setSpacing(true);
        ol.setWidth("");
        ol.setCaption("Dynamic width and dynamic height");
        TextArea tf;

        tf = new TextArea("100% high TextField");
        tf.setCaption(null);
        tf.setRequired(true);
        tf.setValue("100% high Field");
        tf.setHeight("100%");
        tf.setWidth("100px");
        tf.setRows(2);
        ol.addComponent(tf);

        tf = new TextArea("100% high TextField");
        tf.setCaption("100% high TextField");
        tf.setRequired(true);
        tf.setValue("100% high Field");
        tf.setHeight("100%");
        tf.setWidth("100px");
        tf.setRows(2);
        ol.addComponent(tf);

        for (int i = 1; i < 4; i++) {
            int w = i * 100;
            tf = new TextArea("Field " + i);
            tf.setRows(2);
            tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
                    + valignName[i % 3]);
            tf.setWidth(w + "px");
            tf.setHeight(w + "px");
            ol.addComponent(tf);
            if (i % 3 == 0) {
                ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
            } else if (i % 3 == 1) {
                ol.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
            } else {
                ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
            }

        }

        tf = new TextArea("100% high TextField");
        tf.setValue("100% high 100px wide");
        tf.setRows(2);
        tf.setHeight("100%");
        tf.setWidth("100px");
        ol.addComponent(tf);
        return ol;
    }
View Full Code Here

        // ol.setWidth("");
        ol.setCaption("Fixed width (" + ol.getWidth()
                + "px) and fixed height (" + ol.getHeight()
                + "px) / layout_field_100pct_button_field");
        TextArea tf;

        tf = new TextArea("300px x 300px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("300x300 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_LEFT);

        Button b;
        b = new Button("This is a 100%x50% valign middle button");
        b.setSizeFull();
        b.setHeight("50%");
        ol.addComponent(b);
        ol.setExpandRatio(b, 1.0f);
        ol.setComponentAlignment(b, Alignment.MIDDLE_RIGHT);

        tf = new TextArea("300px x 300px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("300x300 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
        return ol;
    }
View Full Code Here

        // ol.setWidth("");
        ol.setCaption("Fixed width (" + ol.getWidth()
                + "px) and fixed height (" + ol.getHeight()
                + "px) / layout_basic_test");
        TextArea tf;

        tf = new TextArea("300px x 300px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("300x300 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_LEFT);

        // Button b;
        // b = new Button("This is a 100%x50% valign middle button");
        // b.setSizeFull();
        // b.setHeight("50%");
        // ol.addComponent(b, 1.0f);
        // ol.setComponentAlignment(b, AlignmentHandler.ALIGNMENT_RIGHT,
        // AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);

        tf = new TextArea("300px x 300px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("300x300 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
        return ol;
    }
View Full Code Here

        // ol.setWidth("");
        ol.setCaption("Fixed width (" + ol.getWidth()
                + "px) and fixed height (" + ol.getHeight()
                + "px) / layout_symmetric_fields");
        TextArea tf;

        tf = new TextArea("300px x 300px Field");
        tf.setValue("300x300 field");
        tf.setRows(2);
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_LEFT);

        tf = new TextArea("300px x 300px Field");
        tf.setValue("300x300 field");
        tf.setRows(2);
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.MIDDLE_CENTER);

        tf = new TextArea("300px x 300px Field");
        tf.setValue("300x300 field");
        tf.setRows(2);
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);

        return ol;
    }
View Full Code Here

        // ol.setWidth("");
        ol.setCaption("Fixed width (" + ol.getWidth()
                + "px) and fixed height (" + ol.getHeight()
                + "px) / layout_leftAndRight");
        TextArea tf;

        // tf = new TextField("100%x100% Field");
        // tf.setCaption(null);
        // tf.setValue("100% x 100% TextField");
        // tf.setSizeFull();
        // tf.setRequired(true);
        // // tf.setComponentError(new UserError("It's broken!"));
        //
        // // tf.setHeight("100%");
        // // tf.setWidth("100px");
        // tf.setRows(2);
        // ol.addComponent(tf);
        //
        // for (int i = 1; i < 5; i++) {
        // int w = i * 100;
        // tf = new TextField("Caption field " + i);
        // tf.setRows(2);
        // tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
        // + valignName[i % 3]);
        // tf.setWidth(w + "px");
        // tf.setHeight(w + "px");
        // ol.addComponent(tf);
        // ol.setComponentAlignment(tf,
        // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, valign[i % 3]);
        // }
        //
        // tf.setValue(tf.getValue().toString() + " (100% wide)");
        // tf.setWidth("100%");

        // tf = new TextField("100%x70px Field");
        // tf.setCaption(null);
        // tf.setRequired(true);
        // // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        // tf.setComponentError(new UserError("abc"));
        // tf.setValue("100% high 70px wide TextField");
        // tf.setRows(2);
        // // tf.setSizeFull();
        // tf.setHeight("100%");
        // tf.setWidth("70px");
        // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
        // AlignmentHandler.ALIGNMENT_TOP);
        // ol.addComponent(tf);

        tf = new TextArea("300px x 300px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("300x300 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_LEFT);

        tf = new TextArea("300px x 300px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("300x300 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("300px");
        tf.setWidth("300px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
        return ol;
    }
View Full Code Here

        ol.setSpacing(true);

        // ol.setWidth("");
        ol.setCaption("Filled with fixed width (" + ol.getWidth()
                + "px) and fixed height (" + ol.getHeight() + "px)");
        TextArea tf;

        tf = new TextArea("60%x100% Field");
        tf.setCaption("This one has a caption");
        tf.setValue("60% x 100% TextField");
        tf.setWidth("100%");
        tf.setHeight("100%");
        tf.setRequired(true);
        // tf.setComponentError(new UserError("It's broken!"));

        // tf.setHeight("100%");
        // tf.setWidth("100px");
        tf.setRows(2);
        ol.addComponent(tf);
        ol.setExpandRatio(tf, 1f);
        //

        tf = new TextArea("60%x60% Field");
        tf.setCaption(null);
        tf.setValue("60% x 60% TextField");
        tf.setWidth("100%");
        tf.setHeight("60%");
        tf.setRequired(true);
        ol.addComponent(tf);
        ol.setExpandRatio(tf, 1f);
        ol.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);
        // tf.setComponentError(new UserError("It's broken!"));

        // tf.setHeight("100%");
        // tf.setWidth("100px");
        tf.setRows(2);
        //
        // for (int i = 1; i < 5; i++) {
        // int w = i * 100;
        // tf = new TextField("Caption field " + i);
        // tf.setRows(2);
        // tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
        // + valignName[i % 3]);
        // tf.setWidth(w + "px");
        // tf.setHeight(w + "px");
        // ol.addComponent(tf);
        // ol.setComponentAlignment(tf,
        // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, valign[i % 3]);
        // }
        //
        // tf.setValue(tf.getValue().toString() + " (100% wide)");
        // tf.setWidth("100%");

        // tf = new TextField("100%x70px Field");
        // tf.setCaption(null);
        // tf.setRequired(true);
        // // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        // tf.setComponentError(new UserError("abc"));
        // tf.setValue("100% high 70px wide TextField");
        // tf.setRows(2);
        // // tf.setSizeFull();
        // tf.setHeight("100%");
        // tf.setWidth("70px");
        // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
        // AlignmentHandler.ALIGNMENT_TOP);
        // ol.addComponent(tf);

        tf = new TextArea("200px x 200px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("200x200 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("200px");
        tf.setWidth("200px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.TOP_LEFT);

        tf = new TextArea("200px x 200px Field");
        // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
        tf.setValue("200x200 field");
        tf.setRows(2);
        // tf.setSizeFull();
        tf.setHeight("200px");
        tf.setWidth("200px");
        ol.addComponent(tf);
        ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
        return ol;
    }
View Full Code Here

        button = new Button("Button, enabled");
        nativeButton = new NativeButton("NativeButton, enabled");
        textField = new TextField("TextField with caption and value, enabled");
        textField.setValue("Text");
        textArea = new TextArea("TextArea with caption and value, enabled");
        textArea.setValue("Text");
        layout = new VerticalLayout();
        layout.setCaption("VerticalLayout, enabled");
        layout.addComponent(button);
        layout.addComponent(nativeButton);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.TextArea

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.