Ejemplo n.º 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();
  }