Example usage for com.vaadin.ui Label setStyleName

List of usage examples for com.vaadin.ui Label setStyleName

Introduction

In this page you can find the example usage for com.vaadin.ui Label setStyleName.

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

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

License:Open Source License

@Override
public void displayTags(Tag tag) {
    removeAllComponents();/*w ww  . ja va  2  s.co m*/

    MHorizontalLayout header = new MHorizontalLayout().withStyleName("hdr-view").withWidth("100%");

    Label headerLbl = new Label(FontAwesome.TAGS.getHtml() + " Tags", ContentMode.HTML);
    headerLbl.setSizeUndefined();
    headerLbl.setStyleName("hdr-text");
    header.with(headerLbl);

    MHorizontalLayout contentWrapper = new MHorizontalLayout();

    MVerticalLayout rightSideBar = new MVerticalLayout().withSpacing(false).withWidth("450px");
    MHorizontalLayout panelHeader = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true))
            .withHeight("34px").withWidth("100%");
    panelHeader.addStyleName("panel-header");
    Label lbl = new Label("Tag Cloud");
    panelHeader.with(lbl);

    TagCloudComp cloudComp = new TagCloudComp();
    cloudComp.displayTagItems();
    rightSideBar.with(panelHeader, cloudComp);

    contentWrapper.with(rightSideBar);
    with(header, contentWrapper);
}

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

License:Open Source License

public GanttChartViewImpl() {
    this.withMargin(new MarginInfo(false, true, true, true));

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withStyleName("hdr-view").withWidth("100%");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label headerText = new Label(FontAwesome.BAR_CHART_O.getHtml() + " Gantt chart", ContentMode.HTML);
    headerText.setStyleName(UIConstants.HEADER_TEXT);

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

        @Override/* w w  w  . j  a v  a 2 s.c o m*/
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null));
        }
    });
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP));

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

        @Override
        public void buttonClick(Button.ClickEvent event) {
            TaskSearchCriteria searchCriteria = new TaskSearchCriteria();
            searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
            searchCriteria.setStatuses(
                    new SetSearchField<>(new String[] { OptionI18nEnum.StatusI18nEnum.Open.name() }));
            TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search");
            taskFilter.setAdvanceSearch(true);
            EventBusFactory.getInstance().post(new TaskEvent.Search(this, taskFilter));
        }
    });
    simpleDisplayBtn.setIcon(FontAwesome.LIST_UL);
    simpleDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.LIST_VIEW_TOOLTIP));

    Button chartDisplayBtn = new Button();
    chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O);

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(simpleDisplayBtn);
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(chartDisplayBtn);
    viewButtons.setDefaultButton(chartDisplayBtn);

    header.with(headerText, viewButtons).withAlign(headerText, Alignment.MIDDLE_LEFT).expand(headerText);

    taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class);

    HorizontalLayout ganttLayout = constructGanttChart();

    MVerticalLayout wrapContent = new MVerticalLayout().withSpacing(false).withMargin(false)
            .withStyleName("gantt-view").with(createControls(), ganttLayout);
    this.with(header, wrapContent);
}

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

License:Open Source License

