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:org.rdflivenews.annotator.gui.AnnotatorGuiApplication.java

License:Apache License

@Override
public void init() {
    setMainWindow(main);//from w w w . ja v a  2  s .co  m
    setTheme("mytheme");

    if (!patterns.isEmpty()) {

        mainLayout.removeAllComponents();
        main.removeAllComponents();

        this.pattern = patterns.remove(0);
        this.writeTodoPatterns();

        GridLayout grid = new GridLayout(4, 6);
        grid.setSpacing(true);

        HorizontalLayout labels = new HorizontalLayout();
        labels.setSizeFull();

        subject = new Label("<span style=\"font-size:130%\">" + this.pattern.entityOne + "</span>");
        subject.setContentMode(Label.CONTENT_XHTML);
        subject.setSizeFull();
        patternLabel = new Label("<span style=\"font-size:130%;color:red;\">" + this.pattern.nlr + "</span>");
        patternLabel.setContentMode(Label.CONTENT_XHTML);
        patternLabel.setSizeFull();
        patternLabel.setStyleName("center");
        object = new Label(
                "<span style=\"font-size:130%;text-align:right;\">" + this.pattern.entityTwo + "</span>");
        object.setContentMode(Label.CONTENT_XHTML);
        object.setSizeFull();
        object.setStyleName("right");

        String sentenceLabel = "<a href=\"" + this.pattern.url + "\">" + "<span style=\"font-size:130%\">"
                + this.pattern.sentence
                        .replace(this.pattern.entityOne,
                                "<span style=\"font-weight:bold\">" + this.pattern.entityOne + "</span>")
                        .replace(this.pattern.entityTwo,
                                "<span style=\"font-weight:bold\">" + this.pattern.entityTwo + "</span>")
                        .replace(this.pattern.nlr, "<span style=\"color:red\">" + this.pattern.nlr + "</span>")
                + "</span></a>";

        sentence = new Label(sentenceLabel);
        sentence.setContentMode(Label.CONTENT_XHTML);

        grid.addComponent(sentence, 0, 0, 3, 0);
        labels.addComponent(subject);
        labels.addComponent(patternLabel);
        labels.addComponent(object);
        //            grid.addComponent(subject, 0, 1);
        //            grid.addComponent(patternLabel, 1, 1, 2, 1);
        //            grid.addComponent(object, 3, 1);
        labels.setComponentAlignment(subject, Alignment.MIDDLE_LEFT);
        labels.setComponentAlignment(patternLabel, Alignment.MIDDLE_CENTER);
        labels.setComponentAlignment(object, Alignment.MIDDLE_RIGHT);
        grid.addComponent(labels, 0, 1, 3, 1);

        AutocompleteWidget subject = new AutocompleteWidget(index);
        subject.addSelectionListener(new SelectionListener() {

            @Override
            public void itemSelected(SolrItem item) {
                subjectUri.setValue(item.getUri());
            }
        });
        grid.addComponent(subject, 0, 2, 1, 2);
        AutocompleteWidget object = new AutocompleteWidget(index);
        object.addSelectionListener(new SelectionListener() {

            @Override
            public void itemSelected(SolrItem item) {
                objectUri.setValue(item.getUri());
            }
        });
        grid.addComponent(object, 2, 2, 3, 2);

        saidObject = new TextArea("Say Cluster Object Value");
        saidObject.setWidth("100%");
        grid.addComponent(saidObject, 0, 5, 1, 5);

        comment = new TextArea("Comments");
        comment.setWidth("100%");
        grid.addComponent(comment, 2, 5, 3, 5);

        HorizontalLayout urisAndCluster = new HorizontalLayout();
        subjectUri = new TextField("Subject URI");
        objectUri = new TextField("Object URI");
        subjectUri.setSizeFull();
        objectUri.setSizeFull();

        //cluster category combobox
        clusterCategoriesBox = new ComboBox();
        clusterCategoriesBox.setWidth("40%");
        clusterCategoriesBox.setCaption("Cluster Category");
        clusterCategoriesBox.addContainerProperty("name", String.class, null);
        clusterCategoriesBox.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM);
        for (ClusterCategory cat : ClusterCategory.values()) {
            clusterCategoriesBox.addItem(cat).getItemProperty("name").setValue(cat.getName());
        }
        clusterCategoriesBox.setImmediate(true);
        clusterCategoriesBox.setValue(ClusterCategory.UNKNOWN);
        clusterCategoriesBox.setNullSelectionAllowed(false);

        urisAndCluster.setSizeFull();
        urisAndCluster.addComponent(subjectUri);
        urisAndCluster.addComponent(clusterCategoriesBox);
        urisAndCluster.addComponent(objectUri);
        urisAndCluster.setComponentAlignment(subjectUri, Alignment.MIDDLE_LEFT);
        urisAndCluster.setComponentAlignment(clusterCategoriesBox, Alignment.MIDDLE_CENTER);
        urisAndCluster.setComponentAlignment(objectUri, Alignment.MIDDLE_RIGHT);

        grid.addComponent(urisAndCluster, 0, 3, 3, 3);

        //            grid.addComponent(clusterCategoriesBox, 1, 3, 2, 3);
        //            grid.setComponentAlignment(clusterCategoriesBox, Alignment.BOTTOM_CENTER);

        mainLayout.addComponent(grid);

        HorizontalLayout submitButtonslayout = new HorizontalLayout();

        nextButton = new NativeButton("Next");
        trashButton = new NativeButton("Trash");
        stopButton = new NativeButton("Stop");
        nextButton.addListener(this);
        trashButton.addListener(this);
        stopButton.addListener(this);
        submitButtonslayout.setSpacing(true);
        submitButtonslayout.setWidth("100%");
        submitButtonslayout.addComponent(trashButton);
        submitButtonslayout.addComponent(stopButton);
        submitButtonslayout.addComponent(nextButton);
        submitButtonslayout.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);
        submitButtonslayout.setComponentAlignment(stopButton, Alignment.MIDDLE_RIGHT);

        mainLayout.addComponent(submitButtonslayout);
        mainLayout.setSpacing(true);
        mainLayout.setWidth(null);
        mainLayout.setHeight("100%");
        Panel panel = new Panel();
        panel.setWidth(null);
        panel.addComponent(mainLayout);

        main.addComponent(panel);
        ((VerticalLayout) main.getContent()).setHeight("100%");
        ((VerticalLayout) main.getContent()).setComponentAlignment(panel, Alignment.MIDDLE_CENTER);

        //force URI search with given labels
        subject.setSearchTerm(this.pattern.entityOne);
        object.setSearchTerm(this.pattern.entityTwo);
    } else
        getMainWindow().showNotification("No patterns anymore...");

}

