List of usage examples for com.vaadin.ui Button setEnabled
@Override public void setEnabled(boolean enabled)
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 ww w .j a v a 2 s . co 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 av a 2 s .c om 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.ProjectModule.java
License:Open Source License
@Override public MHorizontalLayout buildMenu() { if (serviceMenuContainer == null) { serviceMenuContainer = new MHorizontalLayout(); final ServiceMenu serviceMenu = new ServiceMenu(); serviceMenu.addService(AppContext.getMessage(ProjectI18nEnum.LIST), new Button.ClickListener() { @Override/*from www. jav a2 s .com*/ 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.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// w w w. j a v a2 s. c o 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();/*from ww w . 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.ComponentSearchPanel.java
License:Open Source License
@Override protected Component buildExtraControls() { Button createBtn = new Button(AppContext.getMessage(ComponentI18nEnum.NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/*from w w w . j a v a 2 s. c om*/ public void buttonClick(final Button.ClickEvent event) { EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null)); } }); createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS)); createBtn.setStyleName(UIConstants.BUTTON_ACTION); createBtn.setIcon(FontAwesome.PLUS); return createBtn; }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
public ProjectMemberListViewImpl() { super();/*from w ww .j a v a 2 s . c o m*/ 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.ProjectRoleListViewImpl.java
License:Open Source License
private ComponentContainer constructTableActionControls() { final CssLayout layoutWrapper = new CssLayout(); layoutWrapper.setWidth("100%"); final MHorizontalLayout layout = new MHorizontalLayout(); layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS); layoutWrapper.addComponent(layout);/*from www. java 2s . co m*/ this.selectOptionButton = new SelectionOptionButton(this.tableItem); layout.addComponent(this.selectOptionButton); final Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.ROLES)); this.tableActionControls = new DefaultMassItemActionHandlersContainer(); if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.ROLES)) { tableActionControls.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete", AppContext.getMessage(GenericI18Enum.BUTTON_DELETE)); } tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O, "export", "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION, FontAwesome.FILE_EXCEL_O, "export", "export.xlsx", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL)); tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O, "export", "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV)); layout.addComponent(this.tableActionControls); layout.addComponent(this.selectedItemsNumberLabel); layout.setComponentAlignment(this.selectedItemsNumberLabel, Alignment.MIDDLE_CENTER); return layoutWrapper; }
From source file:com.esofthead.mycollab.module.project.view.settings.VersionSearchPanel.java
License:Open Source License
@Override protected Component buildExtraControls() { Button createBtn = new Button(AppContext.getMessage(VersionI18nEnum.NEW), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//w w w .j a v a 2 s .c o m public void buttonClick(final Button.ClickEvent event) { EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null)); } }); createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS)); createBtn.setStyleName(UIConstants.BUTTON_ACTION); createBtn.setIcon(FontAwesome.PLUS); return createBtn; }
From source file:com.esofthead.mycollab.module.project.view.task.components.TaskRowRenderer.java
License:Open Source License
private OptionPopupContent createPopupContent() { OptionPopupContent filterBtnLayout = new OptionPopupContent(); Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w ww . ja v a 2 s .c o m public void buttonClick(Button.ClickEvent event) { taskSettingPopupBtn.setPopupVisible(false); EventBusFactory.getInstance().post(new TaskEvent.GotoEdit(TaskRowRenderer.this, task)); } }); editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); editButton.setIcon(FontAwesome.EDIT); filterBtnLayout.addOption(editButton); filterBtnLayout.addSeparator(); if (!task.isCompleted()) { Button closeBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLOSE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus(OptionI18nEnum.StatusI18nEnum.Closed.name()); task.setPercentagecomplete(100d); ProjectTaskService projectTaskService = AppContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateSelectiveWithSession(task, AppContext.getUsername()); taskSettingPopupBtn.setPopupVisible(false); closeTask(); EventBusFactory.getInstance() .post(new TaskEvent.HasTaskChange(TaskRowRenderer.this, null)); } }); closeBtn.setIcon(FontAwesome.CHECK_CIRCLE_O); closeBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addOption(closeBtn); } else { Button reOpenBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_REOPEN), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { taskSettingPopupBtn.setPopupVisible(false); task.setStatus(OptionI18nEnum.StatusI18nEnum.Open.name()); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = AppContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateSelectiveWithSession(task, AppContext.getUsername()); reOpenTask(); EventBusFactory.getInstance() .post(new TaskEvent.HasTaskChange(TaskRowRenderer.this, null)); } }); reOpenBtn.setIcon(FontAwesome.UNLOCK); reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addOption(reOpenBtn); } filterBtnLayout.addSeparator(); Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { taskSettingPopupBtn.setPopupVisible(false); ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.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 = AppContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.removeWithSession(task, AppContext.getUsername(), AppContext.getAccountId()); deleteTask(); } } }); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addDangerOption(deleteBtn); return filterBtnLayout; }