private void constructHeader() {
    CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.addStyleName("taskgroup-header");

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);/*from  w  ww . j a  v a  2s  . c o  m*/
    header.setWidth("100%");
    Label headerLbl = new Label("All Tasks");
    headerLbl.setStyleName("h2");
    header.addComponent(headerLbl);
    header.setComponentAlignment(headerLbl, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(headerLbl, 1.0f);

    Button backToListBtn = new Button("Back to dashboard", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null));
        }
    });
    backToListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(backToListBtn);
    header.setComponentAlignment(backToListBtn, Alignment.MIDDLE_RIGHT);

    saveOrderBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.SaveReoderTaskList(event, changeSet));
        }
    });
    saveOrderBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(saveOrderBtn);
    header.setComponentAlignment(saveOrderBtn, Alignment.MIDDLE_RIGHT);

    headerWrapper.addComponent(header);

    this.addComponent(headerWrapper);

    final DDVerticalLayout ddLayout = new DDVerticalLayout();
    ddLayout.addStyleName("taskgroup-reorder");
    ddLayout.setComponentVerticalDropRatio(0.3f);
    ddLayout.setDragMode(LayoutDragMode.CLONE);
    ddLayout.setDropHandler(new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return new Not(VerticalLocationIs.MIDDLE);
        }

        @Override
        public void drop(DragAndDropEvent event) {
            LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable();

            DDVerticalLayout.VerticalLayoutTargetDetails details = (DDVerticalLayout.VerticalLayoutTargetDetails) event
                    .getTargetDetails();

            TaskListComponent comp = (TaskListComponent) transferable.getComponent();

            int currentIndex = ddLayout.getComponentIndex(comp);
            int newIndex = details.getOverIndex();

            ddLayout.removeComponent(comp);

            if (currentIndex > newIndex && details.getDropLocation() == VerticalDropLocation.BOTTOM) {
                newIndex++;
            }

            SimpleTaskList dropTaskList = comp.getTaskList();
            dropTaskList.setGroupindex(newIndex);
            changeSet.add(dropTaskList);
            ddLayout.addComponent(comp, newIndex);

            // change affected task list items
            for (int i = 0; i < ddLayout.getComponentCount(); i++) {
                TaskListComponent affectedComp = (TaskListComponent) ddLayout.getComponent(i);
                SimpleTaskList affectedTaskList = affectedComp.getTaskList();
                affectedTaskList.setGroupindex(i);
                changeSet.add(affectedTaskList);
            }
        }
    });

    taskLists = new BeanList<ProjectTaskListService, TaskListSearchCriteria, SimpleTaskList>(null,
            ApplicationContextUtil.getSpringBean(ProjectTaskListService.class), TaskListRowDisplayHandler.class,
            ddLayout);
    this.addComponent(taskLists);
}

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

License:Open Source License

protected void feedBlocksPut(Date currentDate, Date nextDate, CssLayout currentBlock) {
    MHorizontalLayout blockWrapper = new MHorizontalLayout().withWidth("100%").withStyleName("feed-block-wrap");

    blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    Calendar cal1 = Calendar.getInstance();
    cal1.setTime(currentDate);/*ww  w .  j a v a  2 s .  co m*/

    Calendar cal2 = Calendar.getInstance();
    cal2.setTime(nextDate);

    if (cal1.get(Calendar.YEAR) != cal2.get(Calendar.YEAR)) {
        int currentYear = cal2.get(Calendar.YEAR);
        Label yearLbl = new Label(String.valueOf(currentYear));
        yearLbl.setStyleName("year-lbl");
        yearLbl.setWidthUndefined();
        yearLbl.setHeight("49px");
        this.listContainer.addComponent(yearLbl);
    } else {
        blockWrapper.setMargin(new MarginInfo(true, false, false, false));
    }
    Label dateLbl = new Label(DateFormatUtils.format(nextDate, AppContext.getUserDayMonthFormat()));
    dateLbl.setSizeUndefined();
    dateLbl.setStyleName("date-lbl");
    blockWrapper.addComponent(dateLbl);
    blockWrapper.addComponent(currentBlock);
    blockWrapper.setExpandRatio(currentBlock, 1.0f);

    this.listContainer.addComponent(blockWrapper);
}

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

License:Open Source License

public ProjectListComponent() {
    super();/*from  ww  w .ja  va2 s . c om*/
    withSpacing(true).withMargin(false).withWidth("100%").withStyleName("project-list-comp");

    MHorizontalLayout headerBar = new MHorizontalLayout();

    headerPopupButton = new PopupButton();
    headerPopupButton.setStyleName("project-list-comp-hdr");
    headerPopupButton.setWidth("100%");

    Label componentHeader = new Label();
    componentHeader.setStyleName("h2");

    headerPopupButton.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT));
    headerBar.with(headerPopupButton);

    if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) {
        final Button createProjectBtn = new Button("+", new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final Button.ClickEvent event) {
                final ProjectAddWindow projectNewWindow = new ProjectAddWindow();
                UI.getCurrent().addWindow(projectNewWindow);
            }
        });
        createProjectBtn.setStyleName("add-project-btn");
        createProjectBtn.setDescription("New Project");
        createProjectBtn.setWidth("20px");
        createProjectBtn.setHeight("20px");

        headerBar.with(createProjectBtn).withAlign(createProjectBtn, Alignment.MIDDLE_RIGHT);
    }

    headerBar.withWidth("100%").withSpacing(true).expand(headerPopupButton);

    this.addComponent(headerBar);

    contentLayout = new MVerticalLayout().withStyleName("project-list-comp-content").withWidth("205px");

    projectList = new ProjectPagedList();
    headerPopupButton.setContent(projectList);

    projectDesc = new Label("", ContentMode.HTML);
    projectDesc.setStyleName("project-description");
    addComponent(projectDesc);
}

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

