@Override protected void populateItem(ListItem<IModel<Review>> item) { Review review = item.getModelObject().getObject(); Label label = new Label("status", review.getReviewType()); label.add(new AttributeAppender("class", getLabelClass(review))); item.add(label); item.add(new Label("message", review.getMessage())); WebMarkupContainer copy = new WebMarkupContainer("copy"); copy.setVisibilityAllowed(hasEditPermission && Review.KIND_SUGGESTION.equals(review.getReviewType())); item.add(copy); if (Review.KIND_SUGGESTION.equals(review.getReviewType())) { String comment = ""; if (!review.getComments().isEmpty()) { comment = ": " + review.getComments().get(0).getMessage(); } item.add(new Label("notes", nls("user.review.notes", review.getUser(), comment))); } else item.add(new Label("notes", "")); final IModel<Review> reviewModel = new EObjectModel<Review>(review); StatelessLink<Review> rejectButton = new RejectLink("reject", reviewModel, getPageParameters()); // rejectButton.setBody(nls("reject.action")); DateFormat formatter = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT, getSession().getLocale()); item.add(rejectButton); String created = review.getCreated() > 0 ? formatter.format(new Date(review.getCreated())) : ""; item.add(new Label("created", created)); rejectButton.setVisibilityAllowed(hasEditPermission); } };
comment.setUser(username); comment.setCreated(review.getCreated()); comment.setMessage(translation.getComment()); review.getComments().add(comment);
comment.setUser(username); comment.setCreated(review.getCreated()); comment.setMessage(newProp.getComment()); review.getComments().add(comment);