Example usage for com.vaadin.server FontAwesome SEND

List of usage examples for com.vaadin.server FontAwesome SEND

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome SEND.

Prototype

FontAwesome SEND

To view the source code for com.vaadin.server FontAwesome SEND.

Click Source Link

Usage

From source file:com.mycollab.module.project.view.settings.ProjectMemberInviteViewImpl.java

License:Open Source License

private Layout createButtonControls() {
    MButton inviteBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEE),
            clickEvent -> {/*from  ww  w  .j  a va 2  s.  c om*/
                roleId = (Integer) roleComboBox.getValue();
                BeanItem<SimpleProjectRole> item = (BeanItem<SimpleProjectRole>) roleComboBox.getItem(roleId);
                String roleName = (item != null) ? item.getBean().getRolename() : "";
                ProjectMemberInviteViewImpl.this.fireEvent(new ViewEvent<>(this, new InviteProjectMembers(
                        inviteUserTokenField.getInviteEmails(), roleId, roleName, messageArea.getValue())));
            }).withIcon(FontAwesome.SEND).withStyleName(WebThemes.BUTTON_ACTION);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(this, null)))
                    .withStyleName(WebThemes.BUTTON_OPTION);
    return new MHorizontalLayout(cancelBtn, inviteBtn);
}

From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java

License:Open Source License

public ProjectMemberListViewImpl() {
    super();//from  w ww .jav  a 2s  . com
    this.setMargin(new MarginInfo(false, true, true, true));
    MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullWidth();
    viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    headerText = ComponentUtils.headerH2(ProjectTypeConstants.MEMBER,
            UserUIContext.getMessage(ProjectMemberI18nEnum.LIST));
    viewHeader.with(headerText).expand(headerText);

    final MButton sortBtn = new MButton().withIcon(FontAwesome.SORT_ALPHA_ASC)
            .withStyleName(WebThemes.BUTTON_ICON_ONLY);
    sortBtn.addClickListener(clickEvent -> {
        sortAsc = !sortAsc;
        if (sortAsc) {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_ASC);
            displayMembers();
        } else {
            sortBtn.setIcon(FontAwesome.SORT_ALPHA_DESC);
            displayMembers();
        }
    });
    viewHeader.addComponent(sortBtn);

    final SearchTextField searchTextField = new SearchTextField() {
        @Override
        public void doSearch(String value) {
            searchCriteria.setMemberFullName(StringSearchField.and(value));
            displayMembers();
        }

        @Override
        public void emptySearch() {
            searchCriteria.setMemberFullName(null);
            displayMembers();
        }
    };
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_SMALL);
    viewHeader.addComponent(searchTextField);

    MButton printBtn = new MButton("", clickEvent -> {
        UI.getCurrent().addWindow(new ProjectMemberCustomizeReportOutputWindow(new LazyValueInjector() {
            @Override
            protected Object doEval() {
                return searchCriteria;
            }
        }));
    }).withIcon(FontAwesome.PRINT).withStyleName(WebThemes.BUTTON_OPTION)
            .withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    viewHeader.addComponent(printBtn);

    MButton createBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES),
            clickEvent -> EventBusFactory.getInstance()
                    .post(new ProjectMemberEvent.GotoInviteMembers(this, null)))
                            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.SEND);
    createBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    viewHeader.addComponent(createBtn);

    addComponent(viewHeader);

    contentLayout = new CssLayout();
    contentLayout.setWidth("100%");
    addComponent(contentLayout);
}

From source file:com.mycollab.module.project.view.user.ProjectInfoComponent.java

License:Open Source License