License:Open Source License

@Override
protected void displayView() {
    this.removeAllComponents();

    this.withMargin(false).withWidth("100%");

    final CssLayout headerWrapper = new CssLayout();
    headerWrapper.setWidth("100%");
    headerWrapper.setStyleName("projectfeed-hdr-wrapper");

    final MHorizontalLayout header = new MHorizontalLayout().withMargin(false).withWidth("100%");
    header.addStyleName("projectfeed-hdr");

    Button avatar = UserAvatarControlFactory.createUserAvatarEmbeddedButton(AppContext.getUserAvatarId(), 64);
    avatar.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override//from w  w  w  .  j a v a 2s .  c om
        public void buttonClick(final ClickEvent event) {
            String userFullLinkStr = AccountLinkGenerator.generatePreviewFullUserLink(AppContext.getSiteUrl(),
                    AppContext.getUsername());
            getUI().getPage().open(userFullLinkStr, null);
        }
    });

    header.addComponent(avatar);

    final MVerticalLayout headerContent = new MVerticalLayout()
            .withMargin(new MarginInfo(false, false, false, true));
    headerContent.addStyleName("projectfeed-hdr-content");

    final Label headerLabel = new Label(AppContext.getSession().getDisplayName());
    headerLabel.setStyleName(Reindeer.LABEL_H1);

    final MHorizontalLayout headerContentTop = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, false, true, false));
    headerContentTop.with(headerLabel).withAlign(headerLabel, Alignment.TOP_LEFT);

    if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) {
        final Button createProjectBtn = new Button(
                AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_NEW_PROJECT), new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final Button.ClickEvent event) {
                        final ProjectAddWindow projectNewWindow = new ProjectAddWindow();
                        UI.getCurrent().addWindow(projectNewWindow);
                    }
                });
        createProjectBtn.setIcon(FontAwesome.PLUS);
        createProjectBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        headerContentTop.addComponent(createProjectBtn);
        headerContentTop.setComponentAlignment(createProjectBtn, Alignment.MIDDLE_LEFT);
    }

    followingTicketsLink = new LabelLink(AppContext.getMessage(FollowerI18nEnum.OPT_MY_FOLLOWING_TICKETS, 0),
            AppContext.getSiteUrl() + "#project/following");

    followingTicketsLink.setIconLink(FontAwesome.EYE);

    LabelLink timeTrackingLink = new LabelLink(AppContext.getMessage(TimeTrackingI18nEnum.TIME_RECORD_HEADER),
            AppContext.getSiteUrl() + "#project/timetracking");
    timeTrackingLink.setIconLink(ProjectAssetsManager.getAsset(ProjectTypeConstants.TIME));

    final MHorizontalLayout headerContentBottom = new MHorizontalLayout().withMargin(false)
            .with(followingTicketsLink, timeTrackingLink);

    headerContent.with(headerContentTop, headerContentBottom);

    header.with(headerContent).expand(headerContent);
    headerWrapper.addComponent(header);

    this.addComponent(headerWrapper);

    final MHorizontalLayout layout = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, false, true, false)).withWidth("100%");

    ActivityStreamComponent activityStreamComponent = new ActivityStreamComponent();
    final MVerticalLayout leftPanel = new MVerticalLayout().withSpacing(false)
            .withMargin(new MarginInfo(false, true, false, false)).withWidth("100%")
            .with(activityStreamComponent);

    final MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false).withWidth("565px");
    MyProjectListComponent myProjectListComponent = new MyProjectListComponent();
    TaskStatusComponent taskStatusComponent = new TaskStatusComponent();
    rightPanel.with(myProjectListComponent, taskStatusComponent);

    layout.with(leftPanel, rightPanel).expand(leftPanel);

    final CssLayout contentWrapper = new CssLayout();
    contentWrapper.setWidth("100%");
    contentWrapper.addStyleName("content-wrapper");
    this.addComponent(contentWrapper);
    contentWrapper.addComponent(layout);

    final ProjectService prjService = ApplicationContextUtil.getSpringBean(ProjectService.class);
    prjKeys = prjService.getProjectKeysUserInvolved(AppContext.getUsername(), AppContext.getAccountId());
    if (CollectionUtils.isNotEmpty(prjKeys)) {
        activityStreamComponent.showFeeds(prjKeys);
        myProjectListComponent.displayDefaultProjectsList();
        displayFollowingTicketsCount();
    }

    taskStatusComponent.showProjectTasksByStatus(prjKeys);

}