From source file:org.s23m.cell.editor.semanticdomain.ui.components.MultitabPanel.java

License:Mozilla Public License

public MultitabPanel(final Editor application) {
    this.application = application;
    this.consoleText = new TextArea("Semantic Error Console");
    setWidth(RESULTS_PANEL_WIDTH);/*from   w ww  .  j a  v  a2s .c  o m*/
    setHeight(RESULTS_PANEL_HEIGHT);
    createMultitabPanel();
    createConsolePanel();
    changeSupport = new PropertyChangeSupport(this);
    changeSupport.addPropertyChangeListener(EditorController.getInstance());
}

From source file:org.semanticsoft.vaaclipse.p2.install.ui.impl.LoadExplorRepositoryView.java

License:Open Source License

@Override
public void initUI() {
    // TODO Auto-generated method stub

    mainLayout.setWidth("600px");
    mainLayout.setHeight("450px");
    textArea = new TextArea("Error Message");
    getiRepositoryLoader().setiRepositoryExplorer(getiRepositoryExplorer());

    mainLayout.addComponent((Component) getiRepositoryLoader().getUIComponent());
    mainLayout.addComponent((Component) getiRepositoryExplorer().getUIComponent());
    textArea.setSizeFull();/*  w  ww . j a  v  a  2  s.  co m*/
    mainLayout.addComponent(textArea);

}

From source file:pl.exsio.ca.module.terrain.evidence.AssignmentsDataTable.java

License:Open Source License

private TextArea getCommentField(EntityItem<? extends TerrainAssignment> item) {
    TextArea comment = new TextArea(t("comment"));
    comment.setPropertyDataSource(item.getItemProperty("comment"));
    comment.setNullRepresentation("");
    return comment;
}

From source file:pl.exsio.ca.module.terrain.evidence.FilesDataTable.java

