List of usage examples for com.vaadin.ui Button.ClickListener Button.ClickListener
Button.ClickListener
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java
License:Open Source License
private ComponentContainer constructMilestoneBox(final SimpleMilestone milestone) { final CssLayout layout = new CssLayout(); layout.addStyleName(UIConstants.MILESTONE_BOX); layout.setWidth("100%"); final LabelLink milestoneLink = new LabelLink(milestone.getName(), ProjectLinkBuilder.generateMilestonePreviewFullLink(milestone.getProjectid(), milestone.getId())); milestoneLink.setStyleName("link"); milestoneLink.addStyleName("bold"); milestoneLink.addStyleName(UIConstants.WORD_WRAP); milestoneLink.addStyleName("milestone-name"); milestoneLink.setWidth("100%"); MHorizontalLayout milestoneHeader = new MHorizontalLayout().withWidth("100%").with(milestoneLink) .expand(milestoneLink);// ww w.j a v a 2 s . com PopupButton taskSettingPopupBtn = new PopupButton(); taskSettingPopupBtn.setWidth("20px"); MVerticalLayout filterBtnLayout = new MVerticalLayout().withWidth("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 MilestoneEvent.GotoEdit(MilestoneListViewImpl.this, milestone)); } }); editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)); editButton.setStyleName("link"); filterBtnLayout.addComponent(editButton); 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()) { MilestoneService projectTaskService = ApplicationContextUtil .getSpringBean(MilestoneService.class); projectTaskService.removeWithSession(milestone.getId(), AppContext.getUsername(), AppContext.getAccountId()); milestones.remove(milestone); displayMilestones(milestones); } } }); } }); deleteBtn.setStyleName("link"); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES)); filterBtnLayout.addComponent(deleteBtn); taskSettingPopupBtn.setIcon(FontAwesome.COG); taskSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); taskSettingPopupBtn.setContent(filterBtnLayout); milestoneHeader.addComponent(taskSettingPopupBtn); layout.addComponent(milestoneHeader); MHorizontalLayout spacing = new MHorizontalLayout().withHeight("8px").withWidth("100%"); layout.addComponent(spacing); final GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 5, "100%", "80px"); layoutHelper.addComponent( new Label(AppContext.formatDate(milestone.getStartdate(), AppContext.getMessage(GenericI18Enum.FORM_EMPTY))), AppContext.getMessage(MilestoneI18nEnum.FORM_START_DATE_FIELD), 0, 0, Alignment.MIDDLE_LEFT); layoutHelper.addComponent( new Label(AppContext.formatDate(milestone.getEnddate(), AppContext.getMessage(GenericI18Enum.FORM_EMPTY))), AppContext.getMessage(MilestoneI18nEnum.FORM_END_DATE_FIELD), 0, 1, Alignment.MIDDLE_LEFT); CssLayout linkWrapper = new CssLayout(); linkWrapper.setWidth("100%"); linkWrapper.addComponent(new ProjectUserLink(milestone.getOwner(), milestone.getOwnerAvatarId(), milestone.getOwnerFullName(), false, true)); layoutHelper.addComponent(linkWrapper, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 2, Alignment.MIDDLE_LEFT); final ProgressBarIndicator progressTask = new ProgressBarIndicator(milestone.getNumTasks(), milestone.getNumOpenTasks()); progressTask.setWidth("100%"); layoutHelper.addComponent(progressTask, AppContext.getMessage(MilestoneI18nEnum.FORM_TASK_FIELD), 0, 3, Alignment.MIDDLE_LEFT); final ProgressBarIndicator progressBug = new ProgressBarIndicator(milestone.getNumBugs(), milestone.getNumOpenBugs()); progressBug.setWidth("100%"); layoutHelper.addComponent(progressBug, AppContext.getMessage(MilestoneI18nEnum.FORM_BUG_FIELD), 0, 4, Alignment.MIDDLE_LEFT); final GridLayout milestoneInfoLayout = layoutHelper.getLayout(); milestoneInfoLayout.setWidth("100%"); milestoneInfoLayout.setMargin(false); milestoneInfoLayout.setSpacing(true); layout.addComponent(milestoneInfoLayout); return layout; }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneRoadmapViewImpl.java
License:Open Source License
private HorizontalLayout createHeaderRight() { MHorizontalLayout layout = new MHorizontalLayout(); createBtn = new Button(AppContext.getMessage(MilestoneI18nEnum.NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from ww w . java 2 s . com public void buttonClick(final Button.ClickEvent event) { SimpleMilestone milestone = new SimpleMilestone(); milestone.setSaccountid(AppContext.getAccountId()); milestone.setProjectid(CurrentProjectVariables.getProjectId()); UI.getCurrent().addWindow(new MilestoneAddWindow(milestone)); } }); createBtn.setIcon(FontAwesome.PLUS); createBtn.setStyleName(UIConstants.BUTTON_ACTION); createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)); layout.with(createBtn); Button printBtn = new Button("", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().addWindow(new MilestoneCustomizeReportOutputWindow(new LazyValueInjector() { @Override protected Object doEval() { return baseCriteria; } })); } }); printBtn.setIcon(FontAwesome.PRINT); printBtn.addStyleName(UIConstants.BUTTON_OPTION); printBtn.setDescription(AppContext.getMessage(GenericI18Enum.ACTION_EXPORT)); layout.addComponent(printBtn); Button kanbanBtn = new Button("Board", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { EventBusFactory.getInstance() .post(new MilestoneEvent.GotoList(MilestoneRoadmapViewImpl.this, null)); } }); kanbanBtn.setDescription("Board View"); kanbanBtn.setIcon(FontAwesome.TH); Button roadmapBtn = new Button("List"); roadmapBtn.setDescription("Roadmap"); roadmapBtn.setIcon(VaadinIcons.CUBE); ToggleButtonGroup viewButtons = new ToggleButtonGroup(); viewButtons.addButton(roadmapBtn); viewButtons.addButton(kanbanBtn); viewButtons.withDefaultButton(roadmapBtn); layout.with(viewButtons); return layout; }
From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private void initHeader() { Label headerText = new ProjectViewHeader(ProjectTypeConstants.PAGE, AppContext.getMessage(Page18InEnum.VIEW_LIST_TITLE)); headerLayout.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText); Label sortLbl = new Label(AppContext.getMessage(Page18InEnum.OPT_SORT_LABEL)); sortLbl.setSizeUndefined();// w ww . j a v a 2 s .c o m headerLayout.with(sortLbl).withAlign(sortLbl, Alignment.MIDDLE_RIGHT); ToggleButtonGroup sortGroup = new ToggleButtonGroup(); headerLayout.with(sortGroup).withAlign(sortGroup, Alignment.MIDDLE_RIGHT); SortButton sortDateBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_DATE), new Button.ClickListener() { private static final long serialVersionUID = -6987503077975316907L; @Override public void buttonClick(Button.ClickEvent event) { dateSourceAscend = !dateSourceAscend; if (dateSourceAscend) { Collections.sort(resources, Ordering.from(dateSort)); } else { Collections.sort(resources, Ordering.from(dateSort).reverse()); } displayPages(resources); } }); sortGroup.addButton(sortDateBtn); SortButton sortNameBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_NAME), new Button.ClickListener() { private static final long serialVersionUID = 2847554379518387585L; @Override public void buttonClick(Button.ClickEvent event) { nameSortAscend = !nameSortAscend; if (nameSortAscend) { Collections.sort(resources, Ordering.from(nameSort)); } else { Collections.sort(resources, Ordering.from(nameSort).reverse()); } displayPages(resources); } }); sortGroup.addButton(sortNameBtn); SortButton sortKindBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_KIND), new Button.ClickListener() { private static final long serialVersionUID = 2230933690084074590L; @Override public void buttonClick(Button.ClickEvent event) { kindSortAscend = !kindSortAscend; if (kindSortAscend) { Collections.sort(resources, Ordering.from(kindSort)); } else { Collections.sort(resources, Ordering.from(kindSort).reverse()); } displayPages(resources); } }); sortGroup.addButton(sortKindBtn); sortGroup.setDefaultButton(sortDateBtn); final Button newGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { UI.getCurrent().addWindow(new PageGroupWindow()); } }); newGroupBtn.setStyleName(UIConstants.THEME_GREEN_LINK); newGroupBtn.setIcon(FontAwesome.PLUS); newGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); headerLayout.with(newGroupBtn).withAlign(newGroupBtn, Alignment.MIDDLE_RIGHT); final Button newPageBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_PAGE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null)); } }); newPageBtn.setStyleName(UIConstants.THEME_GREEN_LINK); newPageBtn.setIcon(FontAwesome.PLUS); newPageBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); headerText.setStyleName(UIConstants.HEADER_TEXT); headerLayout.with(newPageBtn).withAlign(newPageBtn, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private Layout displayFolderBlock(final Folder resource) { MHorizontalLayout container = new MHorizontalLayout().withWidth("100%").withStyleName("page-item-block"); FontIconLabel iconResource = new FontIconLabel(FontAwesome.FOLDER_OPEN); iconResource.addStyleName("icon-48px"); VerticalLayout block = new VerticalLayout(); block.setWidth("600px"); HorizontalLayout headerPanel = new HorizontalLayout(); Button folderLink = new Button(resource.getName(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from www. java2 s .c o m*/ public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance() .post(new PageEvent.GotoList(PageListViewImpl.this, resource.getPath())); } }); folderLink.addStyleName("link"); folderLink.addStyleName("h3"); headerPanel.addComponent(folderLink); block.addComponent(headerPanel); block.addComponent(new Label(StringUtils.trimHtmlTags(resource.getDescription()))); Label lastUpdateInfo = new Label(AppContext.getMessage(Page18InEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(resource.getCreatedUser(), CurrentProjectVariables.getProjectId()), AppContext.formatDateTime(resource.getCreatedTime().getTime())), ContentMode.HTML); lastUpdateInfo.addStyleName("last-update-info"); block.addComponent(lastUpdateInfo); MHorizontalLayout controlBtns = new MHorizontalLayout().withStyleName("control-btns"); Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = -5387015552598157076L; @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new PageGroupWindow(resource)); } }); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName("link"); editBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); controlBtns.addComponent(editBtn); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = -5387015552598157076L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { PageService wikiService = ApplicationContextUtil .getSpringBean(PageService.class); wikiService.removeResource(resource.getPath()); resources.remove(resource); displayPages(resources); } } }); } }); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES)); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName("link"); controlBtns.addComponent(deleteBtn); block.addComponent(controlBtns); HorizontalLayout footer = new HorizontalLayout(); block.addComponent(footer); MHorizontalLayout wrapper = new MHorizontalLayout(); wrapper.with(iconResource, block); container.with(wrapper); return container; }
From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private Layout displayPageBlock(final Page resource) { MHorizontalLayout container = new MHorizontalLayout().withWidth("100%").withStyleName("page-item-block"); FontIconLabel iconResource = new FontIconLabel(FontAwesome.FILE_WORD_O); iconResource.addStyleName("icon-48px"); VerticalLayout block = new VerticalLayout(); block.setWidth("600px"); HorizontalLayout headerPanel = new HorizontalLayout(); Button pageLink = new Button(resource.getSubject(), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w ww . j a va2s . co m*/ public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new PageEvent.GotoRead(PageListViewImpl.this, resource)); } }); pageLink.addStyleName("link"); pageLink.addStyleName("h3"); headerPanel.addComponent(pageLink); block.addComponent(headerPanel); block.addComponent(new Label(StringUtils.trimHtmlTags(resource.getContent()))); Label lastUpdateInfo = new Label(AppContext.getMessage(Page18InEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(resource.getLastUpdatedUser(), CurrentProjectVariables.getProjectId()), AppContext.formatDateTime(resource.getLastUpdatedTime().getTime())), ContentMode.HTML); lastUpdateInfo.addStyleName("last-update-info"); block.addComponent(lastUpdateInfo); MHorizontalLayout controlBtns = new MHorizontalLayout().withStyleName("control-btns"); Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = -5387015552598157076L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new PageEvent.GotoEdit(PageListViewImpl.this, resource)); } }); editBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); editBtn.setIcon(FontAwesome.EDIT); editBtn.setStyleName("link"); controlBtns.addComponent(editBtn); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 2575434171770462361L; @Override public void buttonClick(Button.ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { PageService wikiService = ApplicationContextUtil .getSpringBean(PageService.class); wikiService.removeResource(resource.getPath()); resources.remove(resource); displayPages(resources); } } }); } }); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES)); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setStyleName("link"); controlBtns.addComponent(deleteBtn); block.addComponent(controlBtns); MHorizontalLayout wrapper = new MHorizontalLayout(); wrapper.with(iconResource, block); container.with(wrapper); return container; }
From source file:com.esofthead.mycollab.module.project.view.ProjectAddBaseTemplateWindow.java
License:Open Source License
public ProjectAddBaseTemplateWindow() { super(AppContext.getMessage(ProjectI18nEnum.OPT_CREATE_PROJECT_FROM_TEMPLATE)); this.setModal(true); this.setClosable(true); this.setResizable(false); this.setWidth("550px"); MVerticalLayout content = new MVerticalLayout(); GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3); final TemplateProjectComboBox templateProjectComboBox = new TemplateProjectComboBox(); Button helpBtn = new Button(""); helpBtn.setIcon(FontAwesome.QUESTION_CIRCLE); helpBtn.addStyleName(UIConstants.BUTTON_ACTION); helpBtn.setDescription(AppContext.getMessage(ProjectI18nEnum.OPT_MARK_TEMPLATE_HELP)); gridFormLayoutHelper/*from ww w .j a v a 2s . c o m*/ .addComponent( new MHorizontalLayout().withFullWidth().with(templateProjectComboBox, helpBtn) .expand(templateProjectComboBox), AppContext.getMessage(ProjectI18nEnum.FORM_TEMPLATE), 0, 0); final TextField prjNameField = new TextField(); gridFormLayoutHelper.addComponent(prjNameField, AppContext.getMessage(GenericI18Enum.FORM_NAME), 0, 1); final TextField prjKeyField = new TextField(); gridFormLayoutHelper.addComponent(prjKeyField, AppContext.getMessage(ProjectI18nEnum.FORM_SHORT_NAME), 0, 2); MHorizontalLayout buttonControls = new MHorizontalLayout(); content.with(gridFormLayoutHelper.getLayout(), buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); Button okBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_OK), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { SimpleProject templatePrj = (SimpleProject) templateProjectComboBox.getValue(); if (templatePrj == null) { NotificationUtil.showErrorNotification( AppContext.getMessage(ProjectI18nEnum.ERROR_MUST_CHOOSE_TEMPLATE_PROJECT)); return; } String newPrjName = prjNameField.getValue(); if (newPrjName.length() == 0) { NotificationUtil.showErrorNotification("Project name must be not null"); return; } String newPrjKey = prjKeyField.getValue(); if (newPrjKey.length() > 3 || newPrjKey.length() == 0) { NotificationUtil .showErrorNotification("Project key must be not null and less than 3 characters"); return; } ProjectTemplateService projectTemplateService = AppContextUtil .getSpringBean(ProjectTemplateService.class); if (projectTemplateService != null) { Integer newProjectId = projectTemplateService.cloneProject(templatePrj.getId(), newPrjName, newPrjKey, AppContext.getAccountId(), AppContext.getUsername()); EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, new PageActionChain(new ProjectScreenData.Goto(newProjectId)))); close(); } } }); okBtn.setIcon(FontAwesome.SAVE); okBtn.addStyleName(UIConstants.BUTTON_ACTION); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); buttonControls.with(cancelBtn, okBtn); this.setContent(content); }
From source file:com.esofthead.mycollab.module.project.view.ProjectInformationComponent.java
License:Open Source License
public ProjectInformationComponent() { this.setStyleName(UIConstants.PROJECT_INFO); this.prjDisplay = new BasicProjectInformation(); this.projectInfoHeader = new MHorizontalLayout().withMargin(true).withWidth("100%"); this.projectInfoHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.projectInfoHeader.setStyleName(UIConstants.PROJECT_INFO_HEADER); this.addComponent(this.projectInfoHeader); this.addComponent(this.prjDisplay); MHorizontalLayout projectInfoFooter = new MHorizontalLayout().withMargin(true) .withStyleName(UIConstants.PROJECT_INFO_FOOTER); final Button toggleBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_MORE)); toggleBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w . ja v a 2 s . c o m*/ public void buttonClick(final ClickEvent event) { final int replaceIndex = ProjectInformationComponent.this .getComponentIndex(ProjectInformationComponent.this.prjDisplay); ProjectInformationComponent.this.removeComponent(ProjectInformationComponent.this.prjDisplay); if (ProjectInformationComponent.this.prjDisplay instanceof BasicProjectInformation) { ProjectInformationComponent.this.prjDisplay = new DetailProjectInformation(); event.getButton().setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_LESS)); } else { ProjectInformationComponent.this.prjDisplay = new BasicProjectInformation(); event.getButton().setCaption(AppContext.getMessage(GenericI18Enum.BUTTON_MORE)); } ProjectInformationComponent.this.addComponent(ProjectInformationComponent.this.prjDisplay, replaceIndex); ProjectInformationComponent.this.prjDisplay.show(); } }); toggleBtn.setStyleName(UIConstants.THEME_GREEN_LINK); projectInfoFooter.addComponent(toggleBtn); this.addComponent(projectInfoFooter); }
From source file:com.esofthead.mycollab.module.project.view.ProjectListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { MHorizontalLayout layout = new MHorizontalLayout().withFullWidth(); layout.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); selectOptionButton = new SelectionOptionButton(tableItem); selectOptionButton.setWidthUndefined(); layout.addComponent(selectOptionButton); tableActionControls = new DefaultMassItemActionHandlerContainer(); tableActionControls.addDownloadPdfActionItem(); tableActionControls.addDownloadExcelActionItem(); tableActionControls.addDownloadCsvActionItem(); tableActionControls.setVisible(false); tableActionControls.setWidthUndefined(); layout.addComponent(tableActionControls); selectedItemsNumberLabel.setWidth("100%"); layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER) .expand(selectedItemsNumberLabel); Button customizeViewBtn = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from www . ja va 2 s . c om public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem)); } }); customizeViewBtn.setIcon(FontAwesome.ADJUST); customizeViewBtn.setDescription("Layout Options"); customizeViewBtn.addStyleName(UIConstants.BUTTON_ACTION); layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.project.view.ProjectSearchPanel.java
License:Open Source License
@Override protected Component buildExtraControls() { Button createBtn = new Button(AppContext.getMessage(ProjectI18nEnum.NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// www.jav a 2 s. co m public void buttonClick(final Button.ClickEvent event) { UI.getCurrent().addWindow(new ProjectAddWindow()); } }); createBtn.setStyleName(UIConstants.BUTTON_ACTION); createBtn.setIcon(FontAwesome.PLUS); createBtn.setEnabled(AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)); return createBtn; }
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();/* ww w . j a va 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(); }