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.esofthead.mycollab.module.project.view.milestone.MilestoneEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(Object propertyId) {
    if (propertyId.equals("owner")) {
        final ProjectMemberSelectionField userbox = new ProjectMemberSelectionField();
        userbox.setRequired(true);/*from www. java  2 s. c o m*/
        userbox.setRequiredError("Please select an assignee");
        return userbox;
    } else if (propertyId.equals("status")) {
        if (attachForm.getBean().getStatus() == null) {
            attachForm.getBean().setStatus(MilestoneStatus.InProgress.toString());
        }
        return new ProgressStatusComboBox();
    } else if (propertyId.equals("name")) {
        final TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);
            tf.setRequiredError("Please enter name");
        }
        return tf;
    } else if (propertyId.equals("description")) {
        final RichTextArea descArea = new RichTextArea();
        descArea.setNullRepresentation("");
        return descArea;
    } else if (propertyId.equals("numOpenTasks")) {
        final ContainerHorizontalViewField taskComp = new ContainerHorizontalViewField();
        final int numOpenTask = (attachForm.getBean() instanceof SimpleMilestone)
                ? ((SimpleMilestone) attachForm.getBean()).getNumOpenTasks()
                : 0;
        final int numTasks = (attachForm.getBean() instanceof SimpleMilestone)
                ? ((SimpleMilestone) attachForm.getBean()).getNumTasks()
                : 0;

        final ProgressBarIndicator progressTask = new ProgressBarIndicator(numTasks, numOpenTask);
        progressTask.setWidth("100%");
        taskComp.addComponentField(progressTask);
        return taskComp;
    } else if (propertyId.equals("numOpenBugs")) {
        final ContainerHorizontalViewField bugComp = new ContainerHorizontalViewField();
        final int numOpenBugs = (attachForm.getBean() instanceof SimpleMilestone)
                ? ((SimpleMilestone) attachForm.getBean()).getNumOpenBugs()
                : 0;
        final int numBugs = (attachForm.getBean() instanceof SimpleMilestone)
                ? ((SimpleMilestone) attachForm.getBean()).getNumBugs()
                : 0;

        final ProgressBarIndicator progressBug = new ProgressBarIndicator(numBugs, numOpenBugs);
        progressBug.setWidth("100%");
        bugComp.addComponentField(progressBug);
        return bugComp;
    }

    return null;
}

From source file:com.esofthead.mycollab.module.project.view.settings.component.ComponentEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(final Object propertyId) {
    if (Component.Field.componentname.equalTo(propertyId)) {
        final TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);//w  w  w.  j a  va  2 s. c o m
            tf.setRequiredError(AppContext.getMessage(ComponentI18nEnum.FORM_COMPONENT_ERROR));
        }
        return tf;
    } else if (Component.Field.description.equalTo(propertyId)) {
        return new RichTextArea();
    } else if (Component.Field.userlead.equalTo(propertyId)) {
        return new ProjectMemberSelectionField();
    }

    return null;
}