License:Open Source License

private TextArea getDescriptionField(EntityItem<? extends TerrainFile> item) {
    TextArea desc = new TextArea(t("decription"));
    desc.setPropertyDataSource(item.getItemProperty("description"));
    desc.setNullRepresentation("");
    return desc;//from   w  w  w.ja va  2 s  . co  m
}

From source file:pl.exsio.ca.module.terrain.evidence.NotesDataTable.java

License:Open Source License

private TextArea getContentField(EntityItem<? extends TerrainNote> item) {
    TextArea desc = new TextArea(t("content"));
    desc.setPropertyDataSource(item.getItemProperty("content"));
    desc.setNullRepresentation("");
    return desc;// w  w  w .  j  a va  2 s.  com
}

From source file:pl.exsio.ca.module.terrain.evidence.NotificationsDataTable.java

License:Open Source License

private TextArea getCommentField(EntityItem<? extends TerrainNotification> item) {
    TextArea comment = new TextArea(t("comment"));
    comment.setPropertyDataSource(item.getItemProperty("comment"));
    comment.setNullRepresentation("");
    return comment;
}

From source file:rs.pupin.jpo.validation.gui.constraints.FailedQueryWindow.java

@Override
public void attach() {
    super.attach();
    String message = (query2 == null) ? messageSingleQuery : messageDoubleQuery;
    Label lbl = new Label(message);
    lbl.setWidth("95%");
    layout.addComponent(lbl);//  w ww. j a v  a  2 s .  c om
    layout.setExpandRatio(lbl, 0.0f);

    String textAreaCaption = (query2 != null) ? "First Query" : "Query";
    TextArea textArea = new TextArea(textAreaCaption);
    textArea.setValue(query1);
    textArea.setReadOnly(true);
    textArea.setSizeFull();
    layout.addComponent(textArea);
    layout.setExpandRatio(textArea, 2.0f);

    if (query2 != null) {
        TextArea textArea2 = new TextArea("Second Query");
        textArea2.setValue(query2);
        textArea2.setReadOnly(true);
        textArea2.setSizeFull();
        layout.addComponent(textArea2);
        layout.setExpandRatio(textArea2, 2.0f);
    }

    center();
}

From source file:ru.codeinside.adm.ui.LogSettings.java

License:Mozilla Public License

