Example usage for com.vaadin.ui Button addStyleName

List of usage examples for com.vaadin.ui Button addStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Button addStyleName.

Prototype

@Override
    public void addStyleName(String style) 

Source Link

Usage

From source file:com.esofthead.mycollab.module.project.view.milestone.ToggleMilestoneSummaryField.java

License:Open Source License

ToggleMilestoneSummaryField(final SimpleMilestone milestone, int maxLength) {
    this.milestone = milestone;
    this.maxLength = maxLength;
    this.setWidth("100%");
    titleLinkLbl = new ELabel(buildMilestoneLink(), ContentMode.HTML).withStyleName(ValoTheme.LABEL_H3)
            .withWidthUndefined();/*from   w  ww.ja v  a 2s  .  c om*/
    titleLinkLbl.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLinkLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        this.addStyleName("editable-field");
        Button instantEditBtn = new Button(null, new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                if (isRead) {
                    ToggleMilestoneSummaryField.this.removeComponent(titleLinkLbl);
                    ToggleMilestoneSummaryField.this.removeComponent(buttonControls);
                    final TextField editField = new TextField();
                    editField.setValue(milestone.getName());
                    editField.setWidth("100%");
                    editField.focus();
                    ToggleMilestoneSummaryField.this.addComponent(editField);
                    ToggleMilestoneSummaryField.this.removeStyleName("editable-field");
                    editField.addValueChangeListener(new Property.ValueChangeListener() {
                        @Override
                        public void valueChange(Property.ValueChangeEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    editField.addBlurListener(new FieldEvents.BlurListener() {
                        @Override
                        public void blur(FieldEvents.BlurEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    isRead = !isRead;
                }
            }
        });
        instantEditBtn.setDescription("Edit task name");
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setIcon(FontAwesome.EDIT);
        buttonControls.with(instantEditBtn);
        this.addComponent(buttonControls);
    }
}

From source file:com.esofthead.mycollab.module.project.view.page.PageListNoItemView.java

License:Open Source License

protected MHorizontalLayout createControlButtons() {
    Button createPageBtn = new Button(actionMessage(), actionListener());
    createPageBtn.setEnabled(hasPermission());
    createPageBtn.addStyleName(UIConstants.THEME_GREEN_LINK);

    Button createPageGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP),
            new Button.ClickListener() {
                @Override/*from   w  w  w . java  2  s .  c  o m*/
                public void buttonClick(Button.ClickEvent event) {
                    UI.getCurrent().addWindow(new GroupPageAddWindow());
                }
            });
    createPageGroupBtn.setEnabled(hasPermission());
    createPageGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK);

    MHorizontalLayout links = new MHorizontalLayout();
    links.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    links.with(createPageBtn, new Label(" or "), createPageGroupBtn);
    return links;
}

From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java

License:Open Source License

private Layout displayFolderBlock(final Folder resource) {
    MHorizontalLayout container = new MHorizontalLayout().withWidth("100%").withStyleName("page-item-block");

    FontIconLabel iconResource = new FontIconLabel(FontAwesome.FOLDER_OPEN);
    iconResource.addStyleName("icon-48px");

    VerticalLayout block = new VerticalLayout();
    block.setWidth("600px");
    HorizontalLayout headerPanel = new HorizontalLayout();
    Button folderLink = new Button(resource.getName(), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override// w  w  w.  jav  a  2s.  c  o m
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance()
                    .post(new PageEvent.GotoList(PageListViewImpl.this, resource.getPath()));

        }
    });
    folderLink.addStyleName("link");
    folderLink.addStyleName("h3");
    headerPanel.addComponent(folderLink);
    block.addComponent(headerPanel);
    block.addComponent(new Label(StringUtils.trimHtmlTags(resource.getDescription())));

    Label lastUpdateInfo = new Label(AppContext.getMessage(Page18InEnum.LABEL_LAST_UPDATE,
            ProjectLinkBuilder.generateProjectMemberHtmlLink(resource.getCreatedUser(),
                    CurrentProjectVariables.getProjectId()),
            AppContext.formatDateTime(resource.getCreatedTime().getTime())), ContentMode.HTML);
    lastUpdateInfo.addStyleName("last-update-info");
    block.addComponent(lastUpdateInfo);

    MHorizontalLayout controlBtns = new MHorizontalLayout().withStyleName("control-btns");
    Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() {

        private static final long serialVersionUID = -5387015552598157076L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().addWindow(new PageGroupWindow(resource));
        }
    });
    editBtn.setIcon(FontAwesome.EDIT);
    editBtn.setStyleName("link");
    editBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    controlBtns.addComponent(editBtn);

    Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
            new Button.ClickListener() {

                private static final long serialVersionUID = -5387015552598157076L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    ConfirmDialogExt.show(UI.getCurrent(),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                    SiteConfiguration.getSiteName()),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                            AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                            AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                                private static final long serialVersionUID = 1L;

                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        PageService wikiService = ApplicationContextUtil
                                                .getSpringBean(PageService.class);
                                        wikiService.removeResource(resource.getPath());
                                        resources.remove(resource);
                                        displayPages(resources);
                                    }
                                }
                            });

                }
            });
    deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES));
    deleteBtn.setIcon(FontAwesome.TRASH_O);
    deleteBtn.setStyleName("link");
    controlBtns.addComponent(deleteBtn);

    block.addComponent(controlBtns);

    HorizontalLayout footer = new HorizontalLayout();
    block.addComponent(footer);

    MHorizontalLayout wrapper = new MHorizontalLayout();
    wrapper.with(iconResource, block);
    container.with(wrapper);
    return container;
}

