Java Code Examples for org.vaadin.viritin.layouts.MVerticalLayout#setComponentAlignment()

The following examples show how to use org.vaadin.viritin.layouts.MVerticalLayout#setComponentAlignment() . 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: ContactInfoChangeWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withMargin(true).withFullWidth();

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    passInfo.addComponent(txtWorkPhone, UserUIContext.getMessage(UserI18nEnum.FORM_WORK_PHONE), 0, 0);
    passInfo.addComponent(txtHomePhone, UserUIContext.getMessage(UserI18nEnum.FORM_HOME_PHONE), 0, 1);
    passInfo.addComponent(txtFaceBook, "Facebook", 0, 2);
    passInfo.addComponent(txtTwitter, "Twitter", 0, 3);
    passInfo.addComponent(txtSkype, "Skype", 0, 4);

    txtWorkPhone.setValue(MoreObjects.firstNonNull(user.getWorkphone(), ""));
    txtHomePhone.setValue(MoreObjects.firstNonNull(user.getHomephone(), ""));
    txtFaceBook.setValue(MoreObjects.firstNonNull(user.getFacebookaccount(), ""));
    txtTwitter.setValue(MoreObjects.firstNonNull(user.getTwitteraccount(), ""));
    txtSkype.setValue(MoreObjects.firstNonNull(user.getSkypecontact(), ""));
    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeUserInfo())
            .withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn);
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);
    this.setContent(mainLayout);
}
 
Example 2
Source File: PasswordChangeWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth();

    Label lbInstruct1 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_1)).withFullWidth();
    mainLayout.addComponent(lbInstruct1);
    mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT);

    final Label lbInstruct2 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_2)).withFullWidth();
    mainLayout.addComponent(lbInstruct2);
    mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT);

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    txtNewPassword = new PasswordField();
    passInfo.addComponent(txtNewPassword, UserUIContext.getMessage(ShellI18nEnum.OPT_NEW_PASSWORD), 0, 0);

    txtConfirmPassword = new PasswordField();
    passInfo.addComponent(txtConfirmPassword, UserUIContext.getMessage(ShellI18nEnum.OPT_CONFIRMED_PASSWORD), 0, 1);

    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.MIDDLE_CENTER);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changePassword())
            .withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(false);
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setContent(mainLayout);
}
 
Example 3
Source File: BasicInfoChangeWindow.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withMargin(true).withFullWidth();

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    passInfo.addComponent(txtFirstName, UserUIContext.getMessage(UserI18nEnum.FORM_FIRST_NAME), 0, 0);
    passInfo.addComponent(txtLastName, UserUIContext.getMessage(UserI18nEnum.FORM_LAST_NAME), 0, 1);
    txtLastName.setRequiredIndicatorVisible(true);
    passInfo.addComponent(txtEmail, UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2);
    txtEmail.setRequiredIndicatorVisible(true);
    passInfo.addComponent(birthdayField, UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 3);
    birthdayField.setValue(user.getBirthday());

    passInfo.addComponent(timeZoneField, UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 4);
    timeZoneField.setValue(user.getTimezone());

    passInfo.addComponent(languageBox, UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE),
            UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO), 0, 5);
    languageBox.setValue(user.getLanguage());

    txtFirstName.setValue(MoreObjects.firstNonNull(user.getFirstname(), ""));
    txtLastName.setValue(MoreObjects.firstNonNull(user.getLastname(), ""));
    txtEmail.setValue(MoreObjects.firstNonNull(user.getEmail(), ""));

    mainLayout.addComponent(passInfo.getLayout());
    mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.TOP_LEFT);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeUserInfo())
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.CLIPBOARD).withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn);
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setContent(mainLayout);
}
 