From source file:com.esofthead.mycollab.module.project.view.settings.component.VersionEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(final Object propertyId) {
    if (Version.Field.versionname.equalTo(propertyId)) {
        final TextField tf = new TextField();
        if (isValidateForm) {
            tf.setNullRepresentation("");
            tf.setRequired(true);/*w w  w  .  j a  v a 2 s.co m*/
            tf.setRequiredError(AppContext.getMessage(VersionI18nEnum.FORM_VERSION_ERROR_MSG));
        }
        return tf;
    } else if (Version.Field.description.equalTo(propertyId)) {
        return new RichTextArea();
    } else if (Version.Field.duedate.equalTo(propertyId)) {
        final PopupDateFieldExt dateField = new PopupDateFieldExt();
        dateField.setResolution(Resolution.DAY);
        return dateField;
    }

    return null;
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskEditFormFieldFactory.java

License:Open Source License

@Override
protected Field<?> onCreateField(final Object propertyId) {
    if (Task.Field.assignuser.equalTo(propertyId)) {
        ProjectMemberSelectionField field = new ProjectMemberSelectionField();
        field.addValueChangeListener(new Property.ValueChangeListener() {
            @Override//from  w ww.ja va2  s . co m
            public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
                Property property = valueChangeEvent.getProperty();
                SimpleProjectMember member = (SimpleProjectMember) property.getValue();
                if (member != null) {
                    subscribersComp.addFollower(member.getUsername());
                }
            }
        });
        return field;
    } else if (Task.Field.milestoneid.equalTo(propertyId)) {
        return new MilestoneComboBox();
    } else if (Task.Field.notes.equalTo(propertyId)) {
        final RichTextArea richTextArea = new RichTextArea();
        richTextArea.setNullRepresentation("");
        return richTextArea;
    } else if (Task.Field.taskname.equalTo(propertyId)) {
        final TextField tf = new TextField();
        tf.setNullRepresentation("");
        tf.setRequired(true);
        tf.setRequiredError(AppContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, "Name"));
        return tf;
    } else if (Task.Field.status.equalTo(propertyId)) {
        return new TaskStatusComboBox();
    } else if (Task.Field.percentagecomplete.equalTo(propertyId)) {
        return new TaskSliderField();
    } else if (Task.Field.priority.equalTo(propertyId)) {
        return new TaskPriorityComboBox();
    } else if (Task.Field.duration.equalTo(propertyId)) {
        final TextField field = new TextField();
        field.setConverter(new HumanTimeConverter());
        final SimpleTask beanItem = attachForm.getBean();
        if (beanItem.getNumSubTasks() != null && beanItem.getNumSubTasks() > 0) {
            field.setEnabled(false);
            field.setDescription("Because this row has sub-tasks, this cell "
                    + "is a summary value and can not be edited directly. You can edit cells "
                    + "beneath this row to change its value");
        }

        //calculate the end date if the start date is set
        field.addBlurListener(new FieldEvents.BlurListener() {
            @Override
            public void blur(FieldEvents.BlurEvent event) {
                HumanTime humanTime = HumanTime.eval(field.getValue());
                Integer duration = Integer.valueOf(humanTime.getDelta() + "");
                DateTimeOptionField startDateField = (DateTimeOptionField) fieldGroup
                        .getField(Task.Field.startdate.name());
                Date startDateVal = startDateField.getValue();
                if (duration > 0 && startDateVal != null) {
                    int durationIndays = duration / (int) DateTimeUtils.MILLISECONDS_IN_A_DAY;
                    if (durationIndays > 0) {
                        LocalDate startDateJoda = new LocalDate(startDateVal);
                        LocalDate endDateJoda = BusinessDayTimeUtils.plusDays(startDateJoda, durationIndays);
                        DateTimeOptionField endDateField = (DateTimeOptionField) fieldGroup
                                .getField(Task.Field.enddate.name());
                        endDateField.setValue(endDateJoda.toDate());
                    }
                }
            }
        });
        return field;
    } else if (Task.Field.originalestimate.equalTo(propertyId)
            || Task.Field.remainestimate.equalTo(propertyId)) {
        return new DoubleField();
    } else if (Task.Field.startdate.equalTo(propertyId)) {
        final DateTimeOptionField startDateField = new DateTimeOptionField(true);
        startDateField.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                calculateDurationBaseOnStartAndEndDates();
            }
        });
        return startDateField;
    } else if (Task.Field.enddate.equalTo(propertyId)) {
        DateTimeOptionField endDateField = new DateTimeOptionField(true);
        endDateField.addValueChangeListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                calculateDurationBaseOnStartAndEndDates();
            }
        });
        return endDateField;
    } else if (Task.Field.id.equalTo(propertyId)) {
        attachmentUploadField = new AttachmentUploadField();
        Task beanItem = attachForm.getBean();
        if (beanItem.getId() != null) {
            String attachmentPath = AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(),
                    beanItem.getProjectid(), ProjectTypeConstants.TASK, "" + beanItem.getId());
            attachmentUploadField.getAttachments(attachmentPath);
        }
        return attachmentUploadField;
    } else if (Task.Field.deadline.equalTo(propertyId)) {
        return new DateTimeOptionField(true);
    } else if (propertyId.equals("selected")) {
        return subscribersComp;
    }
    return null;
}

