statusChanges.add(change);
}
}
final Change currentRevision = revisions.isEmpty() ? null : revisions.get(revisions.size() - 1);
final Patchset currentPatchset = ticket.getCurrentPatchset();
/*
* TICKET HEADER
*/
String href = urlFor(TicketsPage.class, params).toString();
add(new ExternalLink("ticketNumber", href, "#" + ticket.number));
Label headerStatus = new Label("headerStatus", ticket.status.toString());
WicketUtils.setCssClass(headerStatus, getLozengeClass(ticket.status, false));
add(headerStatus);
add(new Label("ticketTitle", ticket.title));
if (currentPatchset == null) {
add(new Label("diffstat").setVisible(false));
} else {
// calculate the current diffstat of the patchset
add(new DiffStatPanel("diffstat", ticket.insertions, ticket.deletions));
}
/*
* TAB TITLES
*/
add(new Label("commentCount", "" + comments.size()).setVisible(!comments.isEmpty()));
add(new Label("commitCount", "" + (currentPatchset == null ? 0 : currentPatchset.commits)).setVisible(currentPatchset != null));
/*
* TICKET AUTHOR and DATE (DISCUSSION TAB)
*/
UserModel createdBy = app().users().getUserModel(ticket.createdBy);
if (createdBy == null) {
add(new Label("whoCreated", ticket.createdBy));
} else {
add(new LinkPanel("whoCreated", null, createdBy.getDisplayName(),
UserPage.class, WicketUtils.newUsernameParameter(createdBy.username)));
}
if (ticket.isProposal()) {
// clearly indicate this is a change ticket
add(new Label("creationMessage", getString("gb.proposedThisChange")));
} else {
// standard ticket
add(new Label("creationMessage", getString("gb.createdThisTicket")));
}
String dateFormat = app().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");
String timestampFormat = app().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy");
final TimeZone timezone = getTimeZone();
final DateFormat df = new SimpleDateFormat(dateFormat);
df.setTimeZone(timezone);
final DateFormat tsf = new SimpleDateFormat(timestampFormat);
tsf.setTimeZone(timezone);
final Calendar cal = Calendar.getInstance(timezone);
String fuzzydate;
TimeUtils tu = getTimeUtils();
Date createdDate = ticket.created;
if (TimeUtils.isToday(createdDate, timezone)) {
fuzzydate = tu.today();
} else if (TimeUtils.isYesterday(createdDate, timezone)) {
fuzzydate = tu.yesterday();
} else {
// calculate a fuzzy time ago date
cal.setTime(createdDate);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
createdDate = cal.getTime();
fuzzydate = getTimeUtils().timeAgo(createdDate);
}
Label when = new Label("whenCreated", fuzzydate + ", " + df.format(createdDate));
WicketUtils.setHtmlTooltip(when, tsf.format(ticket.created));
add(when);
String exportHref = urlFor(ExportTicketPage.class, params).toString();
add(new ExternalLink("exportJson", exportHref, "json"));
/*
* RESPONSIBLE (DISCUSSION TAB)
*/
if (StringUtils.isEmpty(ticket.responsible)) {
add(new Label("responsible"));
} else {
UserModel responsible = app().users().getUserModel(ticket.responsible);
if (responsible == null) {
add(new Label("responsible", ticket.responsible));
} else {
add(new LinkPanel("responsible", null, responsible.getDisplayName(),
UserPage.class, WicketUtils.newUsernameParameter(responsible.username)));
}
}
/*
* MILESTONE PROGRESS (DISCUSSION TAB)
*/
if (StringUtils.isEmpty(ticket.milestone)) {
add(new Label("milestone"));
} else {
// link to milestone query
TicketMilestone milestone = app().tickets().getMilestone(repository, ticket.milestone);
PageParameters milestoneParameters = new PageParameters();
milestoneParameters.put("r", repositoryName);
milestoneParameters.put(Lucene.milestone.name(), ticket.milestone);
int progress = 0;
int open = 0;
int closed = 0;
if (milestone != null) {
progress = milestone.getProgress();
open = milestone.getOpenTickets();
closed = milestone.getClosedTickets();
}
Fragment milestoneProgress = new Fragment("milestone", "milestoneProgressFragment", this);
milestoneProgress.add(new LinkPanel("link", null, ticket.milestone, TicketsPage.class, milestoneParameters));
Label label = new Label("progress");
WicketUtils.setCssStyle(label, "width:" + progress + "%;");
milestoneProgress.add(label);
WicketUtils.setHtmlTooltip(milestoneProgress, MessageFormat.format(getString("gb.milestoneProgress"), open, closed));
add(milestoneProgress);
}
/*
* TICKET DESCRIPTION (DISCUSSION TAB)
*/
String desc;
if (StringUtils.isEmpty(ticket.body)) {
desc = getString("gb.noDescriptionGiven");
} else {
desc = MarkdownUtils.transformGFM(app().settings(), ticket.body, ticket.repository);
}
add(new Label("ticketDescription", desc).setEscapeModelStrings(false));
/*
* PARTICIPANTS (DISCUSSION TAB)
*/
if (app().settings().getBoolean(Keys.web.allowGravatar, true)) {
// gravatar allowed
List<String> participants = ticket.getParticipants();
add(new Label("participantsLabel", MessageFormat.format(getString(participants.size() > 1 ? "gb.nParticipants" : "gb.oneParticipant"),
"<b>" + participants.size() + "</b>")).setEscapeModelStrings(false));
ListDataProvider<String> participantsDp = new ListDataProvider<String>(participants);
DataView<String> participantsView = new DataView<String>("participants", participantsDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<String> item) {
String username = item.getModelObject();
UserModel user = app().users().getUserModel(username);
if (user == null) {
user = new UserModel(username);
}
item.add(new GravatarImage("participant", user.getDisplayName(),
user.emailAddress, null, 25, true));
}
};
add(participantsView);
} else {
// gravatar prohibited
add(new Label("participantsLabel").setVisible(false));
add(new Label("participants").setVisible(false));
}
/*
* LARGE STATUS INDICATOR WITH ICON (DISCUSSION TAB->SIDE BAR)
*/
Fragment ticketStatus = new Fragment("ticketStatus", "ticketStatusFragment", this);
Label ticketIcon = getStateIcon("ticketIcon", ticket);
ticketStatus.add(ticketIcon);
ticketStatus.add(new Label("ticketStatus", ticket.status.toString()));
WicketUtils.setCssClass(ticketStatus, getLozengeClass(ticket.status, false));
add(ticketStatus);
/*
* UPDATE FORM (DISCUSSION TAB)
*/
if (user.canEdit(ticket, repository) && app().tickets().isAcceptingTicketUpdates(repository)) {
if (user.canAdmin(ticket, repository) && ticket.isOpen()) {
/*
* OPEN TICKET
*/
Fragment controls = new Fragment("controls", "openControlsFragment", this);
/*
* STATUS
*/
List<Status> choices = new ArrayList<Status>();
if (ticket.isProposal()) {
choices.addAll(Arrays.asList(TicketModel.Status.proposalWorkflow));
} else if (ticket.isBug()) {
choices.addAll(Arrays.asList(TicketModel.Status.bugWorkflow));
} else {
choices.addAll(Arrays.asList(TicketModel.Status.requestWorkflow));
}
choices.remove(ticket.status);
ListDataProvider<Status> workflowDp = new ListDataProvider<Status>(choices);
DataView<Status> statusView = new DataView<Status>("newStatus", workflowDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<Status> item) {
SimpleAjaxLink<Status> link = new SimpleAjaxLink<Status>("link", item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Status status = getModel().getObject();
Change change = new Change(user.username);
change.setField(Field.status, status);
if (!ticket.isWatching(user.username)) {
change.watch(user.username);
}
TicketModel update = app().tickets().updateTicket(repository, ticket.number, change);
app().tickets().createNotifier().sendMailing(update);
setResponsePage(TicketsPage.class, getPageParameters());
}
};
String css = getStatusClass(item.getModel().getObject());
WicketUtils.setCssClass(link, css);
item.add(link);
}
};
controls.add(statusView);
/*
* RESPONSIBLE LIST
*/
Set<String> userlist = new TreeSet<String>(ticket.getParticipants());
for (RegistrantAccessPermission rp : app().repositories().getUserAccessPermissions(getRepositoryModel())) {
if (rp.permission.atLeast(AccessPermission.PUSH) && !rp.isTeam()) {
userlist.add(rp.registrant);
}
}
List<TicketResponsible> responsibles = new ArrayList<TicketResponsible>();
if (!StringUtils.isEmpty(ticket.responsible)) {
// exclude the current responsible
userlist.remove(ticket.responsible);
}
for (String username : userlist) {
UserModel u = app().users().getUserModel(username);
if (u != null) {
responsibles.add(new TicketResponsible(u));
}
}
Collections.sort(responsibles);
responsibles.add(new TicketResponsible(ESC_NIL, "", ""));
ListDataProvider<TicketResponsible> responsibleDp = new ListDataProvider<TicketResponsible>(responsibles);
DataView<TicketResponsible> responsibleView = new DataView<TicketResponsible>("newResponsible", responsibleDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<TicketResponsible> item) {
SimpleAjaxLink<TicketResponsible> link = new SimpleAjaxLink<TicketResponsible>("link", item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
TicketResponsible responsible = getModel().getObject();
Change change = new Change(user.username);
change.setField(Field.responsible, responsible.username);
if (!StringUtils.isEmpty(responsible.username)) {
if (!ticket.isWatching(responsible.username)) {
change.watch(responsible.username);
}
}
if (!ticket.isWatching(user.username)) {
change.watch(user.username);
}
TicketModel update = app().tickets().updateTicket(repository, ticket.number, change);
app().tickets().createNotifier().sendMailing(update);
setResponsePage(TicketsPage.class, getPageParameters());
}
};
item.add(link);
}
};
controls.add(responsibleView);
/*
* MILESTONE LIST
*/
List<TicketMilestone> milestones = app().tickets().getMilestones(repository, Status.Open);
if (!StringUtils.isEmpty(ticket.milestone)) {
for (TicketMilestone milestone : milestones) {
if (milestone.name.equals(ticket.milestone)) {
milestones.remove(milestone);
break;
}
}
}
milestones.add(new TicketMilestone(ESC_NIL));
ListDataProvider<TicketMilestone> milestoneDp = new ListDataProvider<TicketMilestone>(milestones);
DataView<TicketMilestone> milestoneView = new DataView<TicketMilestone>("newMilestone", milestoneDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<TicketMilestone> item) {
SimpleAjaxLink<TicketMilestone> link = new SimpleAjaxLink<TicketMilestone>("link", item.getModel()) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
TicketMilestone milestone = getModel().getObject();
Change change = new Change(user.username);
if (NIL.equals(milestone.name) || ESC_NIL.equals(milestone.name)) {
change.setField(Field.milestone, "");
} else {
change.setField(Field.milestone, milestone.name);
}
if (!ticket.isWatching(user.username)) {
change.watch(user.username);
}
TicketModel update = app().tickets().updateTicket(repository, ticket.number, change);
app().tickets().createNotifier().sendMailing(update);
setResponsePage(TicketsPage.class, getPageParameters());
}
};
item.add(link);
}
};
controls.add(milestoneView);
String editHref = urlFor(EditTicketPage.class, params).toString();
controls.add(new ExternalLink("editLink", editHref, getString("gb.edit")));
add(controls);
} else {
/*
* CLOSED TICKET
*/
Fragment controls = new Fragment("controls", "closedControlsFragment", this);
String editHref = urlFor(EditTicketPage.class, params).toString();
controls.add(new ExternalLink("editLink", editHref, getString("gb.edit")));
add(controls);
}
} else {
add(new Label("controls").setVisible(false));
}
/*
* TICKET METADATA
*/
add(new Label("ticketType", ticket.type.toString()));
if (StringUtils.isEmpty(ticket.topic)) {
add(new Label("ticketTopic").setVisible(false));
} else {
// process the topic using the bugtraq config to link things
String topic = bugtraqProcessor().processPlainCommitMessage(getRepository(), repositoryName, ticket.topic);
add(new Label("ticketTopic", topic).setEscapeModelStrings(false));
}
/*
* VOTERS
*/
List<String> voters = ticket.getVoters();
Label votersCount = new Label("votes", "" + voters.size());
if (voters.size() == 0) {
WicketUtils.setCssClass(votersCount, "badge");
} else {
WicketUtils.setCssClass(votersCount, "badge badge-info");
}
add(votersCount);
if (user.isAuthenticated && app().tickets().isAcceptingTicketUpdates(repository)) {
Model<String> model;
if (ticket.isVoter(user.username)) {
model = Model.of(getString("gb.removeVote"));
} else {
model = Model.of(MessageFormat.format(getString("gb.vote"), ticket.type.toString()));
}
SimpleAjaxLink<String> link = new SimpleAjaxLink<String>("voteLink", model) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Change change = new Change(user.username);
if (ticket.isVoter(user.username)) {
change.unvote(user.username);
} else {
change.vote(user.username);
}
app().tickets().updateTicket(repository, ticket.number, change);
setResponsePage(TicketsPage.class, getPageParameters());
}
};
add(link);
} else {
add(new Label("voteLink").setVisible(false));
}
/*
* WATCHERS
*/
List<String> watchers = ticket.getWatchers();
Label watchersCount = new Label("watchers", "" + watchers.size());
if (watchers.size() == 0) {
WicketUtils.setCssClass(watchersCount, "badge");
} else {
WicketUtils.setCssClass(watchersCount, "badge badge-info");
}
add(watchersCount);
if (user.isAuthenticated && app().tickets().isAcceptingTicketUpdates(repository)) {
Model<String> model;
if (ticket.isWatching(user.username)) {
model = Model.of(getString("gb.stopWatching"));
} else {
model = Model.of(MessageFormat.format(getString("gb.watch"), ticket.type.toString()));
}
SimpleAjaxLink<String> link = new SimpleAjaxLink<String>("watchLink", model) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
Change change = new Change(user.username);
if (ticket.isWatching(user.username)) {
change.unwatch(user.username);
} else {
change.watch(user.username);
}
app().tickets().updateTicket(repository, ticket.number, change);
setResponsePage(TicketsPage.class, getPageParameters());
}
};
add(link);
} else {
add(new Label("watchLink").setVisible(false));
}
/*
* TOPIC & LABELS (DISCUSSION TAB->SIDE BAR)
*/
ListDataProvider<String> labelsDp = new ListDataProvider<String>(ticket.getLabels());
DataView<String> labelsView = new DataView<String>("labels", labelsDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<String> item) {
final String value = item.getModelObject();
Label label = new Label("label", value);
TicketLabel tLabel = app().tickets().getLabel(repository, value);
String background = MessageFormat.format("background-color:{0};", tLabel.color);
label.add(new SimpleAttributeModifier("style", background));
item.add(label);
}
};
add(labelsView);
/*
* COMMENTS & STATUS CHANGES (DISCUSSION TAB)
*/
if (comments.size() == 0) {
add(new Label("discussion").setVisible(false));
} else {
Fragment discussionFragment = new Fragment("discussion", "discussionFragment", this);
ListDataProvider<Change> discussionDp = new ListDataProvider<Change>(discussion);
DataView<Change> discussionView = new DataView<Change>("discussion", discussionDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<Change> item) {
final Change entry = item.getModelObject();
if (entry.isMerge()) {
/*
* MERGE
*/
String resolvedBy = entry.getString(Field.mergeSha);
// identify the merged patch, it is likely the last
Patchset mergedPatch = null;
for (Change c : revisions) {
if (c.patchset.tip.equals(resolvedBy)) {
mergedPatch = c.patchset;
break;
}
}
String commitLink;
if (mergedPatch == null) {
// shouldn't happen, but just-in-case
int len = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);
commitLink = resolvedBy.substring(0, len);
} else {
// expected result
commitLink = mergedPatch.toString();
}
Fragment mergeFragment = new Fragment("entry", "mergeFragment", this);
mergeFragment.add(new LinkPanel("commitLink", null, commitLink,
CommitPage.class, WicketUtils.newObjectParameter(repositoryName, resolvedBy)));
mergeFragment.add(new Label("toBranch", MessageFormat.format(getString("gb.toBranch"),
"<b>" + ticket.mergeTo + "</b>")).setEscapeModelStrings(false));
addUserAttributions(mergeFragment, entry, 0);
addDateAttributions(mergeFragment, entry);
item.add(mergeFragment);
} else if (entry.isStatusChange()) {
/*
* STATUS CHANGE
*/
Fragment frag = new Fragment("entry", "statusFragment", this);
Label status = new Label("statusChange", entry.getStatus().toString());
String css = getLozengeClass(entry.getStatus(), false);
WicketUtils.setCssClass(status, css);
for (IBehavior b : status.getBehaviors()) {
if (b instanceof SimpleAttributeModifier) {
SimpleAttributeModifier sam = (SimpleAttributeModifier) b;
if ("class".equals(sam.getAttribute())) {
status.add(new SimpleAttributeModifier("class", "status-change " + sam.getValue()));
break;
}
}
}
frag.add(status);
addUserAttributions(frag, entry, avatarWidth);
addDateAttributions(frag, entry);
item.add(frag);
} else {
/*
* COMMENT
*/
String comment = MarkdownUtils.transformGFM(app().settings(), entry.comment.text, repositoryName);
Fragment frag = new Fragment("entry", "commentFragment", this);
Label commentIcon = new Label("commentIcon");
if (entry.comment.src == CommentSource.Email) {
WicketUtils.setCssClass(commentIcon, "iconic-mail");
} else {
WicketUtils.setCssClass(commentIcon, "iconic-comment-alt2-stroke");
}
frag.add(commentIcon);
frag.add(new Label("comment", comment).setEscapeModelStrings(false));
addUserAttributions(frag, entry, avatarWidth);
addDateAttributions(frag, entry);
item.add(frag);
}
}
};
discussionFragment.add(discussionView);
add(discussionFragment);
}
/*
* ADD COMMENT PANEL
*/
if (UserModel.ANONYMOUS.equals(user)
|| !repository.isBare
|| repository.isFrozen
|| repository.isMirror) {
// prohibit comments for anonymous users, local working copy repos,
// frozen repos, and mirrors
add(new Label("newComment").setVisible(false));
} else {
// permit user to comment
Fragment newComment = new Fragment("newComment", "newCommentFragment", this);
GravatarImage img = new GravatarImage("newCommentAvatar", user.username, user.emailAddress,
"gravatar-round", avatarWidth, true);
newComment.add(img);
CommentPanel commentPanel = new CommentPanel("commentPanel", user, ticket, null, TicketsPage.class);
commentPanel.setRepository(repositoryName);
newComment.add(commentPanel);
add(newComment);
}
/*
* PATCHSET TAB
*/
if (currentPatchset == null) {
// no patchset available
RepositoryUrl repoUrl = getRepositoryUrl(user, repository);
boolean canPropose = repoUrl != null && repoUrl.permission.atLeast(AccessPermission.CLONE) && !UserModel.ANONYMOUS.equals(user);
if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository) && canPropose) {
// ticket & repo will accept a proposal patchset
// show the instructions for proposing a patchset
Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);
changeIdFrag.add(new Label("proposeInstructions", MarkdownUtils.transformMarkdown(getString("gb.proposeInstructions"))).setEscapeModelStrings(false));
changeIdFrag.add(new Label("ptWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Barnum")));
changeIdFrag.add(new Label("ptWorkflowSteps", getProposeWorkflow("propose_pt.md", repoUrl.url, ticket.number)).setEscapeModelStrings(false));
changeIdFrag.add(new Label("gitWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Git")));
changeIdFrag.add(new Label("gitWorkflowSteps", getProposeWorkflow("propose_git.md", repoUrl.url, ticket.number)).setEscapeModelStrings(false));
add(changeIdFrag);
} else {
// explain why you can't propose a patchset
Fragment fragment = new Fragment("patchset", "canNotProposeFragment", this);
String reason = "";
if (ticket.isClosed()) {
reason = getString("gb.ticketIsClosed");
} else if (repository.isMirror) {
reason = getString("gb.repositoryIsMirror");
} else if (repository.isFrozen) {
reason = getString("gb.repositoryIsFrozen");
} else if (!repository.acceptNewPatchsets) {
reason = getString("gb.repositoryDoesNotAcceptPatchsets");
} else if (!canPropose) {
if (UserModel.ANONYMOUS.equals(user)) {
reason = getString("gb.anonymousCanNotPropose");
} else {
reason = getString("gb.youDoNotHaveClonePermission");
}
} else {
reason = getString("gb.serverDoesNotAcceptPatchsets");
}
fragment.add(new Label("reason", reason));
add(fragment);
}
} else {
// show current patchset
Fragment patchsetFrag = new Fragment("patchset", "patchsetFragment", this);
patchsetFrag.add(new Label("commitsInPatchset", MessageFormat.format(getString("gb.commitsInPatchsetN"), currentPatchset.number)));
patchsetFrag.add(createMergePanel(user, repository));
if (ticket.isOpen()) {
// current revision
MarkupContainer panel = createPatchsetPanel("panel", repository, user);
patchsetFrag.add(panel);
addUserAttributions(patchsetFrag, currentRevision, avatarWidth);
addUserAttributions(panel, currentRevision, 0);
addDateAttributions(panel, currentRevision);
} else {
// current revision
patchsetFrag.add(new Label("panel").setVisible(false));
}
// commits
List<RevCommit> commits = JGitUtils.getRevLog(getRepository(), currentPatchset.base, currentPatchset.tip);
ListDataProvider<RevCommit> commitsDp = new ListDataProvider<RevCommit>(commits);
DataView<RevCommit> commitsView = new DataView<RevCommit>("commit", commitsDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<RevCommit> item) {
RevCommit commit = item.getModelObject();
PersonIdent author = commit.getAuthorIdent();
item.add(new GravatarImage("authorAvatar", author.getName(), author.getEmailAddress(), null, 16, false));
item.add(new Label("author", commit.getAuthorIdent().getName()));
item.add(new LinkPanel("commitId", null, getShortObjectId(commit.getName()),
CommitPage.class, WicketUtils.newObjectParameter(repositoryName, commit.getName()), true));
item.add(new LinkPanel("diff", "link", getString("gb.diff"), CommitDiffPage.class,
WicketUtils.newObjectParameter(repositoryName, commit.getName()), true));
item.add(new Label("title", StringUtils.trimString(commit.getShortMessage(), Constants.LEN_SHORTLOG_REFS)));
item.add(WicketUtils.createDateLabel("commitDate", JGitUtils.getCommitDate(commit), GitBlitWebSession
.get().getTimezone(), getTimeUtils(), false));
item.add(new DiffStatPanel("commitDiffStat", 0, 0, true));
}
};
patchsetFrag.add(commitsView);
add(patchsetFrag);
}
/*
* ACTIVITY TAB
*/
Fragment revisionHistory = new Fragment("activity", "activityFragment", this);
List<Change> events = new ArrayList<Change>(ticket.changes);
Collections.sort(events);
Collections.reverse(events);
ListDataProvider<Change> eventsDp = new ListDataProvider<Change>(events);
DataView<Change> eventsView = new DataView<Change>("event", eventsDp) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(final Item<Change> item) {
Change event = item.getModelObject();
addUserAttributions(item, event, 16);
if (event.hasPatchset()) {
// patchset
Patchset patchset = event.patchset;
String what;
if (event.isStatusChange() && (Status.New == event.getStatus())) {
what = getString("gb.proposedThisChange");
} else if (patchset.rev == 1) {
what = MessageFormat.format(getString("gb.uploadedPatchsetN"), patchset.number);
} else {
if (patchset.added == 1) {
what = getString("gb.addedOneCommit");
} else {
what = MessageFormat.format(getString("gb.addedNCommits"), patchset.added);
}
}
item.add(new Label("what", what));
LinkPanel psr = new LinkPanel("patchsetRevision", null, patchset.number + "-" + patchset.rev,
ComparePage.class, WicketUtils.newRangeParameter(repositoryName, patchset.parent == null ? patchset.base : patchset.parent, patchset.tip), true);
WicketUtils.setHtmlTooltip(psr, patchset.toString());
item.add(psr);
String typeCss = getPatchsetTypeCss(patchset.type);
Label typeLabel = new Label("patchsetType", patchset.type.toString());
if (typeCss == null) {
typeLabel.setVisible(false);