- dataProvider.set("posts", allPosts);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void postProcess(Request request, DataProvider dataProvider) {
- @SuppressWarnings("unchecked")
- List<Post> posts = (List<Post>) dataProvider.get("posts");
- for (Post post : posts) {
- webInterface.getCore().markPostKnown(post);
- for (Reply reply : webInterface.getCore().getReplies(post)) {
- webInterface.getCore().markReplyKnown(reply);
- }
- }
+ Pagination<Post> pagination = new Pagination<Post>(allPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(Numbers.safeParseInteger(request.getHttpRequest().getParam("page"), 0));
+ templateContext.set("pagination", pagination);
+ templateContext.set("posts", pagination.getItems());