From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java

License:Open Source License

private Layout displayPageBlock(final Page resource) {
    MHorizontalLayout container = new MHorizontalLayout().withWidth("100%").withStyleName("page-item-block");

    FontIconLabel iconResource = new FontIconLabel(FontAwesome.FILE_WORD_O);
    iconResource.addStyleName("icon-48px");

    VerticalLayout block = new VerticalLayout();
    block.setWidth("600px");
    HorizontalLayout headerPanel = new HorizontalLayout();
    Button pageLink = new Button(resource.getSubject(), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*from   w w w.  j a v  a 2  s. co  m*/
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new PageEvent.GotoRead(PageListViewImpl.this, resource));

        }
    });
    pageLink.addStyleName("link");
    pageLink.addStyleName("h3");
    headerPanel.addComponent(pageLink);

    block.addComponent(headerPanel);

    block.addComponent(new Label(StringUtils.trimHtmlTags(resource.getContent())));

    Label lastUpdateInfo = new Label(AppContext.getMessage(Page18InEnum.LABEL_LAST_UPDATE,
            ProjectLinkBuilder.generateProjectMemberHtmlLink(resource.getLastUpdatedUser(),
                    CurrentProjectVariables.getProjectId()),
            AppContext.formatDateTime(resource.getLastUpdatedTime().getTime())), ContentMode.HTML);
    lastUpdateInfo.addStyleName("last-update-info");
    block.addComponent(lastUpdateInfo);

    MHorizontalLayout controlBtns = new MHorizontalLayout().withStyleName("control-btns");
    Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() {

        private static final long serialVersionUID = -5387015552598157076L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new PageEvent.GotoEdit(PageListViewImpl.this, resource));
        }
    });
    editBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    editBtn.setIcon(FontAwesome.EDIT);
    editBtn.setStyleName("link");
    controlBtns.addComponent(editBtn);

    Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
            new Button.ClickListener() {

                private static final long serialVersionUID = 2575434171770462361L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    ConfirmDialogExt.show(UI.getCurrent(),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                    SiteConfiguration.getSiteName()),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                            AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                            AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                                private static final long serialVersionUID = 1L;

                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        PageService wikiService = ApplicationContextUtil
                                                .getSpringBean(PageService.class);
                                        wikiService.removeResource(resource.getPath());
                                        resources.remove(resource);
                                        displayPages(resources);
                                    }
                                }
                            });

                }
            });
    deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES));
    deleteBtn.setIcon(FontAwesome.TRASH_O);
    deleteBtn.setStyleName("link");
    controlBtns.addComponent(deleteBtn);

    block.addComponent(controlBtns);

    MHorizontalLayout wrapper = new MHorizontalLayout();
    wrapper.with(iconResource, block);
    container.with(wrapper);
    return container;
}

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

License:Open Source License

