protected void fillReviewsColumn(IModel<PropertyPair> propertyPair, MarkupContainer container) { RepeatingView view = new RepeatingView("reviews"); container.add(view); if (propertyPair == null || propertyPair.getObject() == null) return; Collection<Review> reviews = reviewModel.getObject().get(propertyPair.getObject().getKey()); DateFormat formatter = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT, getSession().getLocale()); for (Review review : reviews) { if (review.getState() == ReviewState.INVALID || review.getState() == ReviewState.RESOLVED) continue; Label label = new Label(view.newChildId(), review.getReviewType()); label.add(new AttributeAppender("class", getLabelClass(review))); if(editKind==EditKind.EDIT && Review.KIND_SUGGESTION.equals(review.getReviewType())) { //allow the label to be clicked to apply the suggestion label.add(new AttributeAppender("data-suggestion", review.getMessage())); } StringBuilder title = new StringBuilder(); if (review.getMessage() != null) title.append(review.getMessage()); if (review.getCreated() > 0) { if (title.length() > 0) // add a linebreak title.append("\n"); title.append(formatter.format(new Date(review.getCreated()))); } if (title.length() > 0) label.add(new AttributeModifier("title", title.toString())); view.add(label); } }
if (review.getMessage() != null) title.append(review.getMessage()); if(review.getCreated()>0) title.append(formatter.format(new Date(review.getCreated())));
@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 comment = PropertiesFactory.eINSTANCE.createComment(); comment.setUser(username); comment.setCreated(review.getCreated()); comment.setMessage(translation.getComment()); review.getComments().add(comment);
Comment comment = PropertiesFactory.eINSTANCE.createComment(); comment.setUser(username); comment.setCreated(review.getCreated()); comment.setMessage(newProp.getComment()); review.getComments().add(comment);