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.activiti.editor.ui.CopyModelPopupWindow.java

License:Apache License

protected void addFields() {
    form = new Form();
    form.setCaption(i18nManager.getMessage(Messages.PROCESS_COPY_POPUP_CAPTION));
    form.getLayout().setMargin(true);/*  w w w .  j a  va  2 s .  co  m*/

    nameTextField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
    nameTextField.setWidth(20, Sizeable.UNITS_EM);
    nameTextField.setRequired(true);
    nameTextField.setValue(modelData.getName());
    form.getLayout().addComponent(nameTextField);
    nameTextField.focus();

    descriptionTextArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
    descriptionTextArea.setRows(8);
    descriptionTextArea.setWidth(20, Sizeable.UNITS_EM);
    form.getLayout().addComponent(descriptionTextArea);

    addComponent(form);

    // Some empty space
    Label emptySpace = new Label("&nbsp;", Label.CONTENT_XHTML);
    addComponent(emptySpace);
}

From source file:org.activiti.explorer.ui.form.TextAreaFormPropertyRenderer.java

License:Apache License

@Override
public Field getPropertyField(FormProperty formProperty) {
    TextArea textArea = new TextArea(getPropertyLabel(formProperty));
    textArea.setRequired(formProperty.isRequired());
    textArea.setEnabled(formProperty.isWritable());
    textArea.setRows(10);//w  w  w. jav  a  2  s.  c o  m
    textArea.setColumns(40);
    textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
    if (formProperty.getValue() != null) {
        textArea.setValue(formProperty.getValue());
    }
    return textArea;
}

From source file:org.activiti.explorer.ui.task.NewCasePopupWindow.java

License:Apache License

protected void initForm() {
    form = new Form();
    form.setValidationVisibleOnCommit(true);
    form.setImmediate(true);/* w w  w . j  a  v  a 2s.  c  o  m*/
    addComponent(form);

    // name
    nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
    nameField.focus();
    nameField.setRequired(true);
    nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED));
    form.addField("name", nameField);

    // description
    descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
    descriptionArea.setColumns(25);
    form.addField("description", descriptionArea);

    // duedate
    dueDateField = new DateField(i18nManager.getMessage(Messages.TASK_DUEDATE));
    dueDateField.setResolution(DateField.RESOLUTION_DAY);
    form.addField("duedate", dueDateField);

    // priority
    priorityComboBox = new PriorityComboBox(i18nManager);
    form.addField("priority", priorityComboBox);
}

From source file:org.apache.tamaya.ui.views.AbstractTextInfoProvider.java

License:Apache License

@Override
public void addSystemInfo(Accordion systemInfoPanel) {
    VerticalLayout layout = new VerticalLayout();
    textArea = new TextArea("System Info");
    textArea.addStyleName(UIConstants.FIXED_FONT);
    textArea.setValue(getInfo());//from   w  w  w. j av  a2 s  .c  o  m
    textArea.setRows(20);
    textArea.setHeight("400px");
    textArea.setWidth("100%");
    layout.addComponents(textArea);
    systemInfoPanel.addTab(layout, getCaption());
}

From source file:org.apache.tamaya.ui.views.AbstractTextInfoProvider.java

License:Apache License

@Override
public void updateSystemInfo(Accordion systemInfoPanel) {
    if (textArea != null) {
        textArea.setValue(getInfo());//w  w  w  . j  a v  a2 s  . c  om
    } else {
        textArea = new TextArea("System Info");
        textArea.setValue(getInfo());
        textArea.setSizeFull();
        systemInfoPanel.addTab(textArea, textArea.getCaption());
    }
}

From source file:org.apache.usergrid.chop.webapp.view.log.LogLayout.java

License:Apache License

private void addLogArea() {
    logArea = new TextArea("Coordinator Logs");

    // TODO make this file point configurable
    file = new File("/var/log/chop-webapp.log");
    try {/*from www.ja  v  a 2s.  c  om*/
        r = new RandomAccessFile(file, "r");
    } catch (FileNotFoundException e) {
        LOG.error("Error while accessing file {}: {}", file, e);
    }
    logArea.setHeight("100%");
    logArea.setWidth("100%");
    getApplicationLog();
    addComponent(logArea);
    this.setComponentAlignment(logArea, Alignment.TOP_CENTER);
    this.setExpandRatio(logArea, 0.95f);
}

From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java

License:Apache License

public static TextArea addTextArea(AbsoluteLayout parent, String caption, String position, String width,
        String height, boolean readOnly) {

    TextArea textArea = new TextArea(caption);
    textArea.setWidth(width);//from  w ww  . jav  a  2  s  .  c om
    textArea.setHeight(height);
    textArea.setWordwrap(false);
    textArea.setReadOnly(readOnly);

    parent.addComponent(textArea, position);

    return textArea;
}

