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() 

Source Link

Document

Constructs an empty TextArea.

Usage

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildMessagePanel() {
    VerticalLayout verticalLayout = new VerticalLayout();
    UpdateRecoveryImpossibleCause cause = presenter.isUpdateWithRecoveryPossible();
    if (cause != null) {
        verticalLayout.addComponent(new Label(
                "<p style=\"color:red\">" + $("UpdateManagerViewImpl." + cause) + "</p>", ContentMode.HTML));
    } else {/*from w  w w . j ava  2s  . c  o m*/
        UpdateNotRecommendedReason updateNotRecommendedReason = presenter.getUpdateNotRecommendedReason();
        if (updateNotRecommendedReason != null) {
            verticalLayout.addComponent(new Label("<p style=\"color:red\">"
                    + $("UpdateManagerViewImpl." + updateNotRecommendedReason) + "</p>", ContentMode.HTML));
        }
    }
    final String exceptionDuringLastUpdate = presenter.getExceptionDuringLastUpdate();
    if (StringUtils.isNotBlank(exceptionDuringLastUpdate)) {
        verticalLayout.addComponent(new Label(
                "<p style=\"color:red\">" + $("UpdateManagerViewImpl.exceptionCausedByLastVersion") + "</p>",
                ContentMode.HTML));
        WindowButton windowButton = new WindowButton($("details"), $("details"),
                WindowConfiguration.modalDialog("90%", "90%")) {
            @Override
            protected Component buildWindowContent() {
                TextArea textArea = new TextArea();
                textArea.setSizeFull();
                textArea.setValue(exceptionDuringLastUpdate);
                return textArea;
            }
        };
        windowButton.addStyleName(ValoTheme.BUTTON_LINK);
        verticalLayout.addComponent(windowButton);
        verticalLayout.addComponent(new Label("<p style=\"color:red\">" + "" + "</p>", ContentMode.HTML));
    }
    return verticalLayout;
}

From source file:com.esofthead.mycollab.mobile.module.crm.ui.NotesList.java

License:Open Source License

private void initUI() {
    noteList = new BeanList<NoteService, NoteSearchCriteria, SimpleNote>(noteService,
            NoteRowDisplayHandler.class);
    noteList.setDisplayEmptyListText(false);
    noteList.setStyleName("noteList");

    noteListContainer = new VerticalLayout();
    this.setContent(noteListContainer);
    displayNotes();//  ww  w.  j  a  va2s  .  c o m

    HorizontalLayout commentBox = new HorizontalLayout();
    commentBox.setSizeFull();
    commentBox.setStyleName("comment-box");
    commentBox.setSpacing(true);
    commentBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    final TextArea noteInput = new TextArea();
    noteInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT));
    noteInput.setSizeFull();
    commentBox.addComponent(noteInput);
    commentBox.setExpandRatio(noteInput, 1.0f);

    Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND));
    postBtn.setStyleName("submit-btn");
    postBtn.setWidthUndefined();
    postBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -5095455325725786794L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            final Note note = new Note();
            note.setCreateduser(AppContext.getUsername());
            note.setNote(noteInput.getValue());
            note.setSaccountid(AppContext.getAccountId());
            note.setSubject("");
            note.setType(type);
            note.setTypeid(typeid);
            note.setCreatedtime(new GregorianCalendar().getTime());
            note.setLastupdatedtime(new GregorianCalendar().getTime());
            noteService.saveWithSession(note, AppContext.getUsername());

            // Save Relay Email -- having time must refact to
            // Aop
            // ------------------------------------------------------
            RelayEmailNotification relayNotification = new RelayEmailNotification();
            relayNotification.setChangeby(AppContext.getUsername());
            relayNotification.setChangecomment(noteInput.getValue());
            relayNotification.setSaccountid(AppContext.getAccountId());
            relayNotification.setType(type);
            relayNotification.setAction(MonitorTypeConstants.ADD_COMMENT_ACTION);
            relayNotification.setTypeid("" + typeid);
            if (type.equals(CrmTypeConstants.ACCOUNT)) {
                relayNotification.setEmailhandlerbean(AccountRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CONTACT)) {
                relayNotification.setEmailhandlerbean(ContactRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CAMPAIGN)) {
                relayNotification.setEmailhandlerbean(CampaignRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.LEAD)) {
                relayNotification.setEmailhandlerbean(LeadRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.OPPORTUNITY)) {
                relayNotification.setEmailhandlerbean(OpportunityRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CASE)) {
                relayNotification.setEmailhandlerbean(CaseRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.TASK)) {
                relayNotification.setEmailhandlerbean(TaskRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.MEETING)) {
                relayNotification.setEmailhandlerbean(MeetingRelayEmailNotificationAction.class.getName());
            } else if (type.equals(CrmTypeConstants.CALL)) {
                relayNotification.setEmailhandlerbean(CallRelayEmailNotificationAction.class.getName());
            }
            RelayEmailNotificationService relayEmailNotificationService = ApplicationContextUtil
                    .getSpringBean(RelayEmailNotificationService.class);
            relayEmailNotificationService.saveWithSession(relayNotification, AppContext.getUsername());
            noteInput.setValue("");
            displayNotes();
        }
    });
    commentBox.addComponent(postBtn);

    this.setToolbar(commentBox);

}