From source file:com.esofthead.mycollab.module.user.accountsettings.profile.view.ProfileReadViewImpl.java

License:Open Source License

private void displayUserAvatar() {
    this.userAvatar.removeAllComponents();
    final Image cropField = UserAvatarControlFactory
            .createUserAvatarEmbeddedComponent(AppContext.getUserAvatarId(), 100);
    userAvatar.addComponent(cropField);//from w  w w  .  j a v  a 2 s.c o  m

    this.avatarAndPass.removeAllComponents();
    avatarAndPass.addComponent(userAvatar);

    User user = formItem.getUser();

    final VerticalLayout basicLayout = new VerticalLayout();
    basicLayout.setSpacing(true);

    final HorizontalLayout userWrapper = new HorizontalLayout();

    final Label userName = new Label(AppContext.getSession().getDisplayName());
    userName.setStyleName("h1");
    userWrapper.addComponent(userName);

    final Button btnChangeBasicInfo = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    UI.getCurrent().addWindow(new BasicInfoChangeWindow(formItem.getUser()));
                }
            });
    btnChangeBasicInfo.setStyleName("link");
    HorizontalLayout btnChangeBasicInfoWrapper = new HorizontalLayout();
    btnChangeBasicInfoWrapper.setWidth("40px");
    btnChangeBasicInfoWrapper.addComponent(btnChangeBasicInfo);
    btnChangeBasicInfoWrapper.setComponentAlignment(btnChangeBasicInfo, Alignment.MIDDLE_RIGHT);
    userWrapper.addComponent(btnChangeBasicInfoWrapper);
    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);

    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY) + ": "
            + AppContext.formatDate(user.getDateofbirth())));
    basicLayout.addComponent(
            new MHorizontalLayout(new Label(AppContext.getMessage(UserI18nEnum.FORM_EMAIL) + ": "),
                    new LabelLink(user.getEmail(), "mailto:" + user.getEmail())));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE) + ": "
            + TimezoneMapper.getTimezone(user.getTimezone()).getDisplayName()));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE) + ": "
            + AppContext.getMessage(LangI18Enum.class, user.getLanguage())));

    HorizontalLayout passwordWrapper = new HorizontalLayout();
    passwordWrapper
            .addComponent(new Label(AppContext.getMessage(ShellI18nEnum.FORM_PASSWORD) + ": ***********"));

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

        @Override
        public void buttonClick(final ClickEvent event) {
            UI.getCurrent().addWindow(new PasswordChangeWindow(formItem.user));
        }
    });
    btnChangePassword.setStyleName("link");
    HorizontalLayout btnChangePasswordWrapper = new HorizontalLayout();
    btnChangePasswordWrapper.setWidth("50px");
    btnChangePasswordWrapper.addComponent(btnChangePassword);
    btnChangePasswordWrapper.setComponentAlignment(btnChangePassword, Alignment.MIDDLE_RIGHT);
    passwordWrapper.addComponent(btnChangePasswordWrapper);
    basicLayout.addComponent(passwordWrapper);
    basicLayout.setComponentAlignment(passwordWrapper, Alignment.MIDDLE_LEFT);

    avatarAndPass.addComponent(basicLayout);
    avatarAndPass.setComponentAlignment(basicLayout, Alignment.TOP_LEFT);
    avatarAndPass.setExpandRatio(basicLayout, 1.0f);

    final UploadField avatarUploadField = new UploadField() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void updateDisplay() {
            byte[] imageData = (byte[]) this.getValue();
            String mimeType = this.getLastMimeType();
            if (mimeType.equals("image/jpeg")) {
                imageData = ImageUtil.convertJpgToPngFormat(imageData);
                if (imageData == null) {
                    throw new UserInvalidInputException("Do not support image format for avatar");
                } else {
                    mimeType = "image/png";
                }
            }

            if (mimeType.equals("image/png")) {
                EventBusFactory.getInstance()
                        .post(new ProfileEvent.GotoUploadPhoto(ProfileReadViewImpl.this, imageData));
            } else {
                throw new UserInvalidInputException(
                        "Upload file does not have valid image format. The supported formats are jpg/png");
            }
        }
    };
    avatarUploadField.addStyleName("upload-field");
    avatarUploadField.setButtonCaption(AppContext.getMessage(UserI18nEnum.BUTTON_CHANGE_AVATAR));
    avatarUploadField.setSizeUndefined();
    avatarUploadField.setFieldType(FieldType.BYTE_ARRAY);
    this.userAvatar.addComponent(avatarUploadField);
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.RoleReadViewImpl.java

