com.vaadin.ui.RichTextArea Java Examples

The following examples show how to use com.vaadin.ui.RichTextArea. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MilestoneEditFormFieldFactory.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected HasValue<?> onCreateField(Object propertyId) {
    if (Milestone.Field.assignuser.equalTo(propertyId)) {
        return new ProjectMemberSelectionField();
    } else if (propertyId.equals("status")) {
        return new ProgressStatusComboBox();
    } else if (propertyId.equals("name")) {
        return new MTextField().withRequiredIndicatorVisible(true);
    } else if (propertyId.equals("description")) {
        return new RichTextArea();
    } else if ("section-attachments".equals(propertyId)) {
        Milestone beanItem = attachForm.getBean();
        if (beanItem.getId() != null) {
            String attachmentPath = AttachmentUtils.getProjectEntityAttachmentPath(AppUI.getAccountId(),
                    beanItem.getProjectid(), ProjectTypeConstants.MILESTONE, "" + beanItem.getId());
            attachmentUploadField = new AttachmentUploadField(attachmentPath);
        } else {
            attachmentUploadField = new AttachmentUploadField();
        }
        return attachmentUploadField;
    } else if (Milestone.Field.startdate.equalTo(propertyId) || Milestone.Field.enddate.equalTo(propertyId)) {
        return new DateField();
    }

    return null;
}
 
Example #2
Source File: ProjectGeneralInfoStep.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (Project.Field.description.equalTo(propertyId)) {
        return new RichTextArea();
    } else if (Project.Field.status.equalTo(propertyId)) {
        ProjectStatusComboBox statusField = new ProjectStatusComboBox();
        statusField.setRequiredIndicatorVisible(true);
        if (project.getStatus() == null) {
            project.setStatus(StatusI18nEnum.Open.name());
        }
        return statusField;
    } else if (Project.Field.shortname.equalTo(propertyId)) {
        return new MTextField().withRequiredIndicatorVisible(true).withWidth(WebThemes.FORM_CONTROL_WIDTH);
    } else if (Project.Field.name.equalTo(propertyId)) {
        return new MTextField().withRequiredIndicatorVisible(true).withWidth(WebThemes.FORM_CONTROL_WIDTH);
    } else if (Project.Field.memlead.equalTo(propertyId)) {
        return new ActiveUserComboBox();
    } else if (Project.Field.planstartdate.equalTo(propertyId) || Project.Field.planenddate.equalTo(propertyId)) {
        return new DateField();
    }

    return null;
}
 
Example #3
Source File: TicketRelationWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(Object propertyId) {
    if (TicketRelation.Field.rel.equalTo(propertyId)) {
        I18nValueComboBox<TicketRel> relationSelection = new I18nValueComboBox<>(TicketRel.class,
                TicketRel.Block, TicketRel.Duplicated, TicketRel.DependsOn, TicketRel.Relation, TicketRel.Duplicate);
        relationSelection.setWidth(WebThemes.FORM_CONTROL_WIDTH);
        return relationSelection;
    } else if (TicketRelation.Field.typeid.equalTo(propertyId)) {
        ticketRelationSelectField = new TicketRelationSelectField();
        return ticketRelationSelectField;
    } else if (TicketRelation.Field.comment.equalTo(propertyId)) {
        return new RichTextArea();
    }
    return null;
}
 
Example #4
Source File: StandupAddWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (propertyId.equals("whatlastday") || propertyId.equals("whattoday") || propertyId.equals("whatproblem")) {
        final RichTextArea richText = new RichTextArea();
        richText.setWidth("100%");
        return richText;
    }
    return null;
}
 
Example #5
Source File: ApproveInputWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (propertyId.equals("assignuser")) {
        return new ProjectMemberSelectionField();
    } else if (propertyId.equals("comment")) {
        commentArea = new RichTextArea();
        return commentArea;
    }

    return null;
}
 
Example #6
Source File: ReOpenWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (propertyId.equals("assignuser")) {
        return new ProjectMemberSelectionField();
    } else if (SimpleBug.Field.affectedVersions.equalTo(propertyId)) {
        affectedVersionsSelect = new VersionMultiSelectField();
        return affectedVersionsSelect;
    } else if (propertyId.equals("comment")) {
        commentArea = new RichTextArea();
        return commentArea;
    }

    return null;
}
 
Example #7
Source File: AssignBugWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (propertyId.equals("assignuser")) {
        return new ProjectMemberSelectionField();
    } else if (propertyId.equals("comment")) {
        commentArea = new RichTextArea();
        return commentArea;
    }

    return null;
}
 
Example #8
Source File: ComponentEditFormFieldFactory.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
    protected HasValue<?> onCreateField(final Object propertyId) {
        if (Component.Field.name.equalTo(propertyId)) {
            final MTextField tf = new MTextField().withRequiredIndicatorVisible(true);
//                tf.setRequiredError(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL,
//                        UserUIContext.getMessage(GenericI18Enum.FORM_NAME)));
            return tf;
        } else if (Component.Field.description.equalTo(propertyId)) {
            return new RichTextArea();
        } else if (Component.Field.userlead.equalTo(propertyId)) {
            return new ProjectMemberSelectionField();
        }

        return null;
    }
 