Example 4
Source File: ProjectMemberListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
private Component generateMemberBlock(final SimpleProjectMember member) {
    MHorizontalLayout blockContent = new MHorizontalLayout().withSpacing(false).withStyleName("member-block").withWidth("350px");
    if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) {
        blockContent.addStyleName("inactive");
    }

    Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100);
    memberAvatar.addStyleName(WebThemes.CIRCLE_BOX);
    memberAvatar.setWidthUndefined();
    blockContent.addComponent(memberAvatar);

    MVerticalLayout blockTop = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)).withFullWidth();

    MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, member)))
            .withIcon(VaadinIcons.EDIT).withStyleName(WebThemes.BUTTON_LINK)
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    editBtn.setDescription("Edit user '" + member.getDisplayName() + "' information");

    MButton deleteBtn = new MButton("", clickEvent -> {
        ConfirmDialogExt.show(UI.getCurrent(),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppUI.getSiteName()),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                UserUIContext.getMessage(GenericI18Enum.ACTION_YES),
                UserUIContext.getMessage(GenericI18Enum.ACTION_NO),
                confirmDialog -> {
                    if (confirmDialog.isConfirmed()) {
                        ProjectMemberService prjMemberService = AppContextUtil.getSpringBean(ProjectMemberService.class);
                        prjMemberService.removeWithSession(member, UserUIContext.getUsername(), AppUI.getAccountId());
                        EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, CurrentProjectVariables.getProjectId()));
                    }
                });
    }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_LINK)
            .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS))
            .withDescription("Remove user '" + member.getDisplayName() + "' out of this project");

    MHorizontalLayout buttonControls = new MHorizontalLayout(editBtn, deleteBtn);
    blockTop.addComponent(buttonControls);
    blockTop.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT);

    A memberLink = new A(ProjectLinkGenerator.generateProjectMemberLink(member.getProjectid(), member
            .getUsername())).appendText(member.getMemberFullName()).setTitle(member.getMemberFullName());
    ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(WebThemes.TEXT_ELLIPSIS).withFullWidth();

    blockTop.with(memberNameLbl, ELabel.hr());

    A roleLink = new A(ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid()))
            .appendText(member.getRoleName());
    blockTop.addComponent(ELabel.html(roleLink.write()).withFullWidth().withStyleName(WebThemes.TEXT_ELLIPSIS));

    if (Boolean.TRUE.equals(AppUI.showEmailPublicly())) {
        Label memberEmailLabel = ELabel.html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername()))
                .withStyleName(WebThemes.META_INFO).withFullWidth();
        blockTop.addComponent(memberEmailLabel);
    }

    ELabel memberSinceLabel = ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE,
            UserUIContext.formatPrettyTime(member.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(member.getCreatedtime()))
            .withFullWidth();
    blockTop.addComponent(memberSinceLabel);

    if (ProjectMemberStatusConstants.ACTIVE.equals(member.getStatus())) {
        ELabel lastAccessTimeLbl = ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext
                .formatPrettyTime(member.getLastAccessTime())))
                .withDescription(UserUIContext.formatDateTime(member.getLastAccessTime()));
        blockTop.addComponent(lastAccessTimeLbl);
    }

    String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " " + new Span()
            .appendText("" + member.getNumOpenTasks()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) +
            "  " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " " + new Span()
            .appendText("" + member.getNumOpenBugs()).setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) +
            " " + VaadinIcons.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2,
            member.getTotalBillableLogTime())).setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) +
            "  " + VaadinIcons.GIFT.getHtml() +
            " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime()))
            .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS));

    blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(WebThemes.META_INFO));

    blockContent.with(blockTop);
    blockContent.setExpandRatio(blockTop, 1.0f);
    return blockContent;
}
 
Example 5
Source File: UserReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
private void displayUserAvatar() {
    header.removeAllComponents();
    MHorizontalLayout avatarAndPass = new MHorizontalLayout().withFullWidth();
    Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100);
    cropField.addStyleName(WebThemes.CIRCLE_BOX);
    CssLayout userAvatar = new CssLayout();
    userAvatar.addComponent(cropField);
    avatarAndPass.addComponent(userAvatar);

    MVerticalLayout basicLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true));
    CssLayout userWrapper = new CssLayout();
    String nickName = user.getNickname();
    ELabel userName = ELabel.h2(user.getDisplayName() + (StringUtils.isEmpty(nickName) ? "" : (String.format(" ( %s )", nickName))));
    userWrapper.addComponent(userName);

    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);

    GridFormLayoutHelper userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS);
    basicLayout.addComponent(userFormLayout.getLayout());

    Node roleDiv;
    if (Boolean.TRUE.equals(user.isAccountOwner())) {
        roleDiv = new Div().appendText(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
    } else {
        roleDiv = new A(AccountLinkGenerator.generateRoleLink(user.getRoleId())).appendText(user.getRoleName());
    }

    userFormLayout.addComponent(ELabel.html(roleDiv.write()), UserUIContext.getMessage(UserI18nEnum.FORM_ROLE), 0, 0);
    userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getBirthday())),
            UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 1);

    if (Boolean.TRUE.equals(AppUI.showEmailPublicly())) {
        userFormLayout.addComponent(ELabel.html(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).write()),
                UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2);
    } else {
        userFormLayout.addComponent(ELabel.html("******"), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2);
    }

    userFormLayout.addComponent(new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())),
            UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 3);
    userFormLayout.addComponent(new Label(LocalizationHelper.getLocaleInstance(user.getLanguage()).getDisplayLanguage(UserUIContext.getUserLocale())),
            UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), 0, 4);

    if (UserUIContext.isAdmin()) {
        MButton btnChangePassword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE),
                clickEvent -> UI.getCurrent().addWindow(new PasswordChangeWindow(user)))
                .withStyleName(WebThemes.BUTTON_LINK);
        ELabel label = ELabel.EMPTY_SPACE();
        userFormLayout.addComponent(new MHorizontalLayout(new ELabel("***********"), btnChangePassword, label).expand(label),
                UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), 0, 5);
    }

    avatarAndPass.with(basicLayout).withAlign(basicLayout, Alignment.TOP_LEFT).expand(basicLayout);

    Layout controlButtons = createTopPanel();
    CssLayout avatarAndPassWrapper = new CssLayout();
    avatarAndPass.setWidthUndefined();
    avatarAndPassWrapper.addComponent(avatarAndPass);
    header.with(avatarAndPass, controlButtons).withAlign(avatarAndPass, Alignment.TOP_LEFT)
            .withAlign(controlButtons, Alignment.TOP_RIGHT);
}
 
