@Override protected void onGo(final ComponentContainer container, final ScreenData<?> data) { if (CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS)) { InsideProjectNavigationMenu projectModuleMenu = (InsideProjectNavigationMenu) ((MobileNavigationManager) UI.getCurrent().getContent()).getNavigationMenu(); projectModuleMenu.selectButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK)); if (data.getParams() instanceof Integer) { ProjectTaskService taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); SimpleTask task = taskService.findById((Integer) data.getParams(), AppContext.getAccountId()); if (task != null) { this.view.previewItem(task); super.onGo(container, data); AppContext.addFragment( ProjectLinkGenerator.generateTaskPreviewLink( task.getTaskkey(), task.getProjectShortname()), task.getTaskname()); } else { NotificationUtil.showRecordNotExistNotification(); return; } } } else { NotificationUtil.showMessagePermissionAlert(); } }
@Override protected Double getRemainedHours(SimpleTask bean) { if (bean.getRemainestimate() != null) { return bean.getRemainestimate(); } return 0d; }
private void updateFieldValue(TextField editField) { removeComponent(editField); addComponent(taskLinkLbl); addStyleName("editable-field"); String newValue = editField.getValue(); if (StringUtils.isNotBlank(newValue) && !newValue.equals(task.getTaskname())) { task.setTaskname(newValue); taskLinkLbl.setValue(buildTaskLink()); ProjectTaskService taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); taskService.updateWithSession(task, AppContext.getUsername()); } isRead = !isRead; }
private String buildTaskLink() { String uid = UUID.randomUUID().toString(); String linkName = String.format( "[#%d] - %s", task.getTaskkey(), StringUtils.trim(task.getTaskname(), maxLength, true)); A taskLink = new A() .setId("tag" + uid) .setHref( ProjectLinkBuilder.generateTaskPreviewFullLink( task.getTaskkey(), CurrentProjectVariables.getShortName())) .appendText(linkName) .setStyle("display:inline"); Div resultDiv = new DivLessFormatter().appendChild(taskLink); if (task.isOverdue()) { taskLink.setCSSClass("overdue"); resultDiv.appendChild( new Span() .setCSSClass(UIConstants.LABEL_META_INFO) .appendText(" - Due in " + AppContext.formatDuration(task.getDeadline()))); } else if (task.isCompleted()) { taskLink.setCSSClass("completed"); } taskLink.setAttribute( "onmouseover", TooltipHelper.projectHoverJsFunction(uid, ProjectTypeConstants.TASK, task.getId() + "")); taskLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid)); resultDiv.appendChild(TooltipHelper.buildDivTooltipEnable(uid)); return resultDiv.write(); }
@Override protected Double getTotalNonBillableHours(SimpleTask bean) { ItemTimeLoggingSearchCriteria criteria = new ItemTimeLoggingSearchCriteria(); criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); criteria.setType(StringSearchField.and(ProjectTypeConstants.TASK)); criteria.setTypeId(new NumberSearchField(bean.getId())); criteria.setIsBillable(new BooleanSearchField(false)); return itemTimeLoggingService.getTotalHoursByCriteria(criteria); }