public ProjectAddBaseTemplateWindow() {
    super(AppContext.getMessage(ProjectI18nEnum.OPT_CREATE_PROJECT_FROM_TEMPLATE));
    this.setModal(true);
    this.setClosable(true);
    this.setResizable(false);
    this.setWidth("550px");
    MVerticalLayout content = new MVerticalLayout();
    GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3);
    final TemplateProjectComboBox templateProjectComboBox = new TemplateProjectComboBox();
    Button helpBtn = new Button("");
    helpBtn.setIcon(FontAwesome.QUESTION_CIRCLE);
    helpBtn.addStyleName(UIConstants.BUTTON_ACTION);
    helpBtn.setDescription(AppContext.getMessage(ProjectI18nEnum.OPT_MARK_TEMPLATE_HELP));
    gridFormLayoutHelper// www  .j  av  a2 s.c om
            .addComponent(
                    new MHorizontalLayout().withFullWidth().with(templateProjectComboBox, helpBtn)
                            .expand(templateProjectComboBox),
                    AppContext.getMessage(ProjectI18nEnum.FORM_TEMPLATE), 0, 0);
    final TextField prjNameField = new TextField();
    gridFormLayoutHelper.addComponent(prjNameField, AppContext.getMessage(GenericI18Enum.FORM_NAME), 0, 1);
    final TextField prjKeyField = new TextField();
    gridFormLayoutHelper.addComponent(prjKeyField, AppContext.getMessage(ProjectI18nEnum.FORM_SHORT_NAME), 0,
            2);
    MHorizontalLayout buttonControls = new MHorizontalLayout();
    content.with(gridFormLayoutHelper.getLayout(), buttonControls).withAlign(buttonControls,
            Alignment.MIDDLE_RIGHT);
    Button okBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OK), new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            SimpleProject templatePrj = (SimpleProject) templateProjectComboBox.getValue();
            if (templatePrj == null) {
                NotificationUtil.showErrorNotification(
                        AppContext.getMessage(ProjectI18nEnum.ERROR_MUST_CHOOSE_TEMPLATE_PROJECT));
                return;
            }
            String newPrjName = prjNameField.getValue();
            if (newPrjName.length() == 0) {
                NotificationUtil.showErrorNotification("Project name must be not null");
                return;
            }
            String newPrjKey = prjKeyField.getValue();
            if (newPrjKey.length() > 3 || newPrjKey.length() == 0) {
                NotificationUtil
                        .showErrorNotification("Project key must be not null and less than 3 characters");
                return;
            }
            ProjectTemplateService projectTemplateService = AppContextUtil
                    .getSpringBean(ProjectTemplateService.class);
            if (projectTemplateService != null) {
                Integer newProjectId = projectTemplateService.cloneProject(templatePrj.getId(), newPrjName,
                        newPrjKey, AppContext.getAccountId(), AppContext.getUsername());
                EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this,
                        new PageActionChain(new ProjectScreenData.Goto(newProjectId))));
                close();
            }
        }
    });
    okBtn.setIcon(FontAwesome.SAVE);
    okBtn.addStyleName(UIConstants.BUTTON_ACTION);
    Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent clickEvent) {
                    close();
                }
            });
    cancelBtn.addStyleName(UIConstants.BUTTON_OPTION);
    buttonControls.with(cancelBtn, okBtn);
    this.setContent(content);
}

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

License:Open Source License

public void displayProjectInformation() {
    this.project = CurrentProjectVariables.getProject();
    this.projectInfoHeader.removeAllComponents();
    final Button icon = new Button(null, ProjectAssetsManager.getAsset(ProjectTypeConstants.DASHBOARD));
    icon.addStyleName(UIConstants.BUTTON_ICON_ONLY);
    icon.addStyleName("icon-18px");

    final Label projectName = new Label(this.project.getName());
    projectName.setStyleName(UIConstants.PROJECT_NAME);
    projectName.setSizeUndefined();//from ww  w.  j  av a 2  s.  com
    final Label projectShortname = new Label("(" + this.project.getShortname() + ")");
    projectShortname.setStyleName(UIConstants.PROJECT_SHORT_NAME);

    this.projectInfoHeader.with(icon, projectName, projectShortname).expand(projectShortname);

    this.prjDisplay.show();
}

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

License:Open Source License

