[jboss-svn-commits] JBL Code SVN: r9918 - labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 2 20:44:13 EST 2007
Author: unibrew
Date: 2007-03-02 20:44:13 -0500 (Fri, 02 Mar 2007)
New Revision: 9918
Modified:
labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
Log:
[JBFORUMS-187] ForumsView pagination problem with many sticky and annoucement posts solved.
Modified: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java 2007-03-03 01:41:46 UTC (rev 9917)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java 2007-03-03 01:44:13 UTC (rev 9918)
@@ -110,8 +110,7 @@
announcements = BaseController.getForumsModule().findTopicsDesc(forum,
Constants.POST_ANNOUNCE,
-1,
- Integer.parseInt(this.userPreferences.getPreference(
- Constants.TOPICS_FORUM_KEY)));
+ Integer.MAX_VALUE);
} catch (Exception e) {
JSFUtil.handleException(e);
}
@@ -136,8 +135,7 @@
announcements= BaseController.getForumsModule().findTopicsDesc(forum,
Constants.POST_ANNOUNCE,
-1,
- Integer.parseInt(this.userPreferences.getPreference(
- Constants.TOPICS_FORUM_KEY)));
+ Integer.MAX_VALUE);
if (announcements!=null && announcements.size()>0) {
present = true;
}
@@ -153,7 +151,7 @@
*/
public Collection getStickyThreads()
{
- if (this.pageNavigator.getCurrentPage()!=0) {
+ if (this.pageNavigator!=null && this.pageNavigator.getCurrentPage()!=0) {
return new ArrayList();
}
if (stickyThreads !=null) {
@@ -165,8 +163,7 @@
stickyThreads = BaseController.getForumsModule().findTopicsDesc(forum,
Constants.POST_STICKY,
-1,
- Integer.parseInt(this.userPreferences.getPreference(
- Constants.TOPICS_FORUM_KEY)));
+ Integer.MAX_VALUE);
} catch (Exception e) {
JSFUtil.handleException(e);
}
@@ -179,7 +176,7 @@
*/
public boolean isStickyThreadsPresent()
{
- if (this.pageNavigator.getCurrentPage()!=0) {
+ if (this.pageNavigator!=null && this.pageNavigator.getCurrentPage()!=0) {
return false;
}
if (stickyThreads !=null) {
@@ -311,9 +308,16 @@
pageNumber = Integer.parseInt(page);
}
+ // clearing previous PageNavigator
+ this.pageNavigator=null;
+
+ int ads = 0;
+ ads+=getAnnouncements().size();
+ ads+=getStickyThreads().size();
+
//setup the pageNavigator for this forum
this.pageNavigator = new PageNavigator(
- forum.getTopicCount(), //total number of entries to be split up into pages
+ forum.getTopicCount()-ads, //total number of entries without annoucements and stickies to be split up into pages
Integer.parseInt(this.userPreferences.getPreference(Constants.TOPICS_FORUM_KEY)),
pageNumber //currently selected page being displayed, first page by default
) {
More information about the jboss-svn-commits
mailing list