コード例 #1
0
ファイル: ProjectUserLink.java プロジェクト: gsccs/mycollab
 public ProjectUserLink(String username, String userAvatarId, String displayName) {
   if (StringUtils.isBlank(username)) {
     return;
   }
   this.setContentMode(ContentMode.HTML);
   DivLessFormatter div = new DivLessFormatter();
   String uid = UUID.randomUUID().toString();
   Img avatarLink = new Img("", StorageFactory.getInstance().getAvatarPath(userAvatarId, 16));
   A memberLink =
       new A()
           .setId("tag" + uid)
           .setHref(
               ProjectLinkBuilder.generateProjectMemberFullLink(
                   CurrentProjectVariables.getProjectId(), username))
           .appendText(StringUtils.trim(displayName, 30, true));
   memberLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(uid, username));
   memberLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid));
   div.appendChild(
       avatarLink,
       DivLessFormatter.EMPTY_SPACE(),
       memberLink,
       DivLessFormatter.EMPTY_SPACE(),
       TooltipHelper.buildDivTooltipEnable(uid));
   this.setValue(div.write());
 }
コード例 #2
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();
  }
コード例 #3
0
    void displayPageInfo(Page beanItem) {
      MVerticalLayout header = new MVerticalLayout().withMargin(false);
      Label titleLbl = new Label(beanItem.getSubject());
      titleLbl.setStyleName("headerName");
      header.with(titleLbl);
      Div footer = new Div().setStyle("width:100%").setCSSClass("footer2");
      Span lastUpdatedTimeTxt =
          new Span()
              .appendText(
                  AppContext.getMessage(
                      DayI18nEnum.LAST_UPDATED_ON,
                      AppContext.formatPrettyTime(beanItem.getLastUpdatedTime().getTime())))
              .setTitle(AppContext.formatDateTime(beanItem.getLastUpdatedTime().getTime()));
      String uid = UUID.randomUUID().toString();
      ProjectMemberService projectMemberService =
          ApplicationContextUtil.getSpringBean(ProjectMemberService.class);
      SimpleProjectMember member =
          projectMemberService.findMemberByUsername(
              beanItem.getCreatedUser(),
              CurrentProjectVariables.getProjectId(),
              AppContext.getAccountId());
      if (member != null) {
        Img userAvatar =
            new Img("", StorageFactory.getInstance().getAvatarPath(member.getMemberAvatarId(), 16));
        A userLink =
            new A()
                .setId("tag" + uid)
                .setHref(
                    ProjectLinkBuilder.generateProjectMemberFullLink(
                        member.getProjectid(), member.getUsername()))
                .appendText(StringUtils.trim(member.getMemberFullName(), 30, true));
        userLink.setAttribute(
            "onmouseover", TooltipHelper.userHoverJsFunction(uid, member.getUsername()));
        userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid));
        footer.appendChild(
            lastUpdatedTimeTxt,
            new Text(" - Created by: "),
            userAvatar,
            DivLessFormatter.EMPTY_SPACE(),
            userLink,
            DivLessFormatter.EMPTY_SPACE(),
            TooltipHelper.buildDivTooltipEnable(uid));
      } else {
        footer.appendChild(lastUpdatedTimeTxt);
      }

      header.addComponent(new Label(footer.write(), ContentMode.HTML));
      this.addHeader(header);
    }
コード例 #4
0
ファイル: UserLink.java プロジェクト: nemoo3ki/mycollab
 public UserLink(String username, String userAvatarId, String displayName) {
   if (StringUtils.isBlank(username)) {
     return;
   }
   this.setContentMode(ContentMode.HTML);
   String uid = UUID.randomUUID().toString();
   DivLessFormatter div = new DivLessFormatter();
   Img userAvatar = new Img("", StorageFactory.getInstance().getAvatarPath(userAvatarId, 16));
   A userLink =
       new A()
           .setId("tag" + uid)
           .setHref(
               AccountLinkGenerator.generatePreviewFullUserLink(AppContext.getSiteUrl(), username))
           .appendText(StringUtils.trim(displayName, 30, true));
   userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(uid, username));
   userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction(uid));
   div.appendChild(
       userAvatar,
       DivLessFormatter.EMPTY_SPACE(),
       userLink,
       DivLessFormatter.EMPTY_SPACE(),
       TooltipHelper.buildDivTooltipEnable(uid));
   this.setValue(div.write());
 }