Esempio 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());
 }
Esempio n. 2
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);
    }
Esempio n. 3
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());
 }
Esempio n. 4
0
  public static String generateTooltipUser(
      Locale locale, SimpleUser user, String siteURL, TimeZone timeZone) {
    try {
      if (user == null) {
        return generateTolltipNull(locale);
      }

      Div div = new Div();
      H3 userFullName =
          new H3()
              .setStyle(
                  "font: 12px Arial, Verdana, Helvetica, sans-serif !important;line-height: normal;");
      userFullName.setStyle("padding-left:10px;").appendText(user.getDisplayName());
      div.appendChild(userFullName);

      Table table = new Table();
      table.setStyle("padding-left:10px; width :380px; color: #5a5a5a; font-size:11px;");
      Tr trRow1 =
          new Tr()
              .appendChild(
                  new Td()
                      .setStyle("width: 110px; vertical-align: top; text-align: right;")
                      .appendText(LocalizationHelper.getMessage(locale, UserI18nEnum.FORM_EMAIL)))
              .appendChild(
                  new Td()
                      .setStyle("vertical-align: top;")
                      .appendChild(
                          new A()
                              .setHref("mailto:" + user.getEmail())
                              .appendText(StringUtils.trimHtmlTags(user.getEmail()))));

      Td trRow1_value =
          new Td()
              .setStyle("width:150px;text-align: right; vertical-align: top;")
              .appendChild(
                  new Img("", StorageFactory.getInstance().getAvatarPath(user.getAvatarid(), 100)));
      trRow1_value.setAttribute("rowspan", "5");
      trRow1.appendChild(
          new Td()
              .setStyle("width: 0px; vertical-align: top; text-align: right;")
              .appendChild(trRow1_value));

      Tr trRow2 =
          new Tr()
              .appendChild(
                  new Td()
                      .setStyle("width: 110px; vertical-align: top; text-align: right;")
                      .appendText(
                          LocalizationHelper.getMessage(locale, UserI18nEnum.FORM_TIMEZONE)))
              .appendChild(
                  new Td()
                      .setStyle("vertical-align: top;")
                      .appendText(
                          TimezoneMapper.getTimezoneExt(user.getTimezone()).getDisplayName()));
      Tr trRow3 =
          new Tr()
              .appendChild(
                  new Td()
                      .setStyle("width: 110px; vertical-align: top; text-align: right;")
                      .appendText(LocalizationHelper.getMessage(locale, UserI18nEnum.FORM_COUNTRY)))
              .appendChild(
                  new Td()
                      .setStyle("vertical-align: top;")
                      .appendText(StringUtils.trimHtmlTags(user.getCountry())));

      Tr trRow4 =
          new Tr()
              .appendChild(
                  new Td()
                      .setStyle("width: 110px; vertical-align: top; text-align: right;")
                      .appendText(
                          LocalizationHelper.getMessage(locale, UserI18nEnum.FORM_WORK_PHONE)))
              .appendChild(
                  new Td()
                      .setStyle("vertical-align: top;")
                      .appendText(StringUtils.trimHtmlTags(user.getWorkphone())));

      Tr trRow5 =
          new Tr()
              .appendChild(
                  new Td()
                      .setStyle("width: 110px; vertical-align: top; text-align: right;")
                      .appendText(
                          LocalizationHelper.getMessage(
                              locale, GenericI18Enum.FORM_LAST_ACCESSED_TIME)))
              .appendChild(
                  new Td()
                      .setStyle(
                          "word-wrap: break-word; white-space: normal;vertical-align: top; word-break: break-all;")
                      .appendText(
                          DateTimeUtils.getPrettyDateValue(user.getLastaccessedtime(), locale)));
      table.appendChild(trRow1, trRow2, trRow3, trRow4, trRow5);
      div.appendChild(table);
      return div.write();
    } catch (Exception e) {
      LOG.error("Error while generate tooltip for servlet project-task tooltip", e);
      return null;
    }
  }