From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.AssignmentEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("startdate")) {
        return new DatePicker();
    } else if (propertyId.equals("duedate")) {
        return new DatePicker();
    } else if (propertyId.equals("status")) {
        return new TaskStatusComboBox();
    } else if (propertyId.equals("priority")) {
        return new TaskPriorityComboBox();
    } else if (propertyId.equals("description")) {
        TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if (propertyId.equals("contactid")) {
        ContactSelectionField field = new ContactSelectionField();
        return field;
    } else if (propertyId.equals("subject")) {
        TextField tf = new TextField();

        if (isValidateForm) {
            tf.setRequired(true);/*from  w ww.j ava  2s .co m*/
            tf.setRequiredError("Subject must not be null");
            tf.setNullRepresentation("");
        }

        return tf;
    } else if (propertyId.equals("typeid")) {
        return new RelatedItemSelectionField(attachForm.getBean());
    } else if (propertyId.equals("type")) {
        return new DummyCustomField<String>();
    } else if (propertyId.equals("assignuser")) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    }
    return null;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.activity.MeetingEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("subject")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);/*from  w w  w.j  a  va2 s .c om*/
            tf.setRequiredError("Subject must not be null");
        }

        return tf;
    } else if (propertyId.equals("status")) {
        return new MeetingStatusComboBox();
    } else if (propertyId.equals("startdate")) {
        return new DatePicker();
    } else if (propertyId.equals("enddate")) {
        return new DatePicker();
    } else if (propertyId.equals("description")) {
        TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if (propertyId.equals("typeid")) {
        return new RelatedItemSelectionField(attachForm.getBean());
    } else if (propertyId.equals("type")) {
        return new DummyCustomField<String>();
    } else if (propertyId.equals("isrecurrence")) {
        return null;
    }
    return null;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.campaign.CampaignEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {

    if ("type".equals(propertyId)) {
        CampaignTypeComboBox typeCombo = new CampaignTypeComboBox();
        typeCombo.setWidth("100%");
        return typeCombo;
    } else if ("status".equals(propertyId)) {
        CampaignStatusComboBox statusCombo = new CampaignStatusComboBox();
        statusCombo.setWidth("100%");
        return statusCombo;
    } else if ("campaignname".equals(propertyId)) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);/*from  w  w  w .j  a va 2 s  . c  om*/
            tf.setRequiredError("Name must not be null");
        }

        return tf;
    } else if ("description".equals(propertyId)) {
        TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if ("assignuser".equals(propertyId)) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    } else if (propertyId.equals("currencyid")) {
        return new CurrencyComboBoxField();
    }
    return null;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.contact.ContactEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("firstname") || propertyId.equals("prefix")) {
        return firstNamePrefixField;
    } else if (propertyId.equals("leadsource")) {
        LeadSourceComboBox leadSource = new LeadSourceComboBox();
        return leadSource;
    } else if (propertyId.equals("accountid")) {
        AccountSelectionField accountField = new AccountSelectionField();
        return accountField;
    } else if (propertyId.equals("lastname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);// w ww .j a v a 2  s.  c  o  m
            tf.setRequiredError("Last name must not be null");
        }

        return tf;
    } else if (propertyId.equals("description")) {
        TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if (propertyId.equals("assignuser")) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    } else if (propertyId.equals("primcountry") || propertyId.equals("othercountry")) {
        CountryComboBox otherCountryComboBox = new CountryComboBox();
        return otherCountryComboBox;
    } else if (propertyId.equals("birthday")) {
        return new BirthdayPickerField();
    }
    return null;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.lead.LeadEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("firstname") || propertyId.equals("prefixname")) {
        return firstNamePrefixField;
    } else if (propertyId.equals("primcountry") || propertyId.equals("othercountry")) {
        CountryComboBox otherCountryComboBox = new CountryComboBox();
        return otherCountryComboBox;
    } else if (propertyId.equals("status")) {
        LeadStatusComboBox statusComboBox = new LeadStatusComboBox();
        return statusComboBox;
    } else if (propertyId.equals("industry")) {
        IndustryComboBox industryComboBox = new IndustryComboBox();
        return industryComboBox;
    } else if (propertyId.equals("assignuser")) {
        ActiveUserComboBox userComboBox = new ActiveUserComboBox();
        return userComboBox;
    } else if (propertyId.equals("source")) {
        LeadSourceComboBox statusComboBox = new LeadSourceComboBox();
        return statusComboBox;
    } else if (propertyId.equals("lastname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);/*from ww w .ja  va2s  . com*/
            tf.setRequiredError("Last name must not be null");
        }

        return tf;
    } else if (propertyId.equals("description")) {
        TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if (propertyId.equals("accountname")) {
        TextField txtField = new TextField();
        if (isValidateForm) {
            txtField.setRequired(true);
            txtField.setRequiredError("Account name must be not null");
        }

        return txtField;
    }

    return null;
}