From source file:org.bpmnwithactiviti.explorer.form.TextAreaFormPropertyRenderer.java

License:Apache License

@Override
public Field getPropertyField(FormProperty formProperty) {
    TextArea textArea = new TextArea(getPropertyLabel(formProperty));
    textArea.setRequired(formProperty.isRequired());
    textArea.setEnabled(formProperty.isWritable());
    textArea.setRows(10);//from   w  ww .  ja v  a2 s .  co m
    textArea.setColumns(50);
    textArea.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));

    if (formProperty.getValue() != null) {
        textArea.setValue(formProperty.getValue());
    }

    return textArea;
}

From source file:org.bubblecloud.ilves.comment.CommentAddComponent.java

License:Open Source License

/**
 * The default constructor which instantiates Vaadin
 * component hierarchy.//  w w w  .  j av a  2  s.c o m
 */
public CommentAddComponent() {

    final User user = DefaultSiteUI.getSecurityProvider().getUserFromSession();

    final String contextPath = VaadinService.getCurrentRequest().getContextPath();
    final Site site = Site.getCurrent();

    final Company company = site.getSiteContext().getObject(Company.class);
    final EntityManager entityManager = site.getSiteContext().getObject(EntityManager.class);

    final Panel panel = new Panel(site.localize("panel-add-comment"));
    setCompositionRoot(panel);

    final VerticalLayout mainLayout = new VerticalLayout();
    panel.setContent(mainLayout);
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);

    final TextArea commentMessageField = new TextArea(site.localize("field-comment-message"));
    mainLayout.addComponent(commentMessageField);
    commentMessageField.setWidth(100, Unit.PERCENTAGE);
    commentMessageField.setRows(3);
    commentMessageField.setMaxLength(255);

    final Button addCommentButton = new Button(site.localize("button-add-comment"));
    mainLayout.addComponent(addCommentButton);
    if (user == null) {
        commentMessageField.setEnabled(false);
        commentMessageField.setInputPrompt(site.localize("message-please-login-to-comment"));
        addCommentButton.setEnabled(false);
    }

    addCommentButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            final String commentMessage = commentMessageField.getValue();
            if (StringUtils.isEmpty(commentMessage)) {
                return;
            }
            final Comment comment = new Comment(company, user, contextPath, commentMessage);
            entityManager.getTransaction().begin();
            try {
                entityManager.persist(comment);
                entityManager.getTransaction().commit();
                commentMessageField.setValue("");
                if (commentListComponent != null) {
                    commentListComponent.refresh();
                }
            } finally {
                if (entityManager.getTransaction().isActive()) {
                    entityManager.getTransaction().rollback();
                }
            }
        }
    });

}

From source file:org.escidoc.browser.ui.listeners.OnContextAdminDescriptor.java

License:Open Source License

@SuppressWarnings("serial")
public void adminDescriptorForm() {
    final Window subwindow = new Window("A modal subwindow");
    subwindow.setModal(true);//from   w  w  w  . j  a v  a 2  s  . c om
    subwindow.setWidth("650px");
    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    final TextField txtName = new TextField("Name");
    txtName.setImmediate(true);
    txtName.setValidationVisible(true);
    final TextArea txtContent = new TextArea("Content");
    txtContent.setColumns(30);
    txtContent.setRows(40);

    Button addAdmDescButton = new Button("Add Description");
    addAdmDescButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {

            if (txtName.getValue().toString() == null) {
                router.getMainWindow().showNotification(ViewConstants.PLEASE_ENTER_A_NAME,
                        Notification.TYPE_ERROR_MESSAGE);
            } else if (!XmlUtil.isWellFormed(txtContent.getValue().toString())) {
                router.getMainWindow().showNotification(ViewConstants.XML_IS_NOT_WELL_FORMED,
                        Notification.TYPE_ERROR_MESSAGE);
            } else {
                AdminDescriptor newAdmDesc = controller.addAdminDescriptor(txtName.getValue().toString(),
                        txtContent.getValue().toString());
                (subwindow.getParent()).removeWindow(subwindow);
                router.getMainWindow().showNotification("Addedd Successfully",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }
        }
    });

    subwindow.addComponent(txtName);
    subwindow.addComponent(txtContent);
    subwindow.addComponent(addAdmDescButton);

    Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
        @Override
        public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    layout.addComponent(close);
    layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

    router.getMainWindow().addWindow(subwindow);

}