Example usage for com.vaadin.server FontAwesome ANCHOR

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

Introduction

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

Prototype

FontAwesome ANCHOR

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

Click Source Link

Usage

From source file:com.cms.view.ListStaffDepartment.java

public ListStaffDepartment() {
    super(BundleUtils.getString("caption.title.listDept"), BundleUtils.getString("caption.title.listEmp"));
    mainLayout.setSplitPosition(30, Unit.PERCENTAGE);
    setCompositionRoot(mainLayout);/*from www.  jav  a2 s  . c  o  m*/
    //khoi tao cac thanh phan
    //khoi tao form search
    searchDepartmentForm = new DepartmentSearchPanel();
    //khoi tao table ui
    tblListDepartmentUI = new CommonTableFilterPanel();

    //100316 NgocND6 chuyen quyen quan ly hang hoa
    btnTransferRoleCusts = new Button(TRANSFERROLE);
    btnTransferRoleCusts.setIcon(new ThemeResource("img/transfer_icon.png"));
    //them cac component vao layout
    GridLayout horizontalLayout = new GridLayout(2, 1);
    horizontalLayout.setWidth("-1px");
    horizontalLayout.setMargin(true);
    horizontalLayout.setSpacing(true);
    //btn search
    btnSearchDept = new Button(Constants.BUTTON_SEARCH);
    btnSearchDept.setIcon(new ThemeResource(Constants.ICON.SEARCH));
    horizontalLayout.addComponent(btnSearchDept, 0, 0);
    //btn refresh
    btnRefreshDept = new Button(Constants.BUTTON_REFRESH);
    btnRefreshDept.setIcon(new ThemeResource(Constants.ICON.RESET));
    horizontalLayout.addComponent(btnRefreshDept, 1, 0);
    //add component
    leftLayout.addComponent(searchDepartmentForm);
    leftLayout.addComponent(horizontalLayout);
    leftLayout.addComponent(tblListDepartmentUI);
    leftLayout.setComponentAlignment(horizontalLayout, Alignment.MIDDLE_CENTER);
    leftLayout.setMargin(true);

    //===============right==========================
    searchStaffForm = new StaffSearchPanel();
    //khoi tao table ui
    tblListStaffUI = new CommonTableFilterPanel();

    btnAddMapStaffCustomer = new Button(BundleUtils.getString("staff.customer.map"));
    btnAddMapStaffCustomer.setDescription(BundleUtils.getString("staff.customer.map"));
    btnAddMapStaffCustomer.setIcon(new ThemeResource(Constants.ICON.IMPORT));

    btnAssignRole = new Button(BundleUtils.getString("assign.roles.button"));
    btnAssignRole.setIcon(FontAwesome.ANCHOR);
    //them cac component vao layout
    GridLayout horizontalLayout2 = new GridLayout(3, 1);
    horizontalLayout2.setWidth("-1px");
    horizontalLayout2.setMargin(true);
    horizontalLayout2.setSpacing(true);
    //NgocND6 tao layout de add button chuyen quyen cho nhan vien
    GridLayout gridLayout = new GridLayout(3, 1);
    gridLayout.setMargin(true);
    gridLayout.setSpacing(true);
    gridLayout.addComponent(btnAssignRole, 0, 0);
    //        gridLayout.addComponent(btnAddMapStaffCustomer, 1, 0);
    gridLayout.addComponent(btnTransferRoleCusts, 2, 0);
    //Tam thoi an nut phan bo lai khach hang
    btnTransferRoleCusts.setVisible(false);
    //btn search emp
    btnSearchEmp = new Button(Constants.BUTTON_SEARCH);
    btnSearchEmp.setIcon(new ThemeResource(Constants.ICON.SEARCH));
    horizontalLayout2.addComponent(btnSearchEmp, 0, 0);
    //btn refresh emp
    btnRefreshEmp = new Button(Constants.BUTTON_REFRESH);
    btnRefreshEmp.setIcon(new ThemeResource(Constants.ICON.RESET));
    horizontalLayout2.addComponent(btnRefreshEmp, 1, 0);
    //

    //add component
    rightLayout.addComponent(searchStaffForm);
    rightLayout.addComponent(horizontalLayout2);
    rightLayout.addComponent(tblListStaffUI);
    rightLayout.setComponentAlignment(horizontalLayout2, Alignment.MIDDLE_CENTER);
    rightLayout.addComponent(gridLayout);
    rightLayout.setComponentAlignment(gridLayout, Alignment.MIDDLE_CENTER);
    rightLayout.setMargin(true);
    //=============

    this.listDeptAndStaffController = new ListDeptAndStaffController(this);
}

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 av a 2 s .  com*/
    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);
    }
}