public ProjectInfoComponent(SimpleProject project) {
    this.withMargin(false).withFullWidth();
    Component projectIcon = ProjectAssetsUtil.buildProjectLogo(project.getShortname(), project.getId(),
            project.getAvatarid(), 64);//from  w  ww. j a v  a2 s  .c  o m
    this.with(projectIcon).withAlign(projectIcon, Alignment.TOP_LEFT);

    ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class);
    breadCrumb.setProject(project);
    MVerticalLayout headerLayout = new MVerticalLayout().withSpacing(false)
            .withMargin(new MarginInfo(false, true, false, true));

    MHorizontalLayout footer = new MHorizontalLayout().withStyleName(UIConstants.META_INFO,
            WebThemes.FLEX_DISPLAY);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel createdTimeLbl = ELabel
            .html(FontAwesome.CLOCK_O.getHtml() + " "
                    + UserUIContext.formatPrettyTime(project.getCreatedtime()))
            .withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME))
            .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
    footer.addComponents(createdTimeLbl);

    billableHoursLbl = ELabel
            .html(FontAwesome.MONEY.getHtml() + " "
                    + NumberUtils.roundDouble(2, project.getTotalBillableHours()))
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS))
            .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
    footer.addComponents(billableHoursLbl);

    nonBillableHoursLbl = ELabel.html(FontAwesome.GIFT.getHtml() + " " + project.getTotalNonBillableHours())
            .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS))
            .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
    footer.addComponents(nonBillableHoursLbl);

    if (project.getLead() != null) {
        Div leadAvatar = new DivLessFormatter()
                .appendChild(new Img("",
                        StorageFactory.getAvatarPath(project.getLeadAvatarId(), 16))
                                .setCSSClass(UIConstants.CIRCLE_BOX),
                        DivLessFormatter.EMPTY_SPACE(),
                        new A(ProjectLinkBuilder.generateProjectMemberFullLink(project.getId(),
                                project.getLead()))
                                        .appendText(StringUtils.trim(project.getLeadFullName(), 30, true)))
                .setTitle(project.getLeadFullName());
        ELabel leadLbl = ELabel
                .html(UserUIContext.getMessage(ProjectI18nEnum.FORM_LEADER) + ": " + leadAvatar.write())
                .withWidthUndefined();
        footer.addComponents(leadLbl);
    }
    if (project.getHomepage() != null) {
        ELabel homepageLbl = ELabel
                .html(FontAwesome.WECHAT.getHtml() + " " + new A(project.getHomepage())
                        .appendText(project.getHomepage()).setTarget("_blank").write())
                .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
        homepageLbl.setDescription(UserUIContext.getMessage(ProjectI18nEnum.FORM_HOME_PAGE));
    }

    if (project.getNumActiveMembers() > 0) {
        ELabel activeMembersLbl = ELabel.html(FontAwesome.USERS.getHtml() + " " + project.getNumActiveMembers())
                .withDescription(UserUIContext.getMessage(ProjectMemberI18nEnum.OPT_ACTIVE_MEMBERS))
                .withStyleName(ValoTheme.LABEL_SMALL).withWidthUndefined();
        footer.addComponents(activeMembersLbl);
    }

    if (project.getAccountid() != null && !SiteConfiguration.isCommunityEdition()) {
        Div clientDiv = new Div();
        if (project.getClientAvatarId() == null) {
            clientDiv.appendText(FontAwesome.INSTITUTION.getHtml() + " ");
        } else {
            Img clientImg = new Img("", StorageFactory.getEntityLogoPath(MyCollabUI.getAccountId(),
                    project.getClientAvatarId(), 16)).setCSSClass(UIConstants.CIRCLE_BOX);
            clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE());
        }
        clientDiv.appendChild(new A(ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid()))
                .appendText(StringUtils.trim(project.getClientName(), 30, true)));
        ELabel accountBtn = ELabel.html(clientDiv.write()).withStyleName(WebThemes.BUTTON_LINK)
                .withWidthUndefined();
        footer.addComponents(accountBtn);
    }

    if (!SiteConfiguration.isCommunityEdition()) {
        MButton tagBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_TAG),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoTagListView(this, null)))
                        .withIcon(FontAwesome.TAGS)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(tagBtn);

        MButton favoriteBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_FAVORITES),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoFavoriteView(this, null)))
                        .withIcon(FontAwesome.STAR)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(favoriteBtn);

        MButton eventBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_CALENDAR),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoCalendarView(this)))
                        .withIcon(FontAwesome.CALENDAR)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(eventBtn);

        MButton ganttChartBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_GANTT_CHART),
                clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoGanttChart(this, null)))
                        .withIcon(FontAwesome.BAR_CHART_O)
                        .withStyleName(WebThemes.BUTTON_SMALL_PADDING, WebThemes.BUTTON_LINK);
        footer.addComponents(ganttChartBtn);
    }

    headerLayout.with(breadCrumb, footer);

    MHorizontalLayout topPanel = new MHorizontalLayout().withMargin(false);
    this.with(headerLayout, topPanel).expand(headerLayout).withAlign(topPanel, Alignment.TOP_RIGHT);

    if (project.isProjectArchived()) {
        MButton activeProjectBtn = new MButton(
                UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), clickEvent -> {
                    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.class);
                    project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Open.name());
                    projectService.updateSelectiveWithSession(project, UserUIContext.getUsername());

                    PageActionChain chain = new PageActionChain(
                            new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId()));
                    EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain));
                }).withStyleName(WebThemes.BUTTON_ACTION);
        topPanel.with(activeProjectBtn).withAlign(activeProjectBtn, Alignment.MIDDLE_RIGHT);
    } else {
        SearchTextField searchField = new SearchTextField() {
            public void doSearch(String value) {
                ProjectView prjView = UIUtils.getRoot(this, ProjectView.class);
                if (prjView != null) {
                    prjView.displaySearchResult(value);
                }
            }

            @Override
            public void emptySearch() {

            }
        };

        final PopupButton controlsBtn = new PopupButton();
        controlsBtn.addStyleName(WebThemes.BOX);
        controlsBtn.setIcon(FontAwesome.ELLIPSIS_H);

        OptionPopupContent popupButtonsControl = new OptionPopupContent();

        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) {
            MButton inviteMemberBtn = new MButton(
                    UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), clickEvent -> {
                        controlsBtn.setPopupVisible(false);
                        EventBusFactory.getInstance()
                                .post(new ProjectMemberEvent.GotoInviteMembers(this, null));
                    }).withIcon(FontAwesome.SEND);
            popupButtonsControl.addOption(inviteMemberBtn);
        }

        MButton settingBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS),
                clickEvent -> {
                    controlsBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new ProjectNotificationEvent.GotoList(this, null));
                }).withIcon(FontAwesome.COG);
        popupButtonsControl.addOption(settingBtn);

        popupButtonsControl.addSeparator();

        if (UserUIContext.canAccess(RolePermissionCollections.CREATE_NEW_PROJECT)) {
            final MButton markProjectTemplateBtn = new MButton().withIcon(FontAwesome.ANCHOR);
            markProjectTemplateBtn.addClickListener(clickEvent -> {
                Boolean isTemplate = !MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE);
                project.setIstemplate(isTemplate);
                ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.class);
                prjService.updateWithSession(project, UserUIContext.getUsername());
                if (project.getIstemplate()) {
                    markProjectTemplateBtn
                            .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE));
                } else {
                    markProjectTemplateBtn
                            .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE));
                }
            });

            Boolean isTemplate = MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE);
            if (isTemplate) {
                markProjectTemplateBtn
                        .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE));
            } else {
                markProjectTemplateBtn
                        .setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE));
            }
            popupButtonsControl.addOption(markProjectTemplateBtn);
        }

        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) {
            MButton editProjectBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.EDIT), clickEvent -> {
                controlsBtn.setPopupVisible(false);
                EventBusFactory.getInstance()
                        .post(new ProjectEvent.GotoEdit(ProjectInfoComponent.this, project));
            }).withIcon(FontAwesome.EDIT);
            popupButtonsControl.addOption(editProjectBtn);
        }

        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) {
            MButton archiveProjectBtn = new MButton(
                    UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), clickEvent -> {
                        controlsBtn.setPopupVisible(false);
                        ConfirmDialogExt.show(UI.getCurrent(),
                                UserUIContext.getMessage(GenericI18Enum.WINDOW_WARNING_TITLE,
                                        MyCollabUI.getSiteName()),
                                UserUIContext.getMessage(
                                        ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_MESSAGE),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                                    if (confirmDialog.isConfirmed()) {
                                        ProjectService projectService = AppContextUtil
                                                .getSpringBean(ProjectService.class);
                                        project.setProjectstatus(OptionI18nEnum.StatusI18nEnum.Archived.name());
                                        projectService.updateSelectiveWithSession(project,
                                                UserUIContext.getUsername());

                                        PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(
                                                CurrentProjectVariables.getProjectId()));
                                        EventBusFactory.getInstance()
                                                .post(new ProjectEvent.GotoMyProject(this, chain));
                                    }
                                });
                    }).withIcon(FontAwesome.ARCHIVE);
            popupButtonsControl.addOption(archiveProjectBtn);
        }

        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) {
            popupButtonsControl.addSeparator();
            MButton deleteProjectBtn = new MButton(
                    UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), clickEvent -> {
                        controlsBtn.setPopupVisible(false);
                        ConfirmDialogExt.show(UI.getCurrent(),
                                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                        MyCollabUI.getSiteName()),
                                UserUIContext.getMessage(
                                        ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_MESSAGE),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                                    if (confirmDialog.isConfirmed()) {
                                        ProjectService projectService = AppContextUtil
                                                .getSpringBean(ProjectService.class);
                                        projectService.removeWithSession(CurrentProjectVariables.getProject(),
                                                UserUIContext.getUsername(), MyCollabUI.getAccountId());
                                        EventBusFactory.getInstance()
                                                .post(new ShellEvent.GotoProjectModule(this, null));
                                    }
                                });
                    }).withIcon(FontAwesome.TRASH_O);
            popupButtonsControl.addDangerOption(deleteProjectBtn);
        }

        controlsBtn.setContent(popupButtonsControl);
        controlsBtn.setWidthUndefined();

        topPanel.with(searchField, controlsBtn).withAlign(searchField, Alignment.TOP_RIGHT)
                .withAlign(controlsBtn, Alignment.TOP_RIGHT);
    }
}

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  w w w . j a  va2s. 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:ui.button.CommentButton.java

License:Apache License

@Override
public void buttonClick(ClickEvent event) {
    final TextArea text = new TextArea(
            Translator.getTranslation("Leave us a comment, suggestion or critics. ", language));
    text.setSizeFull();//w  ww  . j  a v a 2s .com
    LifetimeButtonLink go = new LifetimeButtonLink(Translator.getTranslation("Send", language),
            FontAwesome.SEND);
    go.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            String message = text.getValue();
            ServiceLocator.findLifetimeService().addComment(userId, message, language);
            if (ServiceLocator.findLifetimeService().sendMail("vitaelifetime@gmail.com", "New User Comment",
                    message)) {
                Notification.show(
                        Translator.getTranslation("Email sent! Thanks for helping us improve.", language),
                        Notification.Type.TRAY_NOTIFICATION);
            }
            window.close();
        }
    });

    window = new Window(Translator.getTranslation("Your opinion counts!", language),
            new VerticalLayout(text, go));
    window.center();
    window.setModal(true);
    window.setStyleName("window");
    window.addCloseListener(new Window.CloseListener() {

        @Override
        public void windowClose(Window.CloseEvent e) {
            window.close();
        }
    });

    getUI().addWindow(window);
}