private ComponentContainer constructTableActionControls() {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
    layout.addStyleName(UIConstants.TABLE_ACTION_CONTROLS);

    selectOptionButton = new SelectionOptionButton(tableItem);
    selectOptionButton.setWidthUndefined();
    layout.addComponent(selectOptionButton);

    tableActionControls = new DefaultMassItemActionHandlerContainer();

    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();

    tableActionControls.setVisible(false);
    tableActionControls.setWidthUndefined();

    layout.addComponent(tableActionControls);
    selectedItemsNumberLabel.setWidth("100%");
    layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER)
            .expand(selectedItemsNumberLabel);

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

        @Override/*ww w  .j  a  v a2s  . c om*/
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem));

        }
    });
    customizeViewBtn.setIcon(FontAwesome.ADJUST);
    customizeViewBtn.setDescription("Layout Options");
    customizeViewBtn.addStyleName(UIConstants.BUTTON_ACTION);
    layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}

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

License:Open Source License

@Override
public MHorizontalLayout buildMenu() {
    if (serviceMenuContainer == null) {
        serviceMenuContainer = new MHorizontalLayout();
        final ServiceMenu serviceMenu = new ServiceMenu();
        serviceMenu.addService(AppContext.getMessage(ProjectI18nEnum.LIST), new Button.ClickListener() {
            @Override//from   www  .  ja va 2s  .co  m
            public void buttonClick(Button.ClickEvent clickEvent) {
                EventBusFactory.getInstance().post(new ProjectEvent.GotoUserDashboard(this, null));
                serviceMenu.selectService(0);
            }
        });
        serviceMenu.selectService(0);

        if (!SiteConfiguration.isCommunityEdition()) {
            serviceMenu.addService(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_CLIENTS),
                    new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent clickEvent) {
                            EventBusFactory.getInstance().post(new ClientEvent.GotoList(this, null));
                            serviceMenu.selectService(1);
                        }
                    });

            serviceMenu.addService(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS),
                    new Button.ClickListener() {
                        @Override
                        public void buttonClick(Button.ClickEvent clickEvent) {
                            EventBusFactory.getInstance().post(new ReportEvent.GotoConsole(this));
                            serviceMenu.selectService(2);
                        }
                    });
        }

        serviceMenuContainer.with(serviceMenu);

        Button newPrjBtn = new Button(AppContext.getMessage(ProjectI18nEnum.NEW), new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                UI.getCurrent().addWindow(new ProjectAddWindow());
            }
        });
        newPrjBtn.addStyleName("add-btn-popup");
        newPrjBtn.setIcon(FontAwesome.PLUS_CIRCLE);
        newPrjBtn.setEnabled(AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT));
        serviceMenuContainer.with(newPrjBtn).withAlign(newPrjBtn, Alignment.MIDDLE_LEFT);

        Button switchPrjBtn = new SwitchProjectPopupButton();
        serviceMenuContainer.with(switchPrjBtn).withAlign(switchPrjBtn, Alignment.MIDDLE_LEFT);
    }

    return serviceMenuContainer;
}

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

License:Open Source License

private Component generateToken(final String email) {
    final Button btn = new Button(email, FontAwesome.TIMES);
    btn.addClickListener(new Button.ClickListener() {
        @Override/*ww  w .j  a  va2  s  .c o m*/
        public void buttonClick(Button.ClickEvent event) {
            InviteUserTokenField.this.removeComponent(btn);
            inviteEmails.remove(email);
        }
    });
    btn.addStyleName("token-field");
    return btn;
}

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

License:Open Source License

