List of usage examples for com.vaadin.ui VerticalLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void constructRemainTimeEntryPanel() { VerticalLayout remainTimePanel = new VerticalLayout(); remainTimePanel.setSpacing(true); this.headerPanel.addComponent(remainTimePanel); final VerticalLayout updateLayout = new VerticalLayout(); updateLayout.setMargin(true);//from w w w.j ava2 s . com updateLayout.addStyleName("boxTotal"); updateLayout.setWidth("100%"); remainTimePanel.addComponent(updateLayout); final Label lbTimeInstructTotal = new Label( AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAINING_WORK_HOURS)); updateLayout.addComponent(lbTimeInstructTotal); this.remainTimeLbl = new Label("_"); this.remainTimeLbl.addStyleName("numberTotal"); updateLayout.addComponent(this.remainTimeLbl); final MHorizontalLayout addLayout = new MHorizontalLayout(); addLayout.setSizeUndefined(); remainTimePanel.addComponent(addLayout); this.remainTimeInputField = new NumericTextField(); this.remainTimeInputField.setWidth("80px"); addLayout.addComponent(this.remainTimeInputField); addLayout.setComponentAlignment(this.remainTimeInputField, Alignment.MIDDLE_LEFT); btnAdd = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { try { double d = 0; try { d = Double.parseDouble(remainTimeInputField.getValue()); } catch (Exception e) { NotificationUtil.showWarningNotification("You must enter a positive number value"); } if (d >= 0) { updateTimeRemain(); remainTimeLbl.setValue(remainTimeInputField.getValue()); remainTimeInputField.setValue("0.0"); } } catch (final Exception e) { remainTimeInputField.setValue("0.0"); } } }); btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd()); btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK); addLayout.addComponent(btnAdd); addLayout.setComponentAlignment(btnAdd, Alignment.MIDDLE_LEFT); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugListWidget.java
License:Open Source License
public BugListWidget(final String title, final String backBtnLabel, final BugSearchCriteria bugSearchCriteria, final IBugReportDisplayContainer bugReportDisplayContainer) { super(title, new VerticalLayout()); final VerticalLayout contentLayout = (VerticalLayout) this.bodyContent; contentLayout.setSpacing(true); contentLayout.setWidth("100%"); final Button backToBugReportsBtn = new Button(backBtnLabel, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . jav a2 s . com*/ public void buttonClick(final ClickEvent event) { bugReportDisplayContainer.displayBugReports(); } }); // contentLayout.addComponent(backToBugReportsBtn); final VerticalLayout backBtnWrapper = new VerticalLayout(); backBtnWrapper.setMargin(new MarginInfo(false, false, true, false)); backToBugReportsBtn.setStyleName(UIConstants.THEME_GREEN_LINK); backBtnWrapper.addComponent(backToBugReportsBtn); this.addComponentAsFirst(backBtnWrapper); this.tableItem = new BugTableDisplay(BugTableFieldDef.action, Arrays.asList(BugTableFieldDef.summary, BugTableFieldDef.assignUser, BugTableFieldDef.severity, BugTableFieldDef.resolution, BugTableFieldDef.duedate)); this.tableItem.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleBug bug = (SimpleBug) event.getData(); if ("summary".equals(event.getFieldName())) { EventBusFactory.getInstance().post(new BugEvent.GotoRead(BugListWidget.this, bug.getId())); } } }); this.tableItem.setWidth("100%"); contentLayout.addComponent(this.tableItem); this.setSearchCriteria(bugSearchCriteria); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugRelatedField.java
License:Open Source License
public void displayRelatedBugs(final SimpleBug bug) { this.bug = bug; VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setWidth("100%"); mainLayout.setMargin(true);//from w w w. j a v a2s .co m mainLayout.setSpacing(true); HorizontalLayout layoutAdd = new HorizontalLayout(); layoutAdd.setSpacing(true); Label lbBug = new Label("Bug:"); lbBug.setWidth("70px"); layoutAdd.addComponent(lbBug); layoutAdd.setComponentAlignment(lbBug, Alignment.MIDDLE_LEFT); itemField = new TextField(); itemField.setWidth("300px"); itemField.setNullRepresentation(""); itemField.setReadOnly(true); itemField.setEnabled(true); layoutAdd.addComponent(itemField); layoutAdd.setComponentAlignment(itemField, Alignment.MIDDLE_LEFT); browseBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { callItemSelectionWindow(); } }); browseBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_browseItem)); browseBtn.setStyleName("link"); layoutAdd.addComponent(browseBtn); layoutAdd.setComponentAlignment(browseBtn, Alignment.MIDDLE_LEFT); clearBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { setItemFieldValue(""); } }); clearBtn.setIcon(MyCollabResource.newResource("icons/16/clearItem.png")); clearBtn.setStyleName("link"); layoutAdd.addComponent(clearBtn); layoutAdd.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT); Label lbIs = new Label("is"); layoutAdd.addComponent(lbIs); layoutAdd.setComponentAlignment(lbIs, Alignment.MIDDLE_LEFT); comboRelation = new BugRelationComboBox(); comboRelation.setWidth("200px"); layoutAdd.addComponent(comboRelation); layoutAdd.setComponentAlignment(comboRelation, Alignment.MIDDLE_LEFT); btnRelate = new Button("Relate"); btnRelate.setStyleName(UIConstants.THEME_GREEN_LINK); btnRelate.setIcon(MyCollabResource.newResource(WebResourceIds._16_addRecord)); ProjectMemberService memberService = ApplicationContextUtil.getSpringBean(ProjectMemberService.class); SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(), CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); if (member != null) { btnRelate.setEnabled((member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser())) || (AppContext.getUsername().equals(bug.getLogby()))) && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); } btnRelate.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { if (!itemField.getValue().toString().trim().equals("") && relatedBean != null && !relatedBean.getSummary().equals(bug.getSummary())) { SimpleRelatedBug relatedBug = new SimpleRelatedBug(); relatedBug.setBugid(bug.getId()); relatedBug.setRelatedid(relatedBean.getId()); relatedBug.setRelatetype((String) comboRelation.getValue()); relatedBug.setComment(txtComment.getValue().toString()); relatedBugService.saveWithSession(relatedBug, AppContext.getUsername()); SimpleRelatedBug oppositeRelation = new SimpleRelatedBug(); oppositeRelation.setBugid(relatedBean.getId()); oppositeRelation.setRelatedid(bug.getId()); oppositeRelation.setComment(txtComment.getValue().toString()); if (comboRelation.getValue().toString().equals(BugRelationConstants.PARENT)) { oppositeRelation.setRelatetype(BugRelationConstants.CHILD); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.CHILD)) { oppositeRelation.setRelatetype(BugRelationConstants.PARENT); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.RELATED)) { oppositeRelation.setRelatetype(BugRelationConstants.RELATED); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.BEFORE)) { oppositeRelation.setRelatetype(BugRelationConstants.AFTER); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.AFTER)) { oppositeRelation.setRelatetype(BugRelationConstants.BEFORE); } else if (comboRelation.getValue().toString().equals(BugRelationConstants.DUPLICATED)) { oppositeRelation.setRelatetype(BugRelationConstants.DUPLICATED); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); bug.setStatus(BugStatus.Resolved.name()); bug.setResolution(BugResolution.Duplicate.name()); bugService.updateWithSession(bug, AppContext.getUsername()); } relatedBugService.saveWithSession(oppositeRelation, AppContext.getUsername()); setCriteria(); setItemFieldValue(""); txtComment.setValue(""); relatedBean = null; } } }); layoutAdd.addComponent(btnRelate); layoutAdd.setComponentAlignment(btnRelate, Alignment.MIDDLE_LEFT); Label lbInstruction = new Label("<strong>Relate to an existing ticket</strong>", ContentMode.HTML); mainLayout.addComponent(lbInstruction); mainLayout.addComponent(layoutAdd); HorizontalLayout layoutComment = new HorizontalLayout(); layoutComment.setSpacing(true); Label lbComment = new Label("Comment:"); lbComment.setWidth("70px"); layoutComment.addComponent(lbComment); layoutComment.setComponentAlignment(lbComment, Alignment.TOP_LEFT); txtComment = new RichTextArea(); txtComment.setHeight("130px"); txtComment.setWidth("565px"); layoutComment.addComponent(txtComment); layoutComment.setComponentAlignment(txtComment, Alignment.MIDDLE_LEFT); mainLayout.addComponent(layoutComment); tableItem = new DefaultPagedBeanTable<RelatedBugService, BugRelatedSearchCriteria, SimpleRelatedBug>( ApplicationContextUtil.getSpringBean(RelatedBugService.class), SimpleRelatedBug.class, Arrays.asList( new TableViewField(BugI18nEnum.RELATED_BUG_NAME, "bugName", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(BugI18nEnum.RELATED_BUG_TYPE, "relatetype", UIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(BugI18nEnum.RELATED_BUG_COMMENT, "comment", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH))); tableItem.addGeneratedColumn("bugName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId); String bugname = "[%s-%s] %s"; bugname = String.format(bugname, CurrentProjectVariables.getProject().getShortname(), relatedItem.getRelatedid(), relatedItem.getBugName()); BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final SimpleBug bug = bugService.findById(relatedItem.getRelatedid(), AppContext.getAccountId()); LabelLink b = new LabelLink(bugname, ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName())); if (StringUtils.isNotBlank(bug.getPriority())) { String iconPriority = ProjectResources.getIconResourceLink12ByBugPriority(bug.getPriority()); b.setIconLink(iconPriority); } if (BugStatus.Verified.name().equals(bug.getStatus())) { b.addStyleName(UIConstants.LINK_COMPLETED); } else if (bug.getDuedate() != null && (bug.getDuedate().before(new GregorianCalendar().getTime()))) { b.addStyleName(UIConstants.LINK_OVERDUE); } b.setWidth("100%"); return b; } }); tableItem.addGeneratedColumn("id", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId); Button deleteBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { BugRelatedSearchCriteria relateBugIdCriteria = new BugRelatedSearchCriteria(); relateBugIdCriteria.setBugId(new NumberSearchField(relatedItem.getBugid())); relateBugIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getRelatedid())); relatedBugService.removeByCriteria(relateBugIdCriteria, AppContext.getAccountId()); BugRelatedSearchCriteria relateIdCriteria = new BugRelatedSearchCriteria(); relateIdCriteria.setBugId(new NumberSearchField(relatedItem.getRelatedid())); relateIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getBugid())); relatedBugService.removeByCriteria(relateIdCriteria, AppContext.getAccountId()); BugRelatedField.this.setCriteria(); } }); deleteBtn.setStyleName("link"); deleteBtn.setIcon(MyCollabResource.newResource("icons/16/delete.png")); relatedItem.setExtraData(deleteBtn); ProjectMemberService memberService = ApplicationContextUtil .getSpringBean(ProjectMemberService.class); SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(), CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); if (member != null) { deleteBtn.setEnabled( member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser())) || (AppContext.getUsername().equals(bug.getLogby()))); } return deleteBtn; } }); mainLayout.addComponent(tableItem); setCriteria(); this.setCompositionRoot(mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.bug.BugSelectionWindow.java
License:Open Source License
public BugSelectionWindow(BugRelatedField fieldSelection) { super("Bug Lookup"); this.setWidth("900px"); this.setHeight("500px"); this.fieldSelection = fieldSelection; this.setModal(true); this.setResizable(false); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true);/* www.ja v a2s.c o m*/ BugSimpleSearchPanel contactSimpleSearchPanel = new BugSimpleSearchPanel(); contactSimpleSearchPanel.addSearchHandler(new SearchHandler<BugSearchCriteria>() { @Override public void onSearch(BugSearchCriteria criteria) { tableItem.setSearchCriteria(criteria); } }); layout.addComponent(contactSimpleSearchPanel); createBugList(); layout.addComponent(tableItem); this.setContent(layout); }
From source file:com.esofthead.mycollab.module.project.view.ProjectViewImpl.java
License:Open Source License
@Override public void initView(final SimpleProject project) { this.removeAllComponents(); updateVerticalTabsheetFixStatus();/* w ww. j a v a 2 s . co m*/ ControllerRegistry.addController(new ProjectController(this)); this.setWidth("100%"); this.addStyleName("main-content-wrapper"); this.addStyleName("projectDashboardView"); myProjectTab = new ProjectVerticalTabsheet(); myProjectTab.setSizeFull(); myProjectTab.setNavigatorWidth("100%"); myProjectTab.setNavigatorStyleName("sidebar-menu"); myProjectTab.setContainerStyleName("tab-content"); myProjectTab.addSelectedTabChangeListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { Tab tab = ((ProjectVerticalTabsheet) event.getSource()).getSelectedTab(); String caption = ((TabImpl) tab).getTabId(); if (ProjectTypeConstants.MESSAGE.equals(caption)) { messagePresenter.go(ProjectViewImpl.this, null); } else if (ProjectTypeConstants.MILESTONE.equals(caption)) { MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProjectId())); gotoMilestoneView(new MilestoneScreenData.Search(searchCriteria)); } else if (ProjectTypeConstants.TASK.equals(caption)) { taskPresenter.go(ProjectViewImpl.this, null); } else if (ProjectTypeConstants.BUG.equals(caption)) { gotoBugView(null); } else if (ProjectTypeConstants.RISK.equals(caption)) { RiskSearchCriteria searchCriteria = new RiskSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProjectId())); gotoRiskView(new RiskScreenData.Search(searchCriteria)); } else if (ProjectTypeConstants.FILE.equals(caption)) { filePresenter.go(ProjectViewImpl.this, new FileScreenData.GotoDashboard()); } else if (ProjectTypeConstants.PAGE.equals(caption)) { pagePresenter.go(ProjectViewImpl.this, new PageScreenData.Search(CurrentProjectVariables.getBasePagePath())); } else if (ProjectTypeConstants.PROBLEM.equals(caption)) { ProblemSearchCriteria searchCriteria = new ProblemSearchCriteria(); searchCriteria.setProjectId( new NumberSearchField(SearchField.AND, CurrentProjectVariables.getProjectId())); problemPresenter.go(ProjectViewImpl.this, new ProblemScreenData.Search(searchCriteria)); } else if (ProjectTypeConstants.DASHBOARD.equals(caption)) { dashboardPresenter.go(ProjectViewImpl.this, null); } else if (ProjectTypeConstants.MEMBER.equals(caption)) { ProjectMemberSearchCriteria criteria = new ProjectMemberSearchCriteria(); criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); criteria.setStatus(new StringSearchField(ProjectMemberStatusConstants.ACTIVE)); gotoUsersAndGroup(new ProjectMemberScreenData.Search(criteria)); } else if (ProjectTypeConstants.TIME.equals(caption)) { ItemTimeLoggingSearchCriteria searchCriteria = new ItemTimeLoggingSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria .setRangeDate(ItemTimeLoggingSearchCriteria.getCurrentRangeDateOfWeekSearchField()); gotoTimeTrackingView(new TimeTrackingScreenData.Search(searchCriteria)); } else if (ProjectTypeConstants.STANDUP.equals(caption)) { StandupReportSearchCriteria criteria = new StandupReportSearchCriteria(); criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); criteria.setOnDate(new DateSearchField(SearchField.AND, DateSearchField.EQUAL, new GregorianCalendar().getTime())); standupPresenter.go(ProjectViewImpl.this, new StandupScreenData.Search(criteria)); } } }); VerticalLayout contentWrapper = myProjectTab.getContentWrapper(); contentWrapper.addStyleName("main-content"); MHorizontalLayout topPanel = new MHorizontalLayout().withSpacing(false).withMargin(true).withWidth("100%") .withStyleName("top-panel"); contentWrapper.addComponentAsFirst(topPanel); ProjectListComponent prjList = new ProjectListComponent(); CssLayout navigatorWrapper = myProjectTab.getNavigatorWrapper(); navigatorWrapper.addComponentAsFirst(prjList); navigatorWrapper.setWidth("250px"); buildComponents(); this.addComponent(myProjectTab); ProjectBreadcrumb breadCrumb = ViewManager.getCacheComponent(ProjectBreadcrumb.class); breadCrumb.setProject(project); topPanel.with(breadCrumb).withAlign(breadCrumb, Alignment.MIDDLE_LEFT).expand(breadCrumb); if (project.isProjectArchived()) { Button activeProjectBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), new ClickListener() { @Override public void buttonClick(ClickEvent event) { ProjectService projectService = ApplicationContextUtil .getSpringBean(ProjectService.class); project.setProjectstatus(StatusI18nEnum.Open.name()); projectService.updateSelectiveWithSession(project, AppContext.getUsername()); PageActionChain chain = new PageActionChain( new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain)); } }); activeProjectBtn.setStyleName(UIConstants.THEME_GREEN_LINK); topPanel.with(activeProjectBtn).withAlign(activeProjectBtn, Alignment.MIDDLE_RIGHT); } else { final PopupButton controlsBtn = new PopupButton(); controlsBtn.setIcon(FontAwesome.ELLIPSIS_H); controlsBtn.addStyleName(UIConstants.THEME_BLANK_LINK); VerticalLayout popupButtonsControl = new VerticalLayout(); popupButtonsControl.setSpacing(true); popupButtonsControl.setWidth("150px"); Button createPhaseBtn = new Button(AppContext.getMessage(MilestoneI18nEnum.BUTTON_NEW_PHASE), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance() .post(new MilestoneEvent.GotoAdd(ProjectViewImpl.this, null)); } }); createPhaseBtn .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)); createPhaseBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE)); createPhaseBtn.setStyleName("link"); popupButtonsControl.addComponent(createPhaseBtn); Button createTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new TaskEvent.GotoAdd(ProjectViewImpl.this, null)); } }); createTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); createTaskBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK)); createTaskBtn.setStyleName("link"); popupButtonsControl.addComponent(createTaskBtn); Button createBugBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_BUG), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null)); } }); createBugBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)); createBugBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG)); createBugBtn.setStyleName("link"); popupButtonsControl.addComponent(createBugBtn); Button createRiskBtn = new Button(AppContext.getMessage(RiskI18nEnum.BUTTON_NEW_RISK), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new RiskEvent.GotoAdd(this, null)); } }); createRiskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.RISKS)); createRiskBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.RISK)); createRiskBtn.setStyleName("link"); popupButtonsControl.addComponent(createRiskBtn); Button createProblemBtn = new Button(AppContext.getMessage(ProblemI18nEnum.BUTTON_NEW_PROBLEM), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new ProblemEvent.GotoAdd(this, null)); } }); createProblemBtn .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROBLEMS)); createProblemBtn.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROBLEM)); createProblemBtn.setStyleName("link"); popupButtonsControl.addComponent(createProblemBtn); Button editProjectBtn = new Button(AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_EDIT_PROJECT), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); dashboardPresenter.go(ProjectViewImpl.this, new ProjectScreenData.Edit(project)); } }); editProjectBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)); editProjectBtn.setIcon(FontAwesome.EDIT); editProjectBtn.setStyleName("link"); popupButtonsControl.addComponent(editProjectBtn); Button archieveProjectBtn = new Button( AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.WINDOW_WARNING_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_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()) { ProjectService projectService = ApplicationContextUtil .getSpringBean(ProjectService.class); project.setProjectstatus(StatusI18nEnum.Archived.name()); projectService.updateSelectiveWithSession(project, AppContext.getUsername()); PageActionChain chain = new PageActionChain( new ProjectScreenData.Goto( CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance() .post(new ProjectEvent.GotoMyProject(this, chain)); } } }); } }); archieveProjectBtn .setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)); archieveProjectBtn.setIcon(FontAwesome.ARCHIVE); archieveProjectBtn.setStyleName("link"); popupButtonsControl.addComponent(archieveProjectBtn); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) { Button deleteProjectBtn = new Button( AppContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { controlsBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage( ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_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()) { ProjectService projectService = ApplicationContextUtil .getSpringBean(ProjectService.class); projectService.removeWithSession( CurrentProjectVariables.getProjectId(), AppContext.getUsername(), AppContext.getAccountId()); EventBusFactory.getInstance() .post(new ShellEvent.GotoProjectModule(this, null)); } } }); } }); deleteProjectBtn .setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)); deleteProjectBtn.setIcon(FontAwesome.TRASH_O); deleteProjectBtn.setStyleName("link"); popupButtonsControl.addComponent(deleteProjectBtn); } controlsBtn.setContent(popupButtonsControl); controlsBtn.setWidthUndefined(); topPanel.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT); } prjList.showProjects(); }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectNotificationSettingViewComponent.java
License:Open Source License
public ProjectNotificationSettingViewComponent(final ProjectNotificationSetting bean) { super(AppContext.getMessage(ProjectSettingI18nEnum.VIEW_TITLE)); VerticalLayout bodyWrapper = new VerticalLayout(); bodyWrapper.setSpacing(true); bodyWrapper.setMargin(true);/*from w w w .ja v a 2s .c o m*/ bodyWrapper.setSizeFull(); HorizontalLayout notificationLabelWrapper = new HorizontalLayout(); notificationLabelWrapper.setSizeFull(); notificationLabelWrapper.setMargin(true); notificationLabelWrapper.setStyleName("notification-label"); Label notificationLabel = new Label(AppContext.getMessage(ProjectSettingI18nEnum.EXT_LEVEL)); notificationLabel.addStyleName("h2"); notificationLabel.setHeightUndefined(); notificationLabelWrapper.addComponent(notificationLabel); bodyWrapper.addComponent(notificationLabelWrapper); VerticalLayout body = new VerticalLayout(); body.setSpacing(true); body.setMargin(new MarginInfo(true, false, false, false)); final OptionGroup optionGroup = new OptionGroup(null); optionGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT); optionGroup.addItem(NotificationType.Default.name()); optionGroup.setItemCaption(NotificationType.Default.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_DEFAULT_SETTING)); optionGroup.addItem(NotificationType.None.name()); optionGroup.setItemCaption(NotificationType.None.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_NONE_SETTING)); optionGroup.addItem(NotificationType.Minimal.name()); optionGroup.setItemCaption(NotificationType.Minimal.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MINIMUM_SETTING)); optionGroup.addItem(NotificationType.Full.name()); optionGroup.setItemCaption(NotificationType.Full.name(), AppContext.getMessage(ProjectSettingI18nEnum.OPT_MAXIMUM_SETTING)); optionGroup.setHeight("100%"); body.addComponent(optionGroup); body.setExpandRatio(optionGroup, 1.0f); body.setComponentAlignment(optionGroup, Alignment.MIDDLE_LEFT); String levelVal = bean.getLevel(); if (levelVal == null) { optionGroup.select(NotificationType.Default.name()); } else { optionGroup.select(levelVal); } Button updateBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { try { bean.setLevel((String) optionGroup.getValue()); ProjectNotificationSettingService projectNotificationSettingService = ApplicationContextUtil .getSpringBean(ProjectNotificationSettingService.class); if (bean.getId() == null) { projectNotificationSettingService.saveWithSession(bean, AppContext.getUsername()); } else { projectNotificationSettingService.updateWithSession(bean, AppContext.getUsername()); } NotificationUtil.showNotification( AppContext.getMessage(ProjectSettingI18nEnum.DIALOG_UPDATE_SUCCESS)); } catch (Exception e) { throw new MyCollabException(e); } } }); updateBtn.addStyleName(UIConstants.THEME_GREEN_LINK); updateBtn.setIcon(FontAwesome.REFRESH); body.addComponent(updateBtn); body.setComponentAlignment(updateBtn, Alignment.BOTTOM_LEFT); bodyWrapper.addComponent(body); this.addComponent(bodyWrapper); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupNoItemView.java
License:Open Source License
public TaskGroupNoItemView() { this.setMargin(new MarginInfo(true, false, false, false)); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("taskgroup-noitem"); layout.setSpacing(true); layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true);/* w w w . j a va 2 s.c o m*/ Image image = new Image(null, MyCollabResource.newResource("icons/48/project/tasklist.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button createTaskGroupBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow(null); UI.getCurrent().addWindow(taskListWindow); } }); createTaskGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); HorizontalLayout links = new HorizontalLayout(); links.addComponent(createTaskGroupBtn); createTaskGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK); links.setSpacing(true); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskSearchTableDisplay.java
License:Open Source License
public TaskSearchTableDisplay(TableViewField requiredColumn, List<TableViewField> displayColumns) { super(ApplicationContextUtil.getSpringBean(ProjectTaskService.class), SimpleTask.class, requiredColumn, displayColumns);//from w ww . j ava2s . c o m this.addGeneratedColumn("taskname", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); CssLayout taskName = new CssLayout(); String taskname = "[%s-%s] %s"; taskname = String.format(taskname, CurrentProjectVariables.getProject().getShortname(), task.getTaskkey(), task.getTaskname()); LabelLink b = new LabelLink(taskname, ProjectLinkBuilder .generateTaskPreviewFullLink(task.getTaskkey(), task.getProjectShortname())); b.setDescription(ProjectTooltipGenerator.generateToolTipTask(AppContext.getUserLocale(), task, AppContext.getSiteUrl(), AppContext.getTimezone())); if (StringUtils.isNotBlank(task.getPriority())) { b.setIconLink(ProjectResources.getIconResourceLink12ByTaskPriority(task.getPriority())); } if (task.getPercentagecomplete() != null && 100d == task.getPercentagecomplete()) { b.addStyleName(UIConstants.LINK_COMPLETED); } else { if ("Pending".equals(task.getStatus())) { b.addStyleName(UIConstants.LINK_PENDING); } else if ((task.getEnddate() != null && (task.getEnddate().before(new GregorianCalendar().getTime()))) || (task.getActualenddate() != null && (task.getActualenddate().before(new GregorianCalendar().getTime()))) || (task.getDeadline() != null && (task.getDeadline().before(new GregorianCalendar().getTime())))) { b.addStyleName(UIConstants.LINK_OVERDUE); } } taskName.addComponent(b); taskName.setWidth("100%"); taskName.setHeightUndefined(); return taskName; } }); this.addGeneratedColumn("percentagecomplete", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); Double percomp = (task.getPercentagecomplete() == null) ? new Double(0) : task.getPercentagecomplete(); ProgressPercentageIndicator progress = new ProgressPercentageIndicator(percomp); progress.setWidth("100px"); return progress; } }); this.addGeneratedColumn("startdate", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(task.getStartdate())); } }); this.addGeneratedColumn("deadline", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(task.getDeadline())); } }); this.addGeneratedColumn("id", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); PopupButton taskSettingPopupBtn = new PopupButton(); VerticalLayout filterBtnLayout = new VerticalLayout(); filterBtnLayout.setMargin(true); filterBtnLayout.setSpacing(true); filterBtnLayout.setWidth("100px"); Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new TaskEvent.GotoEdit(TaskSearchTableDisplay.this, task)); } }); editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); editButton.setStyleName("link"); filterBtnLayout.addComponent(editButton); if ((task.getPercentagecomplete() != null && task.getPercentagecomplete() != 100) || task.getPercentagecomplete() == null) { Button closeBtn = new Button("Close", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus("Closed"); task.setPercentagecomplete(100d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "closeTask")); } }); closeBtn.setStyleName("link"); closeBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(closeBtn); } else { Button reOpenBtn = new Button("ReOpen", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus("Open"); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "reopenTask")); } }); reOpenBtn.setStyleName("link"); reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(reOpenBtn); } if (!"Pending".equals(task.getStatus())) { if (!"Closed".equals(task.getStatus())) { Button pendingBtn = new Button("Pending", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { task.setStatus("Pending"); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent( new TableClickEvent(TaskSearchTableDisplay.this, task, "pendingTask")); } }); pendingBtn.setStyleName("link"); pendingBtn.setEnabled( CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(pendingBtn); } } else { Button reOpenBtn = new Button("ReOpen", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus("Open"); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "reopenTask")); } }); reOpenBtn.setStyleName("link"); reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(reOpenBtn); } Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(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()) { ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.removeWithSession(task.getId(), AppContext.getUsername(), AppContext.getAccountId()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "deleteTask")); } } }); } }); deleteBtn.setStyleName("link"); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(deleteBtn); taskSettingPopupBtn.setIcon(MyCollabResource.newResource("icons/16/item_settings.png")); taskSettingPopupBtn.setStyleName("link"); taskSettingPopupBtn.setContent(filterBtnLayout); return taskSettingPopupBtn; } }); this.addGeneratedColumn("assignUserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); return new ProjectUserLink(task.getAssignuser(), task.getAssignUserAvatarId(), task.getAssignUserFullName()); } }); this.setWidth("100%"); }
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 om*/ 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.UserReadViewImpl.java
License:Open Source License
private void displayUserAvatar() { this.userAvatar.removeAllComponents(); final Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100); userAvatar.addComponent(cropField);//from ww w . ja va 2 s . co m 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); }