LogSettings() {

    logErrors = new OptionGroup("? ? :", Arrays.asList(Status.FAILURE.name()));
    logErrors.setItemCaption(Status.FAILURE.name(), "");
    logErrors.setImmediate(true);/*from  w  w  w  .  j av  a 2 s.co  m*/
    logErrors.setMultiSelect(true);

    logStatus = new OptionGroup("?  ?  '':", statusKeys());
    logStatus.setItemCaption(Status.REQUEST.name(), "?");
    logStatus.setItemCaption(Status.RESULT.name(), "");
    logStatus.setItemCaption(Status.PING.name(), "?");
    logStatus.setMultiSelect(true);
    logStatus.setImmediate(true);

    ipSet = new TextArea("? IP ?:");
    ipSet.setWordwrap(true);
    ipSet.setNullRepresentation("");
    ipSet.setWidth(100f, UNITS_PERCENTAGE);
    ipSet.setRows(10);

    tf = new TextField(" , :");
    tf.setRequired(true);
    tf.addValidator(new Validator() {
        public void validate(Object value) throws InvalidValueException {
            if (!isValid(value)) {
                throw new InvalidValueException(
                        "  ? ");
            }
        }

        public boolean isValid(Object value) {
            return value instanceof String && ((String) value).matches("[1-9][0-9]*");
        }
    });

    b1 = new Block("") {

        @Override
        void onLayout(Layout layout) {
            layout.addComponent(logErrors);
            layout.addComponent(logStatus);
        }

        @Override
        void onChange() {
            logErrors.setReadOnly(false);
            logStatus.setReadOnly(false);
        }

        @Override
        void onRefresh() {
            boolean _logErrors = AdminServiceProvider.getBoolProperty(API.LOG_ERRORS);
            if (_logErrors) {
                logErrors.setReadOnly(false);
                logErrors.setValue(Arrays.asList(Status.FAILURE.name()));
            } else {
                logErrors.setValue(Collections.emptySet());
            }
            logErrors.setReadOnly(true);

            String _logStatus = AdminServiceProvider.get().getSystemProperty(API.LOG_STATUS);
            if (_logStatus != null) {
                Set<String> set = new HashSet<String>();
                for (String key : statusKeys()) {
                    if (_logStatus.contains(key)) {
                        set.add(key);
                    }
                }
                logStatus.setReadOnly(false);
                logStatus.setValue(set);
            } else {
                logStatus.setValue(Collections.emptySet());
            }
            logStatus.setReadOnly(true);
        }

        @Override
        void onApply() {
            Collection logErrorsValue = (Collection) logErrors.getValue();
            boolean errorsEnabled = logErrorsValue.contains(Status.FAILURE.name());
            AdminServiceProvider.get().saveSystemProperty(API.LOG_ERRORS, Boolean.toString(errorsEnabled));
            LogCustomizer.setShouldWriteServerLogErrors(errorsEnabled);

            Collection logStatusValue = (Collection) logStatus.getValue();

            Set<Status> statuses = new TreeSet<Status>();

            if (logStatusValue.contains(Status.REQUEST.name())) {
                statuses.add(Status.REQUEST);
                statuses.add(Status.ACCEPT);
                statuses.add(Status.CANCEL);
            }

            if (logStatusValue.contains(Status.RESULT.name())) {
                statuses.add(Status.RESULT);
                statuses.add(Status.REJECT);
                statuses.add(Status.STATE);
                statuses.add(Status.NOTIFY);
            }

            if (logStatusValue.contains(Status.PING.name())) {
                statuses.add(Status.PING);
                statuses.add(Status.PROCESS);
                statuses.add(Status.PACKET);
            }

            StringBuilder statusBuilder = new StringBuilder();
            for (Status status : statuses) {
                if (statusBuilder.length() > 0) {
                    statusBuilder.append(", ");
                }
                statusBuilder.append(status);
            }
            String status = statusBuilder.toString();

            AdminServiceProvider.get().saveSystemProperty(API.LOG_STATUS, status);
            LogCustomizer.setServerLogStatus(status);

            boolean enabled = !status.isEmpty();
            LogCustomizer.setShouldWriteServerLog(enabled);
            AdminServiceProvider.get().saveSystemProperty(API.ENABLE_CLIENT_LOG, Boolean.toString(enabled));
        }
    };

    b2 = new Block("? ") {
        @Override
        void onLayout(Layout layout) {
            layout.addComponent(ipSet);
        }

        @Override
        void onRefresh() {
            String ips = AdminServiceProvider.get().getSystemProperty(API.SKIP_LOG_IPS);
            ipSet.setReadOnly(false);
            ipSet.setValue(ips);
            ipSet.setReadOnly(true);
        }

        @Override
        void onChange() {
            ipSet.setReadOnly(false);
        }

        @Override
        void onApply() {
            String value = (String) ipSet.getValue();
            TreeSet<String> items = new TreeSet<String>();
            if (value != null) {
                for (String item : value.split("[,;\\s]+")) {
                    items.add(item);
                }
                StringBuilder sb = new StringBuilder();
                for (String item : items) {
                    if (sb.length() > 0) {
                        sb.append(", ");
                    }
                    sb.append(item);
                }
                value = sb.toString();
            }
            AdminServiceProvider.get().saveSystemProperty(API.SKIP_LOG_IPS, value);
            LogCustomizer.setIgnoreSet(items);
        }
    };

    b3 = new Block("?   ") {
        @Override
        void onButtons(Layout layout) {
            layout.addComponent(new Button("? ", new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    LogScheduler.cleanLog();
                    getWindow().showNotification("?? ",
                            Window.Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }));
        }

        @Override
        void onLayout(Layout layout) {
            layout.addComponent(tf);
        }

        @Override
        void onRefresh() {
            String logDepth = AdminServiceProvider.get().getSystemProperty(API.LOG_DEPTH);
            tf.setReadOnly(false);
            if (logDepth != null && logDepth.matches("[1-9][0-9]*")) {
                tf.setValue(logDepth);
            } else {
                tf.setValue(String.valueOf(API.DEFAULT_LOG_DEPTH));
            }
            tf.setReadOnly(true);
        }

        @Override
        void onChange() {
            tf.setReadOnly(false);
        }

        @Override
        void onApply() {
            tf.validate();
            AdminServiceProvider.get().saveSystemProperty(API.LOG_DEPTH, tf.getValue().toString());
        }
    };

    final CheckBox logSpSign = new CheckBox(" ? ");
    logSpSign.setValue(Boolean.valueOf(AdminServiceProvider.get().getSystemProperty(API.LOG_SP_SIGN)));
    logSpSign.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            AdminServiceProvider.get().saveSystemProperty(API.LOG_SP_SIGN,
                    String.valueOf(valueChangeEvent.getProperty().getValue()));
            notifySuccess();
        }
    });
    logSpSign.setImmediate(true);

    final CheckBox logOvSign = new CheckBox(" ? ");
    logOvSign.setValue(Boolean.valueOf(AdminServiceProvider.get().getSystemProperty(API.LOG_OV_SIGN)));
    logOvSign.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            AdminServiceProvider.get().saveSystemProperty(API.LOG_OV_SIGN,
                    String.valueOf(valueChangeEvent.getProperty().getValue()));
            notifySuccess();
        }
    });
    logOvSign.setImmediate(true);

    Label userSignsLabel = new Label("? ?");
    userSignsLabel.addStyleName(Reindeer.LABEL_H2);

    VerticalLayout userSignsVl = new VerticalLayout();
    userSignsVl.setMargin(true);
    userSignsVl.setSpacing(true);
    userSignsVl.addComponent(userSignsLabel);
    userSignsVl.addComponent(logSpSign);
    userSignsVl.addComponent(logOvSign);

    Panel userSingsWrapper = new Panel();
    userSingsWrapper.setScrollable(true);
    userSingsWrapper.setContent(userSignsVl);
    userSingsWrapper.setSizeFull();

    VerticalLayout vl = new VerticalLayout();
    vl.addComponent(b1);
    vl.addComponent(userSingsWrapper);
    vl.setExpandRatio(b1, 0.7f);
    vl.setExpandRatio(userSingsWrapper, 0.3f);
    vl.setSizeFull();

    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);
    layout.addComponent(vl);
    layout.addComponent(b2);
    layout.addComponent(b3);
    layout.setSizeFull();
    layout.setExpandRatio(vl, 0.333f);
    layout.setExpandRatio(b2, 0.333f);
    layout.setExpandRatio(b3, 0.333f);

    Panel wrapper = new Panel(" ", layout);
    wrapper.addStyleName(Reindeer.PANEL_LIGHT);
    wrapper.setSizeFull();

    setCompositionRoot(wrapper);
    setSizeFull();
}

