コード例 #1
0
  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();
  }
コード例 #2
0
  @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();
    }
  }
コード例 #3
0
  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;
  }