Example #9
Source File: VersionEditFormFieldFactory.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (Version.Field.name.equalTo(propertyId)) {
        return new MTextField().withRequiredIndicatorVisible(true);
    } else if (Version.Field.description.equalTo(propertyId)) {
        return new RichTextArea();
    } else if (Version.Field.duedate.equalTo(propertyId)) {
        return new DateField();
    }

    return null;
}
 
Example #10
Source File: AssignTaskWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(Object propertyId) {
    if (propertyId.equals("assignuser")) {
        return new ProjectMemberSelectionField();
    } else if (propertyId.equals("comment")) {
        commentArea = new RichTextArea();
        return commentArea;
    }
    return null;
}
 
Example #11
Source File: GroupPageAddWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    if (propertyId.equals("description")) {
        return new RichTextArea();
    } else if (propertyId.equals("name")) {
        return new MTextField().withRequiredIndicatorVisible(true);
    }

    return null;
}
 
Example #12
Source File: BugEditFormFieldFactory.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected HasValue<?> onCreateField(final Object propertyId) {
    final SimpleBug beanItem = attachForm.getBean();
    if (BugWithBLOBs.Field.environment.equalTo(propertyId) || BugWithBLOBs.Field.description.equalTo(propertyId)) {
        return new RichTextArea();
    } else if (propertyId.equals("priority")) {
        return new PriorityComboBox();
    } else if (propertyId.equals("assignuser")) {
        ProjectMemberSelectionField field = new ProjectMemberSelectionField();
        field.addValueChangeListener(valueChangeEvent -> {
            String username = valueChangeEvent.getValue();
            if (username != null) {
                subscribersComp.addFollower(username);
            }
        });
        return field;
    } else if ("section-attachments".equals(propertyId)) {
        if (beanItem.getId() != null) {
            String attachmentPath = AttachmentUtils.getProjectEntityAttachmentPath(AppUI.getAccountId(),
                    beanItem.getProjectid(), ProjectTypeConstants.BUG, "" + beanItem.getId());
            attachmentUploadField = new AttachmentUploadField(attachmentPath);
        } else {
            attachmentUploadField = new AttachmentUploadField();
        }
        return attachmentUploadField;
    } else if (propertyId.equals("severity")) {
        return new BugSeverityComboBox();
    } else if (propertyId.equals("components")) {
        componentSelect = new ComponentMultiSelectField();
        return componentSelect;
    } else if (propertyId.equals("affectedVersions")) {
        affectedVersionSelect = new VersionMultiSelectField();
        return affectedVersionSelect;
    } else if (propertyId.equals("fixedVersions")) {
        fixedVersionSelect = new VersionMultiSelectField();
        return fixedVersionSelect;
    } else if (propertyId.equals("name")) {
        return new MTextField().withRequiredIndicatorVisible(true);
    } else if (propertyId.equals("milestoneid")) {
        return new MilestoneComboBox();
    } else if (BugWithBLOBs.Field.originalestimate.equalTo(propertyId) ||
            (BugWithBLOBs.Field.remainestimate.equalTo(propertyId))) {
        return new DoubleField().withWidth(WebThemes.FORM_CONTROL_WIDTH);
    } else if ("section-followers".equals(propertyId)) {
        return subscribersComp;
    } else if (BugWithBLOBs.Field.startdate.equalTo(propertyId) || BugWithBLOBs.Field.enddate.equalTo(propertyId)
            || BugWithBLOBs.Field.duedate.equalTo(propertyId)) {
        return new DateField();
    }

    return null;
}
 
Example #13
Source File: ProjectCommentInput.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
ProjectCommentInput(final ReloadableComponent component, final String typeVal, Integer extraTypeIdVal) {
    this.withMargin(new MarginInfo(true, true, false, false)).withFullWidth().withUndefinedHeight();

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

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

    type = typeVal;
    extraTypeId = extraTypeIdVal;

    commentArea = new RichTextArea();
    commentArea.setWidth("100%");
    commentArea.setHeight("200px");
    commentArea.addStyleName("comment-attachment");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("100%");

    final MButton newCommentBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_POST), clickEvent -> {
        CommentWithBLOBs comment = new CommentWithBLOBs();
        comment.setComment(Jsoup.clean(commentArea.getValue(), Whitelist.relaxed()));
        comment.setCreatedtime(LocalDateTime.now());
        comment.setCreateduser(UserUIContext.getUsername());
        comment.setSaccountid(AppUI.getAccountId());
        comment.setType(type);
        comment.setTypeid("" + typeId);
        comment.setExtratypeid(extraTypeId);

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

        String attachmentPath = AttachmentUtils.getCommentAttachmentPath(typeVal, AppUI.getAccountId(),
                CurrentProjectVariables.getProjectId(), typeId, commentId);

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

        // save success, clear comment area and load list
        // comments again
        commentArea.setValue("");
        component.reload();
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.PAPERPLANE);

    textAreaWrap.with(commentArea, attachments, newCommentBtn).withAlign(newCommentBtn, Alignment.TOP_RIGHT);
}