List of usage examples for com.vaadin.ui RichTextArea getValue
@Override
public String getValue()
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 . ja v a 2 s .co m 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);/*from w w w. j a va 2s . co m*/ 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);//from w ww. j a v a 2 s.c o m 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.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);//from www. j av a 2 s.c o m 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); final AttachmentPanel attachments = new AttachmentPanel(); attachments.setWidth("500px"); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION); MButton sendBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL), clickEvent -> { 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 (UserUIContext.getUser().getEmail() != null && UserUIContext.getUser().getEmail().length() > 0) { ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.class); List<File> listFile = attachments.files(); List<AttachmentSource> attachmentSource = null; if (listFile != null && listFile.size() > 0) { attachmentSource = new ArrayList<>(); for (File file : listFile) { attachmentSource.add(new FileAttachmentSource(file)); } } systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(), UserUIContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipient(), tokenFieldMailCc.getListRecipient(), tokenFieldMailBcc.getListRecipient(), subject.getValue(), noteArea.getValue(), attachmentSource, true); close(); } else { NotificationUtil .showErrorNotification("Your email is empty value, please fulfil it before sending email!"); } }).withIcon(FontAwesome.SEND).withStyleName(WebThemes.BUTTON_ACTION); MHorizontalLayout controlsLayout = new MHorizontalLayout(attachments, cancelBtn, sendBtn) .expand(attachments).withFullWidth(); mainLayout.addComponent(controlsLayout, 0, 2); this.setContent(mainLayout); }
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.DefaultTextAreaView.java
License:Apache License
@Override public void showEditor(String xhtml) { final RichTextArea richTextArea = new RichTextArea(); richTextArea.setNullRepresentation(""); richTextArea.setWidth("100%"); richTextArea.setValue(xhtml);//from w w w . j a va 2 s . c o m Button saveButton = new Button("Speichern", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String changedContent = (String) richTextArea.getValue(); presenter.contentChanged(changedContent); } }); Button cancelButton = new Button("Abbrechen", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { presenter.cancelEditing(); } }); CssLayout buttons = new CssLayout(saveButton, cancelButton); buttons.setStyleName("actions"); VerticalLayout layout = new VerticalLayout(richTextArea, buttons); layout.setSpacing(true); if (getHeight() >= 0f) { richTextArea.setHeight("100%"); layout.setExpandRatio(richTextArea, 1f); } setCompositionRoot(layout); }
From source file:org.hip.vif.admin.admin.ui.SendMailView.java
License:Open Source License
/** @param inGroups {@link GroupContainer} * @param inTask {@link SendMailTask} */ public SendMailView(final GroupContainer inGroups, final SendMailTask inTask) { final IMessages lMessages = Activator.getMessages(); final VerticalLayout lLayout = initLayout(lMessages, "admin.send.mail.title.page"); //$NON-NLS-1$ lLayout.addComponent(new Label(lMessages.getMessage("admin.send.remark"), ContentMode.HTML)); //$NON-NLS-1$ lLayout.addComponent(RiplaViewHelper.createSpacer()); final LabelValueTable lTable = new LabelValueTable(); final ListSelect lGroups = new ListSelect(); lGroups.setContainerDataSource(inGroups); lGroups.setRows(Math.min(SELECT_SIZE, inGroups.size())); lGroups.setStyleName(VIF_STYLE);/*from w w w.j a v a 2 s. co m*/ lGroups.setMultiSelect(true); lGroups.setItemCaptionMode(ItemCaptionMode.PROPERTY); lGroups.setItemCaptionPropertyId(GroupContainer.PROPERTY_CAPTION); lGroups.focus(); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.select"), lGroups); //$NON-NLS-1$ final TextField lSubject = new TextField(); lSubject.setWidth(WIDTH, Unit.PIXELS); lSubject.setStyleName(VIF_STYLE); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.subject"), lSubject); //$NON-NLS-1$ final RichTextArea lBody = new RichTextArea(); lBody.setStyleName("vif-editor " + VIF_STYLE); //$NON-NLS-1$ lBody.setWidth(WIDTH, Unit.PIXELS); lTable.addRowEmphasized(lMessages.getMessage("admin.send.mail.label.body"), lBody); //$NON-NLS-1$ lLayout.addComponent(lTable); send = new Button(lMessages.getMessage("admin.send.mail.button.send")); //$NON-NLS-1$ // send.setClickShortcut(KeyCode.ENTER); send.addClickListener(new Button.ClickListener() { @Override @SuppressWarnings("unchecked") public void buttonClick(final ClickEvent inEvent) { if (!isValid(lGroups, lSubject, lBody)) { Notification.show(lMessages.getMessage("admin.send.mail.msg.not.valid"), //$NON-NLS-1$ Type.WARNING_MESSAGE); return; } if (!inTask.processGroups((Collection<GroupWrapper>) lGroups.getValue(), lSubject.getValue().toString(), lBody.getValue())) { Notification.show(lMessages.getMessage("admin.send.mail.msg.errmsg"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); lLayout.addComponent(send); }
From source file:org.hip.vif.admin.admin.ui.SendMailView.java
License:Open Source License
@SuppressWarnings("unchecked") private boolean isValid(final ListSelect inGroups, final TextField inSubject, final RichTextArea inBody) { return !(((Collection<GroupWrapper>) inGroups.getValue()).isEmpty() || inSubject.getValue().toString().trim().length() == 0 || inBody.getValue().trim().length() == 0); }
From source file:org.hip.vif.admin.groupadmin.ui.CompletionView.java
License:Open Source License
/** @param inEditor * @param inValueBefore/*from w w w. j a v a 2s.c o m*/ * @param inMessages * @param inTask * @return Button */ private Button createSaveButton(final RichTextArea inEditor, final String inValueBefore, final IMessages inMessages, final AbstractCompletionTask inTask) { final Button lSave = new Button(inMessages.getMessage("ui.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { final String lValue = inEditor.getValue(); if (checkEditorInput(lValue)) { //$NON-NLS-1$ inEditor.setValue(inValueBefore); //$NON-NLS-1$ Notification.show(inMessages.getMessage("errmsg.completion.not.empty"), Type.WARNING_MESSAGE); //$NON-NLS-1$ return; } if (!inTask.saveCompletion(lValue)) { Notification.show(inMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); return lSave; }
From source file:org.hip.vif.admin.groupadmin.ui.QuestionEditor.java
License:Open Source License
/** @param inTask * @param inMessages/*from w w w . j a v a 2s . c om*/ * @param inQuestionEditor * @param inRemarkEditor * @return Button */ private Button createSaveButton(final AbstractQuestionTask inTask, final RichTextArea inQuestionEditor, final RichTextArea inRemarkEditor, final IMessages inMessages) { final Button lSave = new Button(inMessages.getMessage("ui.button.save")); //$NON-NLS-1$ lSave.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent inEvent) { final String lQuestion = inQuestionEditor.getValue(); final String lRemark = inRemarkEditor.getValue(); if (checkEditorInput(lQuestion) || checkEditorInput(lRemark)) { Notification.show(inMessages.getMessage("errmsg.question.not.empty"), Type.WARNING_MESSAGE); //$NON-NLS-1$ return; } if (!inTask.saveQuestion(lQuestion, lRemark)) { Notification.show(inMessages.getMessage("errmsg.save.general"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); return lSave; }