Example usage for com.vaadin.ui RichTextArea RichTextArea

List of usage examples for com.vaadin.ui RichTextArea RichTextArea

Introduction

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

Prototype

public RichTextArea() 

Source Link

Document

Constructs an empty RichTextArea with no caption.

Usage

From source file:com.jain.addon.web.bean.factory.generator.text.RichTextFieldGenerator.java

License:Apache License

public Field<?> createField(Class<?> type, JNIProperty property) {
    RichTextArea field = new RichTextArea();
    field.setNullRepresentation("");
    return field;
}

From source file:com.jiangyifen.ec2.ui.LoginLayout.java

/**
 * ??? (?, ?)/*w  w  w.j a  v  a2 s . co m*/
 */
private void createConflictManageWindow() {
    conflictManageWindow = new Window("?");
    conflictManageWindow.setModal(true);
    conflictManageWindow.setResizable(false);

    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSpacing(true);
    mainLayout.setMargin(true);
    mainLayout.setSizeUndefined();
    mainLayout.setWidth("400px");
    conflictManageWindow.setContent(mainLayout);

    Label captionLabel = new Label("<font color='blue'><B>??</B></font>",
            Label.CONTENT_XHTML);
    captionLabel.setWidth("-1px");
    mainLayout.addComponent(captionLabel);

    conflictNotice = new RichTextArea();
    conflictNotice.setReadOnly(true);
    conflictNotice.setWriteThrough(false);
    conflictNotice.setWidth("-1px");
    mainLayout.addComponent(conflictNotice);

    String placeholder = "&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
    Label noticeLabel = new Label(
            "<font color='red'><B>" + placeholder
                    + "?</B></font>",
            Label.CONTENT_XHTML);
    noticeLabel.setWidth("-1px");
    mainLayout.addComponent(noticeLabel);

    Label confirmLabel = new Label("<B>" + placeholder + "??</B>",
            Label.CONTENT_XHTML);
    confirmLabel.setWidth("-1px");
    mainLayout.addComponent(confirmLabel);

    // ???
    HorizontalLayout operatorHLayout = new HorizontalLayout();
    operatorHLayout.setSpacing(true);
    mainLayout.addComponent(operatorHLayout);

    confirm = new Button("", this);
    confirm.setImmediate(true);
    cancel = new Button("?", this);
    cancel.setStyleName("default");
    cancel.setImmediate(true);
    operatorHLayout.addComponent(confirm);
    operatorHLayout.addComponent(cancel);
}

From source file:com.liferay.mail.vaadin.Composer.java

License:Open Source License

private VerticalLayout buildMessageLayout() {

    // common part: create layout
    messageLayout = new VerticalLayout();

    // message/* w ww  .  java  2s  .c om*/
    message = new RichTextArea();
    message.setImmediate(false);
    message.setHeight("100.0%");
    message.setWidth("100.0%");
    messageLayout.addComponent(message);

    return messageLayout;
}

From source file:com.mcparland.john.AdjustableLayout.java

License:Apache License

/**
 * Create the editor panel.//w  ww  . j a  va2 s.  c  o m
 * 
 * @return the editor panel.
 */
private Component createEditorPanel() {
    SafeHtml safeHtml = SafeHtmlUtils.fromSafeConstant("<b>Help</b> <br />" + LIPSUM);
    HorizontalSplitPanel editorPanel = new HorizontalSplitPanel();
    RichTextArea editor = new RichTextArea();
    editor.setSizeFull();
    editor.setValue(LIPSUM);
    editorPanel.setFirstComponent(editor);
    editorPanel.setSecondComponent(new Label(safeHtml.asString(), ContentMode.HTML));
    editorPanel.setSplitPosition(80, Unit.PERCENTAGE);
    return editorPanel;
}

From source file:com.mycollab.module.crm.ui.components.CrmCommentInput.java

License:Open Source License

CrmCommentInput(final ReloadableComponent component, final String typeVal) {
    super();/*from w  w w.j a v a2s. c om*/
    this.withMargin(new MarginInfo(true, true, false, false)).withFullWidth();

    SimpleUser currentUser = UserUIContext.getUser();
    UserBlock userBlock = new UserBlock(currentUser.getUsername(), currentUser.getAvatarid(),
            currentUser.getDisplayName());

    MVerticalLayout textAreaWrap = new MVerticalLayout().withFullWidth()
            .withStyleName(WebThemes.MESSAGE_CONTAINER);
    this.with(userBlock, textAreaWrap).expand(textAreaWrap);

    type = typeVal;

    commentArea = new RichTextArea();
    commentArea.setWidth("100%");
    commentArea.setHeight("200px");

    final AttachmentPanel attachments = new AttachmentPanel();

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLEAR),
            clickEvent -> commentArea.setValue("")).withStyleName(WebThemes.BUTTON_OPTION);

    MButton newCommentBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_POST), clickEvent -> {
        CommentWithBLOBs comment = new CommentWithBLOBs();
        comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
        comment.setCreatedtime(new GregorianCalendar().getTime());
        comment.setCreateduser(UserUIContext.getUsername());
        comment.setSaccountid(MyCollabUI.getAccountId());
        comment.setType(type);
        comment.setTypeid(typeId);

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

        String attachmentPath = AttachmentUtils.getCommentAttachmentPath(typeVal, MyCollabUI.getAccountId(),
                null, typeId, commentId);

        if (!"".equals(attachmentPath)) {
            attachments.saveContentsToRepo(attachmentPath);
        }

        // save success, clear comment area and load list
        // comments again
        commentArea.setValue("");
        component.reload();
    }).withIcon(FontAwesome.SEND).withStyleName(WebThemes.BUTTON_ACTION);
    final MHorizontalLayout controlsLayout = new MHorizontalLayout(attachments, cancelBtn, newCommentBtn)
            .expand(attachments).withFullWidth();
    textAreaWrap.with(commentArea, controlsLayout);
}

