new ListDataProvider<RepositoryCommit>(entry.getCommits())) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<RepositoryCommit> commitItem) {
final RepositoryCommit commit = commitItem.getModelObject();
// commit time of day
commitItem.add(WicketUtils.createTimeLabel("time", commit.getCommitterIdent()
.getWhen(), getTimeZone(), getTimeUtils()));
// avatar
commitItem.add(new GravatarImage("avatar", commit.getAuthorIdent(), 40));
// merge icon
if (commit.getParentCount() > 1) {
commitItem.add(WicketUtils.newImage("commitIcon",
"commit_merge_16x16.png"));
} else {
commitItem.add(WicketUtils.newBlankImage("commitIcon").setVisible(false));
}
// author search link
String author = commit.getAuthorIdent().getName();
LinkPanel authorLink = new LinkPanel("author", "list", author,
GitSearchPage.class, WicketUtils.newSearchParameter(commit.repository,
null, author, Constants.SearchType.AUTHOR), true);
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
commitItem.add(authorLink);
// repository
String repoName = StringUtils.stripDotGit(commit.repository);
LinkPanel repositoryLink = new LinkPanel("repository", null,
repoName, SummaryPage.class,
WicketUtils.newRepositoryParameter(commit.repository), true);
WicketUtils.setCssBackground(repositoryLink, repoName);
commitItem.add(repositoryLink);
// repository branch
LinkPanel branchLink = new LinkPanel("branch", "list", Repository.shortenRefName(commit.branch),
LogPage.class, WicketUtils.newObjectParameter(commit.repository,
commit.branch), true);
WicketUtils.setCssStyle(branchLink, "color: #008000;");
commitItem.add(branchLink);
LinkPanel commitid = new LinkPanel("commitid", "list subject",
commit.getName().substring(0, shortHashLen), CommitPage.class,
WicketUtils.newObjectParameter(commit.repository, commit.getName()), true);
commitItem.add(commitid);
// message/commit link
String shortMessage = commit.getShortMessage();
String trimmedMessage = shortMessage;
if (commit.getRefs() != null && commit.getRefs().size() > 0) {
trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG_REFS);
} else {
trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
}
LinkPanel shortlog = new LinkPanel("message", "list subject",
trimmedMessage, CommitPage.class, WicketUtils.newObjectParameter(
commit.repository, commit.getName()), true);
if (!shortMessage.equals(trimmedMessage)) {
WicketUtils.setHtmlTooltip(shortlog, shortMessage);
}
commitItem.add(shortlog);
// refs
commitItem.add(new RefsPanel("commitRefs", commit.repository, commit
.getRefs()));
// diff, tree links
commitItem.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class,
WicketUtils.newObjectParameter(commit.repository, commit.getName()))
.setEnabled(commit.getParentCount() > 0));
commitItem.add(new BookmarkablePageLink<Void>("tree", TreePage.class,
WicketUtils.newObjectParameter(commit.repository, commit.getName())));
}
};
activityItem.add(commits);
}
};