From source file:ru.codeinside.gses.apservice.ApServiceForm.java

License:Mozilla Public License

private Form createForm() {
    final Form form = new Form();
    form.setCaption(" ?");
    form.setWidth("100%");

    TextArea field = new TextArea("?");
    field.setRequired(true);//from   w w  w  .j  a  v  a 2 s. c  o  m
    field.setWidth("100%");
    field.setMaxLength(1500);
    form.addField(NAME, field);

    MaskedTextField code = new MaskedTextField("  ?", "# ### ### ### ### ### ###");
    code.setColumns(19);
    code.addValidator(new FilteredLongValidator("[_ ]",
            "     " + ApInfo.formatCode(Long.MAX_VALUE)));
    form.addField(CODE, code);

    ListSelect declarantTypes = new ListSelect(" ?");
    declarantTypes.setWidth("100%");
    declarantTypes.setHeight("50px");
    declarantTypes.setMultiSelect(true);
    LazyQueryContainer container = new LazyQueryContainer(new DeclarantTypeQueryDefinition(),
            new DeclarantTypeQueryFactory());
    declarantTypes.setContainerDataSource(container);
    declarantTypes.setItemCaptionPropertyId("value");
    declarantTypes.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
    Flash.bind(DeclarantTypeChanged.class, container, "refresh");

    field.setRequired(true);
    field.setWidth("100%");
    field.setMaxLength(1500);
    form.addField(DeclarantServiceImpl.DECLARANT_TYPES, declarantTypes);

    Layout footer = form.getFooter();
    Button updateButton = createCreateButton();
    footer.addComponent(updateButton);
    ((HorizontalLayout) footer).setSpacing(true);
    return form;
}