private Component generateMemberBlock(final SimpleProjectMember member) {
    CssLayout memberBlock = new CssLayout();
    memberBlock.addStyleName("member-block");

    VerticalLayout blockContent = new VerticalLayout();
    MHorizontalLayout blockTop = new MHorizontalLayout();
    Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(),
            100);//from  w  w  w  .j a  va  2  s. c o  m
    blockTop.addComponent(memberAvatar);

    VerticalLayout memberInfo = new VerticalLayout();

    Button deleteBtn = new Button("", FontAwesome.TRASH_O);
    deleteBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            ConfirmDialogExt.show(UI.getCurrent(),
                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()),
                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                    AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClose(ConfirmDialog dialog) {
                            if (dialog.isConfirmed()) {
                                ProjectMemberService prjMemberService = ApplicationContextUtil
                                        .getSpringBean(ProjectMemberService.class);
                                member.setStatus(ProjectMemberStatusConstants.INACTIVE);
                                prjMemberService.updateWithSession(member, AppContext.getUsername());

                                EventBusFactory.getInstance().post(
                                        new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null));
                            }
                        }
                    });
        }
    });
    deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);

    blockContent.addComponent(deleteBtn);
    deleteBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));
    blockContent.setComponentAlignment(deleteBtn, Alignment.TOP_RIGHT);

    LabelLink memberLink = new LabelLink(member.getMemberFullName(),
            ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername()));

    memberLink.setWidth("100%");
    memberLink.addStyleName("member-name");

    memberInfo.addComponent(memberLink);

    String roleLink = "<a href=\"" + AppContext.getSiteUrl() + GenericLinkUtils.URL_PREFIX_PARAM
            + ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectRoleId())
            + "\"";
    Label memberRole = new Label();
    memberRole.setContentMode(ContentMode.HTML);
    memberRole.setStyleName("member-role");
    if (member.isAdmin()) {
        memberRole.setValue(roleLink + "style=\"color: #B00000;\">" + "Project Admin" + "</a>");
    } else {
        memberRole.setValue(roleLink + "style=\"color:gray;font-size:12px;\">" + member.getRoleName() + "</a>");
    }
    memberRole.setSizeUndefined();
    memberInfo.addComponent(memberRole);

    Label memberEmailLabel = new Label(
            "<a href='mailto:" + member.getUsername() + "'>" + member.getUsername() + "</a>", ContentMode.HTML);
    memberEmailLabel.addStyleName("member-email");
    memberEmailLabel.setWidth("100%");
    memberInfo.addComponent(memberEmailLabel);

    Label memberSinceLabel = new Label("Member since: " + AppContext.formatDate(member.getJoindate()));
    memberSinceLabel.addStyleName("member-email");
    memberSinceLabel.setWidth("100%");
    memberInfo.addComponent(memberSinceLabel);

    if (RegisterStatusConstants.SENT_VERIFICATION_EMAIL.equals(member.getStatus())) {
        final VerticalLayout waitingNotLayout = new VerticalLayout();
        Label infoStatus = new Label(AppContext.getMessage(ProjectMemberI18nEnum.WAITING_ACCEPT_INVITATION));
        infoStatus.addStyleName("member-email");
        waitingNotLayout.addComponent(infoStatus);

        ButtonLink resendInvitationLink = new ButtonLink(
                AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_RESEND_INVITATION),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        ProjectMemberMapper projectMemberMapper = ApplicationContextUtil
                                .getSpringBean(ProjectMemberMapper.class);
                        member.setStatus(RegisterStatusConstants.VERIFICATING);
                        projectMemberMapper.updateByPrimaryKeySelective(member);
                        waitingNotLayout.removeAllComponents();
                        Label statusEmail = new Label(
                                AppContext.getMessage(ProjectMemberI18nEnum.SENDING_EMAIL_INVITATION));
                        statusEmail.addStyleName("member-email");
                        waitingNotLayout.addComponent(statusEmail);
                    }
                });
        resendInvitationLink.setStyleName("link");
        resendInvitationLink.addStyleName("member-email");
        waitingNotLayout.addComponent(resendInvitationLink);
        memberInfo.addComponent(waitingNotLayout);
    } else if (RegisterStatusConstants.ACTIVE.equals(member.getStatus())) {
        Label lastAccessTimeLbl = new Label("Logged in "
                + DateTimeUtils.getPrettyDateValue(member.getLastAccessTime(), AppContext.getUserLocale()));
        lastAccessTimeLbl.addStyleName("member-email");
        memberInfo.addComponent(lastAccessTimeLbl);
    } else if (RegisterStatusConstants.VERIFICATING.equals(member.getStatus())) {
        Label infoStatus = new Label(AppContext.getMessage(ProjectMemberI18nEnum.SENDING_EMAIL_INVITATION));
        infoStatus.addStyleName("member-email");
        memberInfo.addComponent(infoStatus);
    }

    String bugStatus = member.getNumOpenBugs() + " open bug";
    if (member.getNumOpenBugs() > 1) {
        bugStatus += "s";
    }

    String taskStatus = member.getNumOpenTasks() + " open task";
    if (member.getNumOpenTasks() > 1) {
        taskStatus += "s";
    }

    Label memberWorkStatus = new Label(bugStatus + " - " + taskStatus);
    memberInfo.addComponent(memberWorkStatus);
    memberInfo.setWidth("100%");

    blockTop.addComponent(memberInfo);
    blockTop.setExpandRatio(memberInfo, 1.0f);
    blockTop.setWidth("100%");
    blockContent.addComponent(blockTop);

    blockContent.setWidth("100%");

    memberBlock.addComponent(blockContent);
    return memberBlock;
}