private void updateCommentList() { for (CommentWidget widget : widgets.values()) { if (widget.isEditMode()) return; } commentListPanel.clear(); List<Comment> comments = parent.getComments(); Collections.sort(comments, Comment.REVERSE_DATEANDTIME_COMPARATOR); List<Comment> pageComments = filterCurrentPageComments(comments); for (Comment comment : pageComments) { CommentWidget widget = getWidget(comment); commentListPanel.add(widget); } if (comments.size() > COMMENTS_PER_PAGE) { commentListPanel.add(createPageNavigator(comments.size())); } }
@Override protected void onUpdate() { containerPanel.clear(); if (this.editor == null) { containerPanel.add(activateCommentLink); } else { containerPanel.add(this.editor); } List<Comment> comments = parent.getComments(); Collections.sort(comments, Comment.REVERSE_DATEANDTIME_COMPARATOR); for (Comment comment : comments) { CommentWidget widget = getWidget(comment); containerPanel.add(widget); } super.onUpdate(); }