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