License:Open Source License

public RoleReadViewImpl() {
    super();//from  w  w  w .  j  av  a  2  s .co m
    this.setMargin(new MarginInfo(false, true, false, true));

    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withWidth("100%").withStyleName(UIConstants.HEADER_VIEW);
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label headerText = new Label(FontAwesome.USERS.getHtml() + " Detail Role", ContentMode.HTML);
    headerText.setStyleName(UIConstants.HEADER_TEXT);

    header.with(headerText).expand(headerText);

    this.addComponent(header);

    this.previewForm = new AdvancedPreviewBeanForm<>();
    this.addComponent(this.previewForm);

    Layout controlButtons = createTopPanel();
    if (controlButtons != null) {
        header.addComponent(controlButtons);
    }
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.RoleSearchPanel.java

License:Open Source License

private HorizontalLayout createSearchTopPanel() {
    final MHorizontalLayout layout = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW)
            .withWidth("100%").withSpacing(true).withMargin(new MarginInfo(true, false, true, false));
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    final Label searchtitle = new Label(
            FontAwesome.USERS.getHtml() + " " + AppContext.getMessage(RoleI18nEnum.VIEW_LIST_TITLE),
            ContentMode.HTML);//  w ww  .j  a v a 2  s.c  o m
    searchtitle.setStyleName(UIConstants.HEADER_TEXT);
    layout.addComponent(searchtitle);
    layout.setExpandRatio(searchtitle, 1.0f);

    final Button createBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CREATE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    EventBusFactory.getInstance().post(new RoleEvent.GotoAdd(this, null));
                }
            });
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.ACCOUNT_ROLE));

    layout.with(createBtn).withAlign(createBtn, Alignment.MIDDLE_RIGHT);

    return layout;
}

From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserReadViewImpl.java

License:Open Source License

private void displayUserAvatar() {
    this.userAvatar.removeAllComponents();
    final Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100);
    userAvatar.addComponent(cropField);/*  ww w  .  ja va  2  s . c om*/

    this.avatarAndPass.removeAllComponents();
    avatarAndPass.addComponent(userAvatar);

    final VerticalLayout basicLayout = new VerticalLayout();
    basicLayout.setSpacing(true);
    final HorizontalLayout userWrapper = new HorizontalLayout();

    String nickName = user.getNickname();

    final Label userName = new Label(
            user.getDisplayName() + (StringUtils.isEmpty(nickName) ? "" : (" ( " + nickName + " )")));
    userName.setStyleName("h1");
    userWrapper.addComponent(userName);

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

    Component role;
    if (user.getIsAccountOwner() != null && user.getIsAccountOwner() == Boolean.TRUE) {
        role = new DefaultViewField("Account Owner");
    } else {
        role = new LinkViewField(user.getRoleName(),
                AccountLinkBuilder.generatePreviewFullRoleLink(user.getRoleid()));
    }
    MHorizontalLayout roleWrapper = new MHorizontalLayout();
    roleWrapper.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_ROLE) + ": "));
    roleWrapper.addComponent(role);

    basicLayout.addComponent(roleWrapper);

    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_BIRTHDAY) + ": "
            + AppContext.formatDate(user.getDateofbirth())));
    basicLayout.addComponent(
            new MHorizontalLayout().add(new Label(AppContext.getMessage(UserI18nEnum.FORM_EMAIL) + ": "))
                    .add(new LabelLink(user.getEmail(), "mailto:" + user.getEmail())));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_TIMEZONE) + ": "
            + TimezoneMapper.getTimezone(user.getTimezone()).getDisplayName()));
    basicLayout.addComponent(new Label(AppContext.getMessage(UserI18nEnum.FORM_LANGUAGE) + ": "
            + AppContext.getMessage(LangI18Enum.class, user.getLanguage())));

    avatarAndPass.addComponent(basicLayout);
    avatarAndPass.setComponentAlignment(basicLayout, Alignment.TOP_LEFT);
    avatarAndPass.setExpandRatio(basicLayout, 1.0f);
}