Example 6
Source File: ProfileReadViewImpl.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
private void displayUserAvatar() {
    avatarAndPass.removeAllComponents();
    Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(UserUIContext.getUserAvatarId(), 100);
    cropField.addStyleName(WebThemes.CIRCLE_BOX);
    CssLayout avatarWrapper = new CssLayout();
    avatarWrapper.addComponent(cropField);
    MVerticalLayout userAvatar = new MVerticalLayout().withMargin(false).with(avatarWrapper);
    userAvatar.setSizeUndefined();

    UploadImageField avatarUploadField = new UploadImageField(this);
    avatarUploadField.setButtonCaption(UserUIContext.getMessage(UserI18nEnum.BUTTON_CHANGE_AVATAR));
    userAvatar.addComponent(avatarUploadField);

    avatarAndPass.with(userAvatar);

    User user = formItem.getBean();
    MVerticalLayout basicLayout = new MVerticalLayout().withMargin(false);

    ELabel usernameLbl = ELabel.h2(UserUIContext.getUser().getDisplayName()).withUndefinedWidth();

    MButton btnChangeBasicInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            clickEvent -> UI.getCurrent().addWindow(new BasicInfoChangeWindow(formItem.getBean())))
            .withStyleName(WebThemes.BUTTON_LINK);

    MHorizontalLayout userWrapper = new MHorizontalLayout(usernameLbl, btnChangeBasicInfo);
    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);

    GridFormLayoutHelper userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS);
    userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getBirthday())),
            UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 0);
    userFormLayout.addComponent(ELabel.html(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).setTarget("_blank").write()),
            UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 1);
    userFormLayout.addComponent(new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())),
            UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 2);
    userFormLayout.addComponent(new Label(LocalizationHelper.getLocaleInstance(user.getLanguage()).getDisplayLanguage(UserUIContext.getUserLocale())),
            UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO), 0, 3);

    MButton btnChangePassword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE),
            clickEvent -> UI.getCurrent().addWindow(new PasswordChangeWindow(formItem.getBean())))
            .withStyleName(WebThemes.BUTTON_LINK);
    userFormLayout.addComponent(new CssLayout(new MHorizontalLayout(new ELabel("***********"), btnChangePassword).withAlign(btnChangePassword, Alignment.TOP_RIGHT)),
            UserUIContext.getMessage(ShellI18nEnum.FORM_PASSWORD), 0, 4);
    basicLayout.addComponent(userFormLayout.getLayout());

    avatarAndPass.with(basicLayout).expand(basicLayout);
}
 
Example 7
Source File: MailFormWindow.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth();

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

    mainLayout.addComponent(inputLayout);

    tokenFieldMailTo = new EmailTokenField();
    inputLayout.addComponent(createTextFieldMailWithHelp("To:", tokenFieldMailTo), 0, 0);

    if (mails != null) {
        mails.stream().filter(mail -> mail.indexOf("<") > 0).map(mail -> {
            String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
            if (strMail != null && !strMail.equalsIgnoreCase("null")) {
                return strMail;
            } else {
                return "";
            }
        });
    }

    final MTextField subject = new MTextField().withRequiredIndicatorVisible(true).withFullWidth();
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);

    initButtonLinkCcBcc();

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

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

    final AttachmentPanel attachments = new AttachmentPanel();

    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.getListRecipients().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> files = attachments.files();
            List<AttachmentSource> attachmentSource = new ArrayList<>();
            if (CollectionUtils.isNotEmpty(files)) {
                files.forEach(file -> attachmentSource.add(new FileAttachmentSource(file)));
            }

            if (reportTemplateExecutor != null) {
                attachmentSource.add(new FileAttachmentSource(reportTemplateExecutor.getDefaultExportFileName(),
                        reportTemplateExecutor.exportStream()));
            }

            systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(), UserUIContext.getUser().getDisplayName(),
                    tokenFieldMailTo.getListRecipients(), tokenFieldMailCc.getListRecipients(),
                    tokenFieldMailBcc.getListRecipients(), subject.getValue(),
                    noteArea.getValue(), attachmentSource, true);
            close();
        } else {
            NotificationUtil.showErrorNotification("Your email is empty value, please fulfil it before sending email!");
        }
    }).withIcon(VaadinIcons.PAPERPLANE).withStyleName(WebThemes.BUTTON_ACTION);

    MHorizontalLayout controlsLayout = new MHorizontalLayout(cancelBtn, sendBtn)
            .withMargin(new MarginInfo(false, true, true, false));
    mainLayout.with(attachments);
    mainLayout.addStyleName(WebThemes.SCROLLABLE_CONTAINER);
    this.setContent(new MVerticalLayout(mainLayout, controlsLayout).withMargin(false)
            .withSpacing(false).withAlign(controlsLayout, Alignment.TOP_RIGHT));
}