List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT
Alignment MIDDLE_LEFT
To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.
Click Source Link
From source file:com.esofthead.mycollab.module.project.view.ProjectListViewImpl.java
License:Open Source License
private void generateDisplayTable() { tableItem = new DefaultPagedBeanTable<>(AppContextUtil.getSpringBean(ProjectService.class), SimpleProject.class, ProjectTypeConstants.PROJECT, ProjectTableFieldDef.selected(), Arrays.asList(ProjectTableFieldDef.projectName(), ProjectTableFieldDef.lead(), ProjectTableFieldDef.client(), ProjectTableFieldDef.startDate(), ProjectTableFieldDef.homePage(), ProjectTableFieldDef.status())); tableItem.addGeneratedColumn("selected", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override//from w ww. j a v a 2 s . c om public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleProject item = tableItem.getBeanByIndex(itemId); final CheckBoxDecor cb = new CheckBoxDecor("", item.isSelected()); cb.setImmediate(true); cb.addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(Property.ValueChangeEvent event) { tableItem.fireSelectItemEvent(item); } }); item.setExtraData(cb); return cb; } }); tableItem.addGeneratedColumn(Project.Field.name.name(), new Table.ColumnGenerator() { @Override public Object generateCell(Table table, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); LabelLink b = new LabelLink(project.getName(), ProjectLinkBuilder.generateProjectFullLink(project.getId())); b.setDescription(ProjectTooltipGenerator.generateToolTipProject(AppContext.getUserLocale(), AppContext.getDateFormat(), project, AppContext.getSiteUrl(), AppContext.getUserTimeZone())); MHorizontalLayout layout = new MHorizontalLayout(ProjectAssetsUtil .buildProjectLogo(project.getShortname(), project.getId(), project.getAvatarid(), 32), b) .expand(b).alignAll(Alignment.MIDDLE_LEFT).withMargin(false).withFullHeight(); return layout; } }); tableItem.addGeneratedColumn(Project.Field.lead.name(), new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); return new Label(ProjectLinkBuilder.generateProjectMemberHtmlLink(project.getId(), project.getLead(), project.getLeadFullName(), project.getLeadAvatarId(), true), ContentMode.HTML); } }); tableItem.addGeneratedColumn(Project.Field.accountid.name(), new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); if (project.getAccountid() != null) { LabelLink b = new LabelLink(project.getClientName(), ProjectLinkBuilder.generateClientPreviewFullLink(project.getAccountid())); b.setIconLink(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); return b; } else { return new Label(); } } }); tableItem.addGeneratedColumn(Project.Field.planstartdate.name(), new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); return new Label(AppContext.formatDate(project.getPlanstartdate())); } }); tableItem.addGeneratedColumn(Project.Field.planenddate.name(), new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); return new Label(AppContext.formatDate(project.getPlanenddate())); } }); tableItem.addGeneratedColumn(Project.Field.createdtime.name(), new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); return new Label(AppContext.formatDate(project.getCreatedtime())); } }); tableItem.addGeneratedColumn(Project.Field.homepage.name(), new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { SimpleProject project = tableItem.getBeanByIndex(itemId); if (StringUtils.isNotBlank(project.getHomepage())) { return new Label( new A(project.getHomepage(), "_blank").appendText(project.getHomepage()).write(), ContentMode.HTML); } else { return new Label(); } } }); tableItem.setWidth("100%"); bodyLayout.addComponent(constructTableActionControls()); bodyLayout.addComponent(tableItem); }
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 w w w . j av a 2 s.c o 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.ProjectViewImpl.java
License:Open Source License
@Override public void initView(final SimpleProject project) { this.removeAllComponents(); updateVerticalTabsheetFixStatus();/* w w w.ja va 2 s. c o 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.ProjectMemberListViewImpl.java
License:Open Source License
public ProjectMemberListViewImpl() { super();// ww w . j a v a2 s . c om this.setMargin(new MarginInfo(false, true, false, true)); MHorizontalLayout viewHeader = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("100%").withStyleName("hdr-view"); viewHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label headerText = new ProjectViewHeader(ProjectTypeConstants.MEMBER, AppContext.getMessage(ProjectMemberI18nEnum.VIEW_LIST_TITLE)); headerText.setStyleName("hdr-text"); viewHeader.with(headerText).expand(headerText); Button createBtn = new Button(AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoInviteMembers(this, null)); } }); createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); createBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createBtn.setIcon(FontAwesome.PLUS); viewHeader.addComponent(createBtn); this.addComponent(viewHeader); contentLayout = new CssLayout(); contentLayout.setWidth("100%"); contentLayout.setStyleName("view-content"); this.addComponent(contentLayout); }
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);/* ww w . java2 s. c o m*/ bodyWrapper.setMargin(true); 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.settings.ProjectRoleReadViewImpl.java
License:Open Source License
private ComponentContainer constructHeader() { header = new MHorizontalLayout().withStyleName("hdr-view").withWidth("100%").withSpacing(true) .withMargin(true);/*from w w w . j ava2 s . com*/ this.headerText.setStyleName("header-text"); header.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText); return header; }
From source file:com.esofthead.mycollab.module.project.view.task.components.TaskSearchPanel.java
License:Open Source License
@Override protected ComponentContainer buildSearchTitle() { if (canSwitchToAdvanceLayout) { savedFilterComboBox = new TaskSavedFilterComboBox(); savedFilterComboBox.addQuerySelectListener(new SavedFilterComboBox.QuerySelectListener() { @Override/* w w w . jav a 2s .c o m*/ public void querySelect(SavedFilterComboBox.QuerySelectEvent querySelectEvent) { List<SearchFieldInfo> fieldInfos = querySelectEvent.getSearchFieldInfos(); TaskSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(TaskSearchCriteria.class, fieldInfos); criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); EventBusFactory.getInstance().post(new TaskEvent.SearchRequest(TaskSearchPanel.this, criteria)); EventBusFactory.getInstance().post(new ShellEvent.AddQueryParam(this, fieldInfos)); } }); ELabel taskIcon = ELabel.h2(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml()) .withWidthUndefined(); return new MHorizontalLayout(taskIcon, savedFilterComboBox).expand(savedFilterComboBox) .alignAll(Alignment.MIDDLE_LEFT); } else { return null; } }
From source file:com.esofthead.mycollab.module.project.view.task.components.UnresolvedTaskByAssigneeWidget.java
License:Open Source License
@Override protected void displayPlainMode() { bodyContent.removeAllComponents();/* www. j ava 2 s .c om*/ if (!groupItems.isEmpty()) { for (GroupItem item : groupItems) { MHorizontalLayout assigneeLayout = new MHorizontalLayout().withFullWidth(); assigneeLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); String assignUser = item.getGroupid(); String assignUserFullName = item.getGroupid() == null ? "" : item.getGroupname(); if (StringUtils.isBlank(assignUserFullName)) { assignUserFullName = StringUtils.extractNameFromEmail(item.getGroupid()); } TaskAssigneeLink taskAssigneeLink = new TaskAssigneeLink(assignUser, item.getExtraValue(), assignUserFullName); assigneeLayout.addComponent(new MCssLayout(taskAssigneeLink).withWidth("110px")); ProgressBarIndicator indicator = new ProgressBarIndicator(totalCountItems, totalCountItems - item.getValue().intValue(), false); indicator.setWidth("100%"); assigneeLayout.with(indicator).expand(indicator); bodyContent.addComponent(assigneeLayout); } } }
From source file:com.esofthead.mycollab.module.project.view.task.components.UnresolvedTaskByPriorityWidget.java
License:Open Source License
@Override protected void displayPlainMode() { this.bodyContent.removeAllComponents(); TaskPriorityClickListener listener = new TaskPriorityClickListener(); this.setTitle( AppContext.getMessage(TaskI18nEnum.WIDGET_UNRESOLVED_BY_PRIORITY_TITLE) + " (" + totalCount + ")"); if (!groupItems.isEmpty()) { for (TaskPriority priority : OptionI18nEnum.task_priorities) { boolean isFound = false; for (GroupItem item : groupItems) { if (priority.name().equals(item.getGroupid())) { isFound = true;//from w w w. ja v a2 s . c o m MHorizontalLayout priorityLayout = new MHorizontalLayout().withFullWidth(); priorityLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ButtonI18nComp priorityLink = new ButtonI18nComp(priority.name(), priority, listener); priorityLink.setIcon(ProjectAssetsManager.getTaskPriority(priority.name())); priorityLink.setWidth("110px"); priorityLink.addStyleName(UIConstants.BUTTON_LINK); priorityLink.addStyleName("task-" + priority.name().toLowerCase()); priorityLayout.addComponent(priorityLink); ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue().intValue(), false); indicator.setWidth("100%"); priorityLayout.with(indicator).expand(indicator); this.bodyContent.addComponent(priorityLayout); } } if (!isFound) { MHorizontalLayout priorityLayout = new MHorizontalLayout().withFullWidth(); priorityLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ButtonI18nComp priorityLink = new ButtonI18nComp(priority.name(), priority, listener); priorityLink.setIcon(ProjectAssetsManager.getTaskPriority(priority.name())); priorityLink.setWidth("110px"); priorityLink.addStyleName(UIConstants.BUTTON_LINK); priorityLink.addStyleName("task-" + priority.name().toLowerCase()); priorityLayout.addComponent(priorityLink); ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false); indicator.setWidth("100%"); priorityLayout.with(indicator).expand(indicator); this.bodyContent.addComponent(priorityLayout); } } } }
From source file:com.esofthead.mycollab.module.project.view.task.components.UnresolvedTaskByStatusWidget.java
License:Open Source License
@Override protected void displayPlainMode() { this.bodyContent.removeAllComponents(); TaskStatusClickListener listener = new TaskStatusClickListener(); this.setTitle( AppContext.getMessage(TaskI18nEnum.WIDGET_UNRESOLVED_BY_STATUS_TITLE) + " (" + totalCount + ")"); if (!groupItems.isEmpty()) { OptionValService optionValService = AppContextUtil.getSpringBean(OptionValService.class); List<OptionVal> optionVals = optionValService.findOptionVals(ProjectTypeConstants.TASK, CurrentProjectVariables.getProjectId(), AppContext.getAccountId()); for (OptionVal optionVal : optionVals) { if (OptionI18nEnum.StatusI18nEnum.Closed.name().equals(optionVal.getTypeval())) { continue; }/* w ww .j a va 2 s .c o m*/ boolean isFound = false; for (GroupItem item : groupItems) { if (optionVal.getTypeval().equals(item.getGroupid())) { isFound = true; MHorizontalLayout statusLayout = new MHorizontalLayout().withFullWidth(); statusLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); String statusCaption = AppContext.getMessage(OptionI18nEnum.StatusI18nEnum.class, optionVal.getTypeval()); MButton statusLink = new ButtonI18nComp(optionVal.getTypeval()) .withCaption(StringUtils.trim(statusCaption, 25, true)) .withDescription(statusCaption).withListener(listener) .withStyleName(UIConstants.BUTTON_LINK).withIcon(FontAwesome.FLAG); statusLink.setWidth("110px"); statusLayout.addComponent(statusLink); ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue().intValue(), false); indicator.setWidth("100%"); statusLayout.with(indicator).expand(indicator); bodyContent.addComponent(statusLayout); } } if (!isFound) { MHorizontalLayout statusLayout = new MHorizontalLayout().withFullWidth(); statusLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); String statusCaption = AppContext.getMessage(OptionI18nEnum.StatusI18nEnum.class, optionVal.getTypeval()); MButton statusLink = new ButtonI18nComp(optionVal.getTypeval()) .withCaption(StringUtils.trim(statusCaption, 25, true)).withDescription(statusCaption) .withListener(listener).withStyleName(UIConstants.BUTTON_LINK) .withIcon(FontAwesome.FLAG); statusLink.addStyleName(UIConstants.TEXT_ELLIPSIS); statusLink.setWidth("110px"); statusLayout.addComponent(statusLink); ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false); indicator.setWidth("100%"); statusLayout.with(indicator).expand(indicator); this.bodyContent.addComponent(statusLayout); } } } }