From source file:com.esofthead.mycollab.vaadin.ui.FeedbackWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(2, 5);
    mainLayout.setMargin(true);/* w w  w.  j a  v a  2  s .c  om*/
    mainLayout.setSpacing(true);

    emailNameTextField = new TextField();
    emailNameTextField.setWidth("500px");
    Label emailName = new Label("Your name: ");

    mainLayout.addComponent(emailName, 0, 0);
    mainLayout.addComponent(emailNameTextField, 1, 0);

    emailTextField = new TextField();
    emailTextField.setWidth("500px");
    emailTextField.setRequired(true);
    Label emailLbl = new Label("Your email: ");

    mainLayout.addComponent(emailLbl, 0, 1);
    mainLayout.addComponent(emailTextField, 1, 1);

    subjectTextField = new TextField();
    subjectTextField.setWidth("500px");
    subjectTextField.setRequired(true);
    Label subjectLbl = new Label("Subject: ");

    mainLayout.addComponent(subjectLbl, 0, 2);
    mainLayout.addComponent(subjectTextField, 1, 2);

    final RichTextArea contentArea = new RichTextArea();
    contentArea.setImmediate(true);
    contentArea.setWidth(500, Sizeable.Unit.PIXELS);
    contentArea.setHeight(200, Sizeable.Unit.PIXELS);
    Label contentLbl = new Label("Your feedback: ");

    mainLayout.addComponent(contentLbl, 0, 3);
    mainLayout.addComponent(contentArea, 1, 3);

    initDefaultData();

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("350px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    // Panel attachedFilepanel = new Panel();
    VerticalLayout contentLayout = new VerticalLayout();
    contentLayout.setHeight("80px");
    contentLayout.setStyleName("noneBorder-panel");
    contentLayout.setSizeUndefined();

    contentLayout.addComponent(uploadExt);

    // attachedFilepanel.setContent(contentLayout);

    controlsLayout.addComponent(contentLayout);
    controlsLayout.setComponentAlignment(contentLayout, Alignment.BOTTOM_LEFT);
    controlsLayout.setExpandRatio(contentLayout, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    FeedbackWindow.this.close();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn = new Button("Send", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            String email = emailTextField.getValue().toString().trim();
            String subject = subjectTextField.getValue().toString().trim();
            if (!StringUtils.isValidEmail(email)) {
                NotificationUtil.showWarningNotification("The email is not valid, please check it again!");
                return;
            }
            if (!email.equals("") && !subject.equals("")) {
                ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class);
                List<File> listFile = attachments.getListFile();
                List<EmailAttachementSource> emailAttachmentSource = null;

                if (CollectionUtils.isNotEmpty(listFile)) {
                    emailAttachmentSource = new ArrayList<EmailAttachementSource>();
                    for (File file : listFile) {
                        emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                }

                String nameEmailFrom = emailNameTextField.getValue().toString().trim();
                nameEmailFrom = nameEmailFrom.equals("") ? email : nameEmailFrom;
                String toEmail = SiteConfiguration.getSendErrorEmail();

                FeedbackWindow.this.close();

                systemMailService.sendHTMLMail(email, nameEmailFrom,
                        Arrays.asList(new MailRecipientField(toEmail, toEmail)), null, null, subject,
                        contentArea.getValue().toString(), emailAttachmentSource);

            } else {
                NotificationUtil.showWarningNotification(
                        "The email field and subject field must be not empty! Please fulfil them before pressing enter button.");
            }
        }
    });
    sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 4, 1, 4);

    this.setContent(mainLayout);
}

