private static final long serialVersionUID = 1L;
int counter;
@Override
public void populateItem(final Item<RefModel> item) {
final RefModel entry = item.getModelObject();
item.add(WicketUtils.createDateLabel("branchDate", entry.getDate(), getTimeZone(), getTimeUtils()));
item.add(new LinkPanel("branchName", "list name", StringUtils.trimString(
entry.displayName, 28), LogPage.class, WicketUtils.newObjectParameter(
model.name, entry.getName())));
String author = entry.getAuthorIdent().getName();
LinkPanel authorLink = new LinkPanel("branchAuthor", "list", author,
GitSearchPage.class, WicketUtils.newSearchParameter(model.name,
entry.getName(), author, Constants.SearchType.AUTHOR));
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);
item.add(authorLink);
// short message
String shortMessage = entry.getShortMessage();
String trimmedMessage = StringUtils.trimString(shortMessage, Constants.LEN_SHORTLOG);
LinkPanel shortlog = new LinkPanel("branchLog", "list subject", trimmedMessage,
CommitPage.class, WicketUtils.newObjectParameter(model.name,
entry.getName()));
if (!shortMessage.equals(trimmedMessage)) {
shortlog.setTooltip(shortMessage);
}
item.add(shortlog);
if (maxCount <= 0) {
Fragment fragment = new Fragment("branchLinks", showDelete? "branchPageAdminLinks" : "branchPageLinks", this);
fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
.newObjectParameter(model.name, entry.getName())));
fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
.newObjectParameter(model.name, entry.getName())));
String rawUrl = RawServlet.asLink(getContextUrl(), model.name, Repository.shortenRefName(entry.getName()), null);
fragment.add(new ExternalLink("raw", rawUrl));
fragment.add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class,
WicketUtils.newObjectParameter(model.name, entry.getName())));
fragment.add(new ExternalLink("syndication", SyndicationServlet.asLink(
getRequest().getRelativePathPrefixToContextRoot(), model.name,
entry.getName(), 0)));
if (showDelete) {
fragment.add(createDeleteBranchLink(model, entry));
}
item.add(fragment);
} else {
Fragment fragment = new Fragment("branchLinks", "branchPanelLinks", this);
fragment.add(new BookmarkablePageLink<Void>("log", LogPage.class, WicketUtils
.newObjectParameter(model.name, entry.getName())));
fragment.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils
.newObjectParameter(model.name, entry.getName())));
String rawUrl = RawServlet.asLink(getContextUrl(), model.name, Repository.shortenRefName(entry.getName()), null);
fragment.add(new ExternalLink("raw", rawUrl));
item.add(fragment);
}
WicketUtils.setAlternatingBackground(item, counter);
counter++;