import java.util.List;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.utils.Pagination;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.sone.web.page.FreenetRequest;
-import net.pterodactylus.util.collection.Pagination;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
Collections.sort(sortedSones, Sone.NICE_NAME_COMPARATOR);
}
}
- Pagination<Sone> sonePagination = new Pagination<Sone>(sortedSones, 25).setPage(parseInt(request.getHttpRequest().getParam("page"), 0));
+ Pagination<Sone> sonePagination = new Pagination<Sone>(sortedSones, 25);
+ sonePagination.setPage(parseInt(request.getHttpRequest().getParam("page"), 0));
templateContext.set("pagination", sonePagination);
templateContext.set("knownSones", sonePagination.getItems());
}
import net.pterodactylus.sone.data.PostReply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.notify.PostVisibilityFilter;
+import net.pterodactylus.sone.utils.Pagination;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.sone.web.page.FreenetRequest;
-import net.pterodactylus.util.collection.Pagination;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
Collections.sort(sortedPosts, Post.NEWEST_FIRST);
/* paginate them. */
- Pagination<Post> pagination = new Pagination<>(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("page"), 0));
+ Pagination<Post> pagination = new Pagination<>(sortedPosts, webInterface.getCore().getPreferences().getPostsPerPage());
+ pagination.setPage(parseInt(request.getHttpRequest().getParam("page"), 0));
templateContext.set("pagination", pagination);
templateContext.set("posts", pagination.getItems());
}
import net.pterodactylus.sone.data.Profile.Field;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.utils.Pagination;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.sone.web.page.FreenetRequest;
-import net.pterodactylus.util.collection.Pagination;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.text.StringEscaper;
List<Post> resultPosts = FluentIterable.from(sortedPostHits).transform(new HitMapper<Post>()).toList();
/* pagination. */
- Pagination<Sone> sonePagination = new Pagination<Sone>(resultSones, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(fromNullable(tryParse(request.getHttpRequest().getParam("sonePage"))).or(0));
- Pagination<Post> postPagination = new Pagination<Post>(resultPosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(fromNullable(tryParse(request.getHttpRequest().getParam("postPage"))).or(0));
+ Pagination<Sone> sonePagination = new Pagination<Sone>(resultSones, webInterface.getCore().getPreferences().getPostsPerPage());
+ sonePagination.setPage(fromNullable(tryParse(request.getHttpRequest().getParam("sonePage"))).or(0));
+ Pagination<Post> postPagination = new Pagination<Post>(resultPosts, webInterface.getCore().getPreferences().getPostsPerPage());
+ postPagination.setPage(fromNullable(tryParse(request.getHttpRequest().getParam("postPage"))).or(0));
templateContext.set("sonePagination", sonePagination);
templateContext.set("soneHits", sonePagination.getItems());
import net.pterodactylus.sone.data.PostReply;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.template.SoneAccessor;
+import net.pterodactylus.sone.utils.Pagination;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.sone.web.page.FreenetRequest;
-import net.pterodactylus.util.collection.Pagination;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
List<Post> sonePosts = sone.get().getPosts();
sonePosts.addAll(webInterface.getCore().getDirectedPosts(sone.get().getId()));
Collections.sort(sonePosts, Post.NEWEST_FIRST);
- Pagination<Post> postPagination = new Pagination<Post>(sonePosts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("postPage"), 0));
+ Pagination<Post> postPagination = new Pagination<Post>(sonePosts, webInterface.getCore().getPreferences().getPostsPerPage());
+ postPagination.setPage(parseInt(request.getHttpRequest().getParam("postPage"), 0));
templateContext.set("postPagination", postPagination);
templateContext.set("posts", postPagination.getItems());
Set<PostReply> replies = sone.get().getReplies();
});
- Pagination<Post> repliedPostPagination = new Pagination<Post>(posts, webInterface.getCore().getPreferences().getPostsPerPage()).setPage(parseInt(request.getHttpRequest().getParam("repliedPostPage"), 0));
+ Pagination<Post> repliedPostPagination = new Pagination<Post>(posts, webInterface.getCore().getPreferences().getPostsPerPage());
+ repliedPostPagination.setPage(parseInt(request.getHttpRequest().getParam("repliedPostPage"), 0));
templateContext.set("repliedPostPagination", repliedPostPagination);
templateContext.set("repliedPosts", repliedPostPagination.getItems());
}
package net.pterodactylus.sone.web.pages
import net.pterodactylus.sone.data.Post
+import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.sone.web.pages.SoneTemplatePage
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
-import net.pterodactylus.util.collection.Pagination
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
import net.pterodactylus.sone.data.Album
import net.pterodactylus.sone.data.Sone
+import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.sone.utils.parameters
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
-import net.pterodactylus.util.collection.Pagination
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
import java.net.URI
.sortedBy(Album::getTitle)
.also { albums ->
templateContext["albums"] = albums
- templateContext["albumPagination"] = Pagination(albums, 12).setPage(request.parameters["page"]?.toIntOrNull() ?: 0)
+ templateContext["albumPagination"] = Pagination(albums, 12).apply { page = request.parameters["page"]?.toIntOrNull() ?: 0 }
}
} else {
templateContext["soneRequested"] = true
package net.pterodactylus.sone.web.pages
import net.pterodactylus.sone.notify.PostVisibilityFilter
+import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.sone.utils.parameters
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
-import net.pterodactylus.util.collection.Pagination
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
.filter { postVisibilityFilter.isVisible(currentSone).apply(it) }
.sortedByDescending { it.time }
.let { posts ->
- Pagination(posts, webInterface.core.preferences.postsPerPage)
- .setPage(request.parameters["page"]?.toIntOrNull() ?: 0).let { pagination ->
+ Pagination(posts, webInterface.core.preferences.postsPerPage).apply {
+ page = request.parameters["page"]?.toIntOrNull() ?: 0
+ }.let { pagination ->
templateContext["pagination"] = pagination
templateContext["posts"] = pagination.items
}
import net.pterodactylus.sone.data.Post
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
+import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.sone.web.pages.WebPageTest
import net.pterodactylus.sone.web.pages.BookmarksPage
-import net.pterodactylus.util.collection.Pagination
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains
import org.hamcrest.Matchers.equalTo
import net.pterodactylus.sone.notify.PostVisibilityFilter
import net.pterodactylus.sone.test.mock
import net.pterodactylus.sone.test.whenever
-import net.pterodactylus.util.collection.Pagination
+import net.pterodactylus.sone.utils.Pagination
import net.pterodactylus.util.web.Method.GET
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.contains