List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:com.esofthead.mycollab.module.project.view.task.TaskAddPopup.java
License:Open Source License
public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) { final VerticalLayout taskLayout = new VerticalLayout(); taskLayout.addStyleName("taskadd-popup"); final VerticalLayout popupHeader = new VerticalLayout(); popupHeader.setWidth("100%"); popupHeader.setMargin(true);/*from w w w . j av a 2 s . c o m*/ popupHeader.addStyleName("popup-header"); final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE)); titleLbl.addStyleName("bold"); popupHeader.addComponent(titleLbl); taskLayout.addComponent(popupHeader); this.task = new SimpleTask(); TabSheet taskContainer = new TabSheet(); final TaskInputForm taskInputForm = new TaskInputForm(); taskInputForm.setWidth("100%"); taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE)); this.taskNoteComponent = new TaskNoteLayout(); taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT)); taskLayout.addComponent(taskContainer); final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true); controlsLayout.addStyleName("popup-footer"); final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { taskDisplayComp.closeTaskAdd(); } }); cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK); final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (taskInputForm.validateForm()) { final ProjectTaskService taskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); task.setTasklistid(taskList.getId()); task.setProjectid(CurrentProjectVariables.getProjectId()); task.setSaccountid(AppContext.getAccountId()); task.setNotes(taskNoteComponent.getNote()); taskService.saveWithSession(task, AppContext.getUsername()); taskNoteComponent.saveContentsToRepo(task.getId()); taskDisplayComp.saveTaskSuccess(task); taskDisplayComp.closeTaskAdd(); } } }); saveBtn.setIcon(FontAwesome.SAVE); saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK); controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER); taskLayout.addComponent(controlsLayout); taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT); this.setCompositionRoot(taskLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskDisplayComponent.java
License:Open Source License
private void showTaskGroupInfo() { if (this.isDisplayTaskListInfo) { AdvancedPreviewBeanForm<SimpleTaskList> previewForm = new AdvancedPreviewBeanForm<>(); previewForm.setWidth("100%"); previewForm.setFormLayoutFactory(new IFormLayoutFactory() { private static final long serialVersionUID = 1L; private GridFormLayoutHelper layoutHelper; @Override/*w w w .j a v a 2s .co m*/ public ComponentContainer getLayout() { this.layoutHelper = new GridFormLayoutHelper(2, 3, "100%", "180px", Alignment.TOP_LEFT); this.layoutHelper.getLayout().setWidth("100%"); this.layoutHelper.getLayout().addStyleName("colored-gridlayout"); this.layoutHelper.getLayout().setMargin(false); return this.layoutHelper.getLayout(); } @Override public void attachField(Object propertyId, Field<?> field) { if ("description".equals(propertyId)) { layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 0, 2, "100%"); } else if ("owner".equals(propertyId)) { layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 1); } else if ("milestoneid".equals(propertyId)) { layoutHelper.addComponent(field, AppContext.getMessage(TaskGroupI18nEnum.FORM_PHASE_FIELD), 1, 1); } } }); previewForm.setBeanFormFieldFactory( new AbstractBeanFieldGroupViewFieldFactory<SimpleTaskList>(previewForm) { private static final long serialVersionUID = 1L; @Override protected Field<?> onCreateField(Object propertyId) { if ("description".equals(propertyId)) { return new DefaultViewField(taskList.getDescription(), ContentMode.HTML); } else if ("owner".equals(propertyId)) { return new ProjectUserFormLinkField(taskList.getOwner(), taskList.getOwnerAvatarId(), taskList.getOwnerFullName()); } else if ("milestoneid".equals(propertyId)) { return new LinkViewField(taskList.getMilestoneName(), ProjectLinkBuilder.generateMilestonePreviewFullLink(taskList.getProjectid(), taskList.getMilestoneid()), ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE)); } return null; } }); this.addComponent(previewForm); previewForm.setBean(this.taskList); } this.taskDisplay = new TaskTableDisplay(TaskTableFieldDef.id, Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.assignee, TaskTableFieldDef.percentagecomplete)); this.addComponent(this.taskDisplay); this.taskDisplay.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleTask task = (SimpleTask) event.getData(); if ("taskname".equals(event.getFieldName())) { EventBusFactory.getInstance() .post(new TaskEvent.GotoRead(TaskDisplayComponent.this, task.getId())); } else if ("closeTask".equals(event.getFieldName()) || "reopenTask".equals(event.getFieldName()) || "pendingTask".equals(event.getFieldName()) || "deleteTask".equals(event.getFieldName())) { TaskDisplayComponent.this.removeAllComponents(); final ProjectTaskListService taskListService = ApplicationContextUtil .getSpringBean(ProjectTaskListService.class); TaskDisplayComponent.this.taskList = taskListService .findById(TaskDisplayComponent.this.taskList.getId(), AppContext.getAccountId()); TaskDisplayComponent.this.showTaskGroupInfo(); } } }); this.createTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { TaskDisplayComponent.this .removeComponent(TaskDisplayComponent.this.createTaskBtn.getParent()); TaskAddPopup taskAddView = new TaskAddPopup(TaskDisplayComponent.this, TaskDisplayComponent.this.taskList); TaskDisplayComponent.this.addComponent(taskAddView); } }); this.createTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); this.createTaskBtn.setIcon(FontAwesome.PLUS); this.createTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK); final VerticalLayout taskGroupFooter = new VerticalLayout(); taskGroupFooter.setMargin(true); taskGroupFooter.addStyleName("task-list-footer"); taskGroupFooter.addComponent(this.createTaskBtn); taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT); this.addComponent(taskGroupFooter); if (CollectionUtils.isNotEmpty(taskList.getSubTasks())) { taskDisplay.setCurrentDataList(taskList.getSubTasks()); } else { taskDisplay.setCurrentDataList(new ArrayList<SimpleTask>()); } }
From source file:com.esofthead.mycollab.module.project.view.task.TaskDisplayComponent.java
License:Open Source License
public void closeTaskAdd() { final VerticalLayout taskGroupFooter = new VerticalLayout(); taskGroupFooter.setMargin(true);//w w w . j a v a2s.c om taskGroupFooter.addStyleName("task-list-footer"); taskGroupFooter.addComponent(this.createTaskBtn); taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT); this.addComponent(taskGroupFooter); Iterator<Component> comps = this.iterator(); while (comps.hasNext()) { Component component = comps.next(); if (component instanceof TaskAddPopup) { this.removeComponent(component); return; } } }
From source file:com.esofthead.mycollab.module.project.view.task.TaskFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { this.informationLayout = new GridFormLayoutHelper(2, 8, "100%", "180px", Alignment.TOP_LEFT); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(false);//from w w w .j av a2 s . com this.informationLayout.getLayout().setMargin(false); this.informationLayout.getLayout().setWidth("100%"); this.informationLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(this.informationLayout.getLayout()); layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupDisplayViewImpl.java
License:Open Source License
private void constructUI() { this.removeAllComponents(); this.withMargin(new MarginInfo(false, true, true, true)); header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withStyleName("hdr-view").withWidth("100%"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.taskGroupSelection = new PopupButton( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE)); this.taskGroupSelection.setEnabled(CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)); this.taskGroupSelection.addStyleName("link"); this.taskGroupSelection.addStyleName("hdr-text"); taskGroupSelection.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK_LIST)); header.with(taskGroupSelection).withAlign(taskGroupSelection, Alignment.MIDDLE_LEFT) .expand(taskGroupSelection); final MVerticalLayout filterBtnLayout = new MVerticalLayout().withMargin(true).withSpacing(true) .withWidth("200px"); final Button allTasksFilterBtn = new Button( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// w ww.j av a 2s .c om public void buttonClick(final ClickEvent event) { TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false); TaskGroupDisplayViewImpl.this.taskGroupSelection .setCaption(AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE)); TaskGroupDisplayViewImpl.this.displayAllTaskGroups(); } }); allTasksFilterBtn.setStyleName("link"); filterBtnLayout.addComponent(allTasksFilterBtn); final Button activeTasksFilterBtn = new Button( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false); TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE)); TaskGroupDisplayViewImpl.this.displayActiveTaskGroups(); } }); activeTasksFilterBtn.setStyleName("link"); filterBtnLayout.addComponent(activeTasksFilterBtn); final Button archivedTasksFilterBtn = new Button( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption( AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE)); TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false); TaskGroupDisplayViewImpl.this.displayInActiveTaskGroups(); } }); archivedTasksFilterBtn.setStyleName("link"); filterBtnLayout.addComponent(archivedTasksFilterBtn); this.taskGroupSelection.setContent(filterBtnLayout); final Button newTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow( TaskGroupDisplayViewImpl.this); UI.getCurrent().addWindow(taskListWindow); } }); newTaskListBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); newTaskListBtn.setIcon(FontAwesome.PLUS); newTaskListBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP)); newTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); header.addComponent(newTaskListBtn); header.setComponentAlignment(newTaskListBtn, Alignment.MIDDLE_RIGHT); Button reOrderBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.ReoderTaskList(this, null)); } }); reOrderBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); reOrderBtn.setIcon(FontAwesome.SORT); reOrderBtn.setStyleName(UIConstants.THEME_BLUE_LINK); reOrderBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_REODER_TASKGROUP)); header.addComponent(reOrderBtn); header.setComponentAlignment(reOrderBtn, Alignment.MIDDLE_RIGHT); PopupButton exportButtonControl = new PopupButton(); exportButtonControl.addStyleName(UIConstants.THEME_BLUE_LINK); exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK); exportButtonControl.setDescription("Export to file"); VerticalLayout popupButtonsControl = new VerticalLayout(); exportButtonControl.setContent(popupButtonsControl); exportButtonControl.setWidthUndefined(); Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF)); FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF)); pdfDownloader.extend(exportPdfBtn); exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O); exportPdfBtn.setStyleName("link"); popupButtonsControl.addComponent(exportPdfBtn); Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL)); FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL)); excelDownloader.extend(exportExcelBtn); exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O); exportExcelBtn.setStyleName("link"); popupButtonsControl.addComponent(exportExcelBtn); header.with(exportButtonControl).withAlign(exportButtonControl, Alignment.MIDDLE_LEFT); Button advanceDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { displayAdvancedView(); } }); advanceDisplayBtn.setIcon(FontAwesome.SITEMAP); advanceDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP)); Button simpleDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { TaskSearchCriteria searchCriteria = new TaskSearchCriteria(); searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId())); searchCriteria.setStatuses(new SetSearchField<>(new String[] { StatusI18nEnum.Open.name() })); TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search"); taskFilter.setAdvanceSearch(true); moveToTaskSearch(taskFilter); } }); simpleDisplayBtn.setIcon(FontAwesome.LIST_UL); simpleDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.LIST_VIEW_TOOLTIP)); Button chartDisplayBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = -5707546605789537298L; @Override public void buttonClick(ClickEvent event) { displayGanttChartView(); } }); chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O); viewButtons = new ToggleButtonGroup(); viewButtons.addButton(simpleDisplayBtn); viewButtons.addButton(advanceDisplayBtn); viewButtons.addButton(chartDisplayBtn); viewButtons.setDefaultButton(advanceDisplayBtn); mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth().withSpacing(true); this.taskListsWidget = new TaskGroupDisplayWidget(); MVerticalLayout leftColumn = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, false)) .with(taskListsWidget); this.rightColumn = new MVerticalLayout().withWidth("300px") .withMargin(new MarginInfo(true, false, false, false)); mainLayout.with(leftColumn, rightColumn).expand(leftColumn); FloatingComponent floatSidebar = FloatingComponent.floatThis(this.rightColumn); floatSidebar.setContainerId("main-body"); implementTaskFilterButton(); basicSearchView = new TaskSearchViewImpl(); basicSearchView.getSearchHandlers().addSearchHandler(new SearchHandler<TaskSearchCriteria>() { @Override public void onSearch(TaskSearchCriteria criteria) { doSearch(criteria); } }); basicSearchView.removeComponent(basicSearchView.getComponent(0)); displayAdvancedView(); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupFormLayoutFactory.java
License:Open Source License
@Override public Layout getLayout() { this.informationLayout = new GridFormLayoutHelper(2, 4, "100%", "180px", Alignment.TOP_LEFT); this.informationLayout.getLayout().addStyleName("colored-gridlayout"); this.informationLayout.getLayout().setMargin(false); this.informationLayout.getLayout().setWidth("100%"); final VerticalLayout layout = new VerticalLayout(); layout.addComponent(this.informationLayout.getLayout()); layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER); return layout; }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupNoItemView.java
License:Open Source License
public TaskGroupNoItemView() { this.setMargin(new MarginInfo(true, false, false, false)); VerticalLayout layout = new VerticalLayout(); layout.addStyleName("taskgroup-noitem"); layout.setSpacing(true);//w w w .j a v a 2 s .c o m layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); layout.setMargin(true); Image image = new Image(null, MyCollabResource.newResource("icons/48/project/tasklist.png")); layout.addComponent(image); Label title = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_TITLE)); title.addStyleName("h2"); title.setWidthUndefined(); layout.addComponent(title); Label body = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_HINT)); body.setWidthUndefined(); layout.addComponent(body); Button createTaskGroupBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow(null); UI.getCurrent().addWindow(taskListWindow); } }); createTaskGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); HorizontalLayout links = new HorizontalLayout(); links.addComponent(createTaskGroupBtn); createTaskGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK); links.setSpacing(true); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskSearchTableDisplay.java
License:Open Source License
public TaskSearchTableDisplay(TableViewField requiredColumn, List<TableViewField> displayColumns) { super(ApplicationContextUtil.getSpringBean(ProjectTaskService.class), SimpleTask.class, requiredColumn, displayColumns);// www . j a v a 2 s .c om this.addGeneratedColumn("taskname", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); CssLayout taskName = new CssLayout(); String taskname = "[%s-%s] %s"; taskname = String.format(taskname, CurrentProjectVariables.getProject().getShortname(), task.getTaskkey(), task.getTaskname()); LabelLink b = new LabelLink(taskname, ProjectLinkBuilder .generateTaskPreviewFullLink(task.getTaskkey(), task.getProjectShortname())); b.setDescription(ProjectTooltipGenerator.generateToolTipTask(AppContext.getUserLocale(), task, AppContext.getSiteUrl(), AppContext.getTimezone())); if (StringUtils.isNotBlank(task.getPriority())) { b.setIconLink(ProjectResources.getIconResourceLink12ByTaskPriority(task.getPriority())); } if (task.getPercentagecomplete() != null && 100d == task.getPercentagecomplete()) { b.addStyleName(UIConstants.LINK_COMPLETED); } else { if ("Pending".equals(task.getStatus())) { b.addStyleName(UIConstants.LINK_PENDING); } else if ((task.getEnddate() != null && (task.getEnddate().before(new GregorianCalendar().getTime()))) || (task.getActualenddate() != null && (task.getActualenddate().before(new GregorianCalendar().getTime()))) || (task.getDeadline() != null && (task.getDeadline().before(new GregorianCalendar().getTime())))) { b.addStyleName(UIConstants.LINK_OVERDUE); } } taskName.addComponent(b); taskName.setWidth("100%"); taskName.setHeightUndefined(); return taskName; } }); this.addGeneratedColumn("percentagecomplete", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); Double percomp = (task.getPercentagecomplete() == null) ? new Double(0) : task.getPercentagecomplete(); ProgressPercentageIndicator progress = new ProgressPercentageIndicator(percomp); progress.setWidth("100px"); return progress; } }); this.addGeneratedColumn("startdate", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(task.getStartdate())); } }); this.addGeneratedColumn("deadline", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); return new Label(AppContext.formatDate(task.getDeadline())); } }); this.addGeneratedColumn("id", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); PopupButton taskSettingPopupBtn = new PopupButton(); VerticalLayout filterBtnLayout = new VerticalLayout(); filterBtnLayout.setMargin(true); filterBtnLayout.setSpacing(true); filterBtnLayout.setWidth("100px"); Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new TaskEvent.GotoEdit(TaskSearchTableDisplay.this, task)); } }); editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); editButton.setStyleName("link"); filterBtnLayout.addComponent(editButton); if ((task.getPercentagecomplete() != null && task.getPercentagecomplete() != 100) || task.getPercentagecomplete() == null) { Button closeBtn = new Button("Close", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus("Closed"); task.setPercentagecomplete(100d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "closeTask")); } }); closeBtn.setStyleName("link"); closeBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(closeBtn); } else { Button reOpenBtn = new Button("ReOpen", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus("Open"); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "reopenTask")); } }); reOpenBtn.setStyleName("link"); reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(reOpenBtn); } if (!"Pending".equals(task.getStatus())) { if (!"Closed".equals(task.getStatus())) { Button pendingBtn = new Button("Pending", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { task.setStatus("Pending"); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent( new TableClickEvent(TaskSearchTableDisplay.this, task, "pendingTask")); } }); pendingBtn.setStyleName("link"); pendingBtn.setEnabled( CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(pendingBtn); } } else { Button reOpenBtn = new Button("ReOpen", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { task.setStatus("Open"); task.setPercentagecomplete(0d); ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.updateWithSession(task, AppContext.getUsername()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "reopenTask")); } }); reOpenBtn.setStyleName("link"); reOpenBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(reOpenBtn); } Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ConfirmDialogExt.show(UI.getCurrent(), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, SiteConfiguration.getSiteName()), AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), AppContext.getMessage(GenericI18Enum.BUTTON_YES), AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() { private static final long serialVersionUID = 1L; @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { ProjectTaskService projectTaskService = ApplicationContextUtil .getSpringBean(ProjectTaskService.class); projectTaskService.removeWithSession(task.getId(), AppContext.getUsername(), AppContext.getAccountId()); fireTableEvent(new TableClickEvent(TaskSearchTableDisplay.this, task, "deleteTask")); } } }); } }); deleteBtn.setStyleName("link"); deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)); filterBtnLayout.addComponent(deleteBtn); taskSettingPopupBtn.setIcon(MyCollabResource.newResource("icons/16/item_settings.png")); taskSettingPopupBtn.setStyleName("link"); taskSettingPopupBtn.setContent(filterBtnLayout); return taskSettingPopupBtn; } }); this.addGeneratedColumn("assignUserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) { final SimpleTask task = TaskSearchTableDisplay.this.getBeanByIndex(itemId); return new ProjectUserLink(task.getAssignuser(), task.getAssignUserAvatarId(), task.getAssignUserFullName()); } }); this.setWidth("100%"); }
From source file:com.esofthead.mycollab.module.project.view.task.UnresolvedTaskByAssigneeWidget.java
License:Open Source License
public UnresolvedTaskByAssigneeWidget() { super(AppContext.getMessage(TaskI18nEnum.WIDGET_UNRESOLVED_BY_ASSIGNEE_TITLE), new VerticalLayout()); this.setContentBorder(true); ((VerticalLayout) this.bodyContent).setSpacing(true); ((VerticalLayout) this.bodyContent).setMargin(true); }
From source file:com.esofthead.mycollab.module.project.view.task.UnresolvedTaskByPriorityWidget.java
License:Open Source License
public UnresolvedTaskByPriorityWidget() { super(AppContext.getMessage(TaskI18nEnum.WIDGET_UNRESOLVED_BY_PRIORITY_TITLE), new VerticalLayout()); this.setContentBorder(true); ((VerticalLayout) this.bodyContent).setSpacing(true); ((VerticalLayout) this.bodyContent).setMargin(true); }