From source file:com.mycollab.module.crm.view.account.AccountEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (Account.Field.type.equalTo(propertyId)) {
        return new AccountTypeComboBox();
    } else if (Account.Field.industry.equalTo(propertyId)) {
        return new IndustryComboBox();
    } else if (Account.Field.assignuser.equalTo(propertyId)) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    } else if (Account.Field.description.equalTo(propertyId)) {
        return new RichTextArea();
    } else if (Account.Field.billingcountry.equalTo(propertyId)
            || Account.Field.shippingcountry.equalTo(propertyId)) {
        return new CountryComboBox();
    } else if (Account.Field.accountname.equalTo(propertyId)) {
        MTextField tf = new MTextField();
        if (isValidateForm) {
            tf.withNullRepresentation("").withRequired(true)
                    .withRequiredError(UserUIContext.getMessage(ErrorI18nEnum.ERROR_USER_IS_NOT_EXISTED,
                            UserUIContext.getMessage(AccountI18nEnum.FORM_ACCOUNT_NAME)));
        }// w w w.j a va  2s. co  m

        return tf;
    }

    return null;
}

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

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if ("type".equals(propertyId)) {
        return new CampaignTypeComboBox();
    } else if ("status".equals(propertyId)) {
        return new CampaignStatusComboBox();
    } else if ("campaignname".equals(propertyId)) {
        MTextField tf = new MTextField();
        if (isValidateForm) {
            tf.withNullRepresentation("").withRequired(true).withRequiredError(UserUIContext.getMessage(
                    ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(GenericI18Enum.FORM_NAME)));
        }/*  w w w  .  j a v a 2 s.  c  om*/

        return tf;
    } else if ("description".equals(propertyId)) {
        return new RichTextArea();
    } else if ("assignuser".equals(propertyId)) {
        return new ActiveUserComboBox();
    } else if (propertyId.equals("currencyid")) {
        return new CurrencyComboBoxField();
    } else if (CampaignWithBLOBs.Field.budget.equalTo(propertyId)
            || CampaignWithBLOBs.Field.actualcost.equalTo(propertyId)
            || CampaignWithBLOBs.Field.expectedcost.equalTo(propertyId)
            || CampaignWithBLOBs.Field.expectedrevenue.equalTo(propertyId)) {
        return new DoubleField();
    }
    return null;
}

From source file:com.mycollab.module.crm.view.cases.CaseEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("priority")) {
        return new CasePriorityComboBox();
    } else if (propertyId.equals("status")) {
        return new CaseStatusComboBox();
    } else if (propertyId.equals("reason")) {
        return new CaseReasonComboBox();
    } else if (propertyId.equals("origin")) {
        return new CasesOriginComboBox();
    } else if (propertyId.equals("type")) {
        return new CaseTypeComboBox();
    } else if (propertyId.equals("description")) {
        return new RichTextArea();
    } else if (propertyId.equals("resolution")) {
        return new RichTextArea();
    } else if (propertyId.equals("accountid")) {
        AccountSelectionField accountField = new AccountSelectionField();
        accountField.setRequired(true);//w ww.  j av  a2s .c o m
        return accountField;
    } else if (propertyId.equals("subject")) {
        MTextField tf = new MTextField();
        if (isValidateForm) {
            tf.withNullRepresentation("").withRequired(true).withRequiredError(UserUIContext.getMessage(
                    ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(CaseI18nEnum.FORM_SUBJECT)));
        }

        return tf;
    } else if (propertyId.equals("assignuser")) {
        ActiveUserComboBox userBox = new ActiveUserComboBox();
        userBox.select(attachForm.getBean().getAssignuser());
        return userBox;
    }

    return null;
}

From source file:com.mycollab.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")) {
        return new LeadSourceComboBox();
    } else if (propertyId.equals("accountid")) {
        return new AccountSelectionField();
    } else if (propertyId.equals("lastname")) {
        MTextField tf = new MTextField();
        if (isValidateForm) {
            tf.withNullRepresentation("").withRequired(true).withRequiredError(UserUIContext.getMessage(
                    ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(GenericI18Enum.FORM_LASTNAME)));
        }/*  w  ww . j  a va 2s.  c  om*/

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

From source file:com.mycollab.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")) {
        return new CountryComboBox();
    } else if (propertyId.equals("status")) {
        return new LeadStatusComboBox();
    } else if (propertyId.equals("industry")) {
        return new IndustryComboBox();
    } else if (propertyId.equals("assignuser")) {
        return new ActiveUserComboBox();
    } else if (propertyId.equals("source")) {
        return new LeadSourceComboBox();
    } else if (propertyId.equals("lastname")) {
        TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);/*from  ww w  .j  a va 2 s  .c om*/
            tf.setRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
                    UserUIContext.getMessage(GenericI18Enum.FORM_LASTNAME)));
        }

        return tf;
    } else if (propertyId.equals("description")) {
        return new RichTextArea();
    } else if (propertyId.equals("accountname")) {
        TextField txtField = new TextField();
        if (isValidateForm) {
            txtField.setRequired(true);
            txtField.setRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
                    UserUIContext.getMessage(LeadI18nEnum.FORM_ACCOUNT_NAME)));
        }

        return txtField;
    }

    return null;
}