private AccountLinkPanel(AccountInfo ai, Function<String, String> nameToQuery) {
    addStyleName(Gerrit.RESOURCES.css().accountLinkPanel());

    InlineHyperlink l =
        new InlineHyperlink(FormatUtil.name(ai), nameToQuery.apply(name(ai))) {
          @Override
          public void go() {
            Gerrit.display(getTargetHistoryToken());
          }
        };
    l.setTitle(FormatUtil.nameEmail(ai));

    add(new AvatarImage(ai));
    add(l);
  }
示例#2
0
  private void revision(SafeHtmlBuilder sb, int index, RevisionInfo r) {
    CommitInfo c = r.commit();
    sb.openTr();
    if (revision.equals(r.name())) {
      sb.setStyleName(style.current());
    }

    sb.openTd().setStyleName(style.legacy_id());
    if (r.draft()) {
      sb.append(Resources.C.draft()).append(' ');
    }
    sb.append(r.id());
    sb.closeTd();

    sb.openTd()
        .setStyleName(style.commit())
        .openAnchor()
        .setAttribute("href", "#" + url(r))
        .setAttribute("onclick", OPEN + "(event," + index + ")")
        .append(r.name().substring(0, 10))
        .closeAnchor()
        .closeTd();

    sb.openTd().append(FormatUtil.shortFormatDayTime(c.committer().date())).closeTd();

    String an = c.author() != null ? c.author().name() : "";
    String cn = c.committer() != null ? c.committer().name() : "";
    sb.openTd();
    sb.append(an);
    if (!"".equals(an) && !"".equals(cn) && !an.equals(cn)) {
      sb.append(" / ").append(cn);
    }
    sb.closeTd();

    sb.closeTr();
  }