From source file:com.esofthead.mycollab.mobile.module.crm.view.opportunity.OpportunityEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {

    if (propertyId.equals("campaignid")) {
        return new CampaignSelectionField();
    } else if (propertyId.equals("accountid")) {
        AccountSelectionField accountField = new AccountSelectionField();
        accountField.setRequired(true);/*from  w  w  w. java 2  s  .c  om*/
        return accountField;
    } else if (propertyId.equals("opportunityname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);
            tf.setRequiredError("Name must not be null");
        }
        return tf;
    } else if (propertyId.equals("currencyid")) {
        CurrencyComboBoxField currencyBox = new CurrencyComboBoxField();
        return currencyBox;
    } else if (propertyId.equals("salesstage")) {
        return new OpportunitySalesStageComboBox();
    } else if (propertyId.equals("opportunitytype")) {
        return new OpportunityTypeComboBox();
    } else if (propertyId.equals("source")) {
        return new LeadSourceComboBox();
    } else if (propertyId.equals("description")) {
        TextArea descArea = new TextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if (propertyId.equals("assignuser")) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        return userBox;
    }

    return null;
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInput.java

License:Open Source License

private void constructUI() {
    this.setWidth("100%");

    statusWrapper = new CssLayout();
    statusWrapper.setWidth("100%");
    statusWrapper.setStyleName("upload-status-wrap");
    this.addComponent(statusWrapper);

    inputWrapper = new HorizontalLayout();
    inputWrapper.setWidth("100%");
    inputWrapper.setStyleName("comment-box");
    inputWrapper.setSpacing(true);// w  ww  .j  a  v  a  2s  .  com
    inputWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    this.prepareUploadField();

    inputWrapper.addComponent(uploadField);

    commentInput = new TextArea();
    commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT));
    commentInput.setSizeFull();
    inputWrapper.addComponent(commentInput);
    inputWrapper.setExpandRatio(commentInput, 1.0f);

    Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.M_BUTTON_SEND));
    postBtn.setStyleName("submit-btn");
    postBtn.setWidthUndefined();
    postBtn.addClickListener(new Button.ClickListener() {

        private static final long serialVersionUID = 6687918902751556313L;

        @Override
        public void buttonClick(Button.ClickEvent arg0) {
            final Comment comment = new Comment();
            comment.setComment(commentInput.getValue());
            comment.setCreatedtime(new GregorianCalendar().getTime());
            comment.setCreateduser(AppContext.getUsername());
            comment.setSaccountid(AppContext.getAccountId());
            comment.setType(type.toString());
            comment.setTypeid("" + typeid);
            comment.setExtratypeid(extraTypeId);

            final CommentService commentService = ApplicationContextUtil.getSpringBean(CommentService.class);
            int commentId = commentService.saveWithSession(comment, AppContext.getUsername(),
                    isSendingEmailRelay, emailHandlerClass);

            String attachmentPath = AttachmentUtils.getProjectEntityCommentAttachmentPath(type,
                    AppContext.getAccountId(), CurrentProjectVariables.getProjectId(), typeid, commentId);
            if (!"".equals(attachmentPath)) {
                saveContentsToRepo(attachmentPath);
            }

            // save success, clear comment area and load list
            // comments again
            commentInput.setValue("");
            statusWrapper.removeAllComponents();
            component.reload();
        }

    });
    inputWrapper.addComponent(postBtn);
    this.addComponent(inputWrapper);
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInputView.java

License:Open Source License

public ProjectCommentInputView(String typeVal, String typeIdVal, Integer extraTypeIdVal) {
    this.setCaption("Add a comment");
    resourceService = AppContextUtil.getSpringBean(ResourceService.class);
    MVerticalLayout content = new MVerticalLayout().withFullWidth().withStyleName("comment-input");
    this.setContent(content);

    type = typeVal;//from w ww.  j  a  va 2  s  .  c om
    typeId = typeIdVal;
    extraTypeId = extraTypeIdVal;

    prepareUploadField();

    commentInput = new TextArea();
    commentInput.setWidth("100%");
    commentInput.setInputPrompt(AppContext.getMessage(GenericI18Enum.M_NOTE_INPUT_PROMPT));

    Button postBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            final CommentWithBLOBs comment = new CommentWithBLOBs();
            comment.setComment(commentInput.getValue());
            comment.setCreatedtime(new GregorianCalendar().getTime());
            comment.setCreateduser(AppContext.getUsername());
            comment.setSaccountid(AppContext.getAccountId());
            comment.setType(type);
            comment.setTypeid("" + typeId);
            comment.setExtratypeid(extraTypeId);

            final CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
            int commentId = commentService.saveWithSession(comment, AppContext.getUsername());

            String attachmentPath = AttachmentUtils.getCommentAttachmentPath(type, AppContext.getAccountId(),
                    CurrentProjectVariables.getProjectId(), typeId, commentId);
            if (!"".equals(attachmentPath)) {
                saveContentsToRepo(attachmentPath);
            }

            getNavigationManager().navigateBack();
        }
    });
    this.setRightComponent(postBtn);
    content.with(commentInput, ELabel.hr(), uploadField, statusWrapper);
}