From source file:com.esofthead.mycollab.vaadin.ui.MailFormWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);/* w  w  w.ja va 2  s .  c om*/
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();
    tokenFieldMailTo.setRequired(true);

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
        for (String mail : lstMail) {
            if (StringUtils.isNotBlank(mail)) {
                if (mail.indexOf("<") > -1) {
                    String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
                    if (strMail != null && !strMail.equalsIgnoreCase("null")) {
                        tokenFieldMailTo.addToken(mail);
                    }
                } else {
                    tokenFieldMailTo.addToken(mail);
                }
            }
        }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    controlsLayout.addComponent(uploadExt);
    controlsLayout.setExpandRatio(uploadExt, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    MailFormWindow.this.close();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn = new Button("Send", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) {
                NotificationUtil.showErrorNotification(
                        "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
                return;
            }
            if (AppContext.getSession().getEmail() != null && AppContext.getSession().getEmail().length() > 0) {
                ExtMailService systemMailService = ApplicationContextUtil.getSpringBean(ExtMailService.class);

                List<File> listFile = attachments.getListFile();
                List<EmailAttachementSource> emailAttachmentSource = null;
                if (listFile != null && listFile.size() > 0) {
                    emailAttachmentSource = new ArrayList<EmailAttachementSource>();
                    for (File file : listFile) {
                        emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                }

                systemMailService.sendHTMLMail(AppContext.getSession().getEmail(),
                        AppContext.getSession().getDisplayName(), tokenFieldMailTo.getListRecipient(),
                        tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(),
                        subject.getValue().toString(), noteArea.getValue().toString(), emailAttachmentSource);
                MailFormWindow.this.close();
            } else {
                NotificationUtil.showErrorNotification(
                        "Your email is empty value, please fulfil it before sending email!");
            }
        }
    });
    sendBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 2);

    this.setContent(mainLayout);
}

From source file:com.esofthead.mycollab.vaadin.web.ui.MailFormWindow.java

License:Open Source License

private void initUI() {
    GridLayout mainLayout = new GridLayout(1, 5);
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);//  w  w  w  .j  a  v a  2s  .c  om
    mainLayout.setSpacing(true);

    CssLayout inputPanel = new CssLayout();
    inputPanel.setWidth("100%");
    inputPanel.setStyleName("mail-panel");

    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);

    inputPanel.addComponent(inputLayout);

    mainLayout.addComponent(inputPanel);

    tokenFieldMailTo = new EmailTokenField();

    inputLayout.addComponent(createTextFieldMail("To:", tokenFieldMailTo), 0, 0);

    if (lstMail != null) {
        for (String mail : lstMail) {
            if (StringUtils.isNotBlank(mail)) {
                if (mail.indexOf("<") > -1) {
                    String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
                    if (strMail != null && !strMail.equalsIgnoreCase("null")) {

                    }
                } else {

                }
            }
        }
    }

    final TextField subject = new TextField();
    subject.setRequired(true);
    subject.setWidth("100%");
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

    ccField = createTextFieldMail("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMail("Bcc:", tokenFieldMailBcc);

    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea, 0, 1);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);

    HorizontalLayout controlsLayout = new HorizontalLayout();
    controlsLayout.setWidth("100%");

    final AttachmentPanel attachments = new AttachmentPanel();
    attachments.setWidth("500px");

    MultiFileUploadExt uploadExt = new MultiFileUploadExt(attachments);
    uploadExt.addComponent(attachments);

    controlsLayout.addComponent(uploadExt);
    controlsLayout.setExpandRatio(uploadExt, 1.0f);

    controlsLayout.setSpacing(true);

    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(ClickEvent event) {
                    MailFormWindow.this.close();
                }
            });

    cancelBtn.setStyleName(UIConstants.BUTTON_OPTION);
    controlsLayout.addComponent(cancelBtn);
    controlsLayout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_RIGHT);

    Button sendBtn = new Button("Send", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {

            if (tokenFieldMailTo.getListRecipient().size() <= 0 || subject.getValue().equals("")) {
                NotificationUtil.showErrorNotification(
                        "To Email field and Subject field must be not empty! Please fulfil them before sending email.");
                return;
            }
            if (AppContext.getUser().getEmail() != null && AppContext.getUser().getEmail().length() > 0) {
                ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class);

                List<File> listFile = attachments.files();
                List<EmailAttachmentSource> emailAttachmentSource = null;
                if (listFile != null && listFile.size() > 0) {
                    emailAttachmentSource = new ArrayList<>();
                    for (File file : listFile) {
                        emailAttachmentSource.add(new FileEmailAttachmentSource(file));
                    }
                }

                systemMailService.sendHTMLMail(AppContext.getUser().getEmail(),
                        AppContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(),
                        tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(),
                        subject.getValue(), noteArea.getValue(), emailAttachmentSource);
                MailFormWindow.this.close();
            } else {
                NotificationUtil.showErrorNotification(
                        "Your email is empty value, please fulfil it before sending email!");
            }
        }
    });
    sendBtn.setIcon(FontAwesome.SEND);
    sendBtn.setStyleName(UIConstants.BUTTON_ACTION);
    controlsLayout.addComponent(sendBtn);
    controlsLayout.setComponentAlignment(sendBtn, Alignment.MIDDLE_RIGHT);
    mainLayout.addComponent(controlsLayout, 0, 2);

    this.setContent(mainLayout);
}

From source file:com.expressui.core.view.field.FormField.java

License:Open Source License

private Field generateField() {
    Class propertyType = getPropertyType();

    if (propertyType == null) {
        return null;
    }/*w w w.  j a  va  2  s . c om*/

    if (Date.class.isAssignableFrom(propertyType)) {
        return new DateField();
    }

    if (boolean.class.isAssignableFrom(propertyType) || Boolean.class.isAssignableFrom(propertyType)) {
        return new CheckBox();
    }

    if (ReferenceEntity.class.isAssignableFrom(propertyType)) {
        return new Select();
    }

    if (Currency.class.isAssignableFrom(propertyType)) {
        return new Select();
    }

    if (propertyType.isEnum()) {
        return new Select();
    }

    if (Collection.class.isAssignableFrom(propertyType)) {
        return new ListSelect();
    }

    if (getBeanPropertyType().hasAnnotation(Lob.class)) {
        return new RichTextArea();
    }

    return new TextField();
}

From source file:com.fatminds.vaadin_cmis_integration.demo.DemoPage.java

License:Apache License

@AutoGenerated
private VerticalLayout buildVerticalLayout_3() {
    // common part: create layout
    verticalLayout_3 = new VerticalLayout();
    verticalLayout_3.setImmediate(false);
    verticalLayout_3.setWidth("-1px");
    verticalLayout_3.setHeight("-1px");
    verticalLayout_3.setMargin(false);/* ww w . j  a  v  a  2s .  c  o  m*/
    verticalLayout_3.setSpacing(true);

    // richTextArea_1
    richTextArea_1 = new RichTextArea();
    richTextArea_1.setImmediate(false);
    richTextArea_1.setWidth("450px");
    richTextArea_1.setHeight("250px");
    verticalLayout_3.addComponent(richTextArea_1);

    // btnSaveContent
    btnSaveContent = new Button();
    btnSaveContent.setCaption("Save rich editor changes to cm:content");
    btnSaveContent.setImmediate(true);
    btnSaveContent.setWidth("450px");
    btnSaveContent.setHeight("-1px");
    verticalLayout_3.addComponent(btnSaveContent);

    return verticalLayout_3;
}

From source file:com.jain.addon.web.bean.factory.AbstractFieldFactory.java

License:Apache License

protected Field<?> createTextField(JNIProperty property) {
    if (property.getType() == JPropertyType.TEXT_AREA) {
        TextArea field = new TextArea();
        field.setInputPrompt(getCaption(property));
        field.setNullRepresentation("");
        field.setRows(5);/* w w  w . jav  a 2 s.c  o m*/
        return field;
    }

    if (property.getType() == JPropertyType.RICH_TEXT_AREA) {
        RichTextArea field = new RichTextArea();
        field.setNullRepresentation("");
        return field;
    }

    if (property.getType() == JPropertyType.IMAGE) {
        JImage image = new JImage();
        image.setInterruptionMessage(property.getName() + ".upload.interruption");
        image.setUploadButtonCaption(property.getName() + ".upload.button.caption");
        return image;
    }

    TextField field = new TextField();
    field.setInputPrompt(getCaption(property));
    field.setNullRepresentation("");
    return field;
}