[jboss-svn-commits] JBL Code SVN: r9919 - labs/jbossforums/branches/forums101P22/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:51:55 EST 2007
Author: unibrew
Date: 2007-03-02 20:51:54 -0500 (Fri, 02 Mar 2007)
New Revision: 9919
Modified:
labs/jbossforums/branches/forums101P22/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/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java 2007-03-03 01:44:13 UTC (rev 9918)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java 2007-03-03 01:51:54 UTC (rev 9919)
@@ -116,8 +116,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);
}
@@ -142,8 +141,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;
}
@@ -159,7 +157,7 @@
*/
public Collection getStickyThreads()
{
- if (this.pageNavigator.getCurrentPage()!=0) {
+ if (this.pageNavigator!=null && this.pageNavigator.getCurrentPage()!=0) {
return new ArrayList();
}
if (stickyThreads !=null) {
@@ -171,8 +169,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);
}
@@ -185,7 +182,7 @@
*/
public boolean isStickyThreadsPresent()
{
- if (this.pageNavigator.getCurrentPage()!=0) {
+ if (this.pageNavigator!=null && this.pageNavigator.getCurrentPage()!=0) {
return false;
}
if (stickyThreads !=null) {
@@ -200,8 +197,7 @@
stickyThreads = BaseController.getForumsModule().findTopicsDesc(forum,
Constants.POST_STICKY,
-1,
- Integer.parseInt(this.userPreferences.getPreference(
- Constants.TOPICS_FORUM_KEY)));
+ Integer.MAX_VALUE);
if (stickyThreads!=null && stickyThreads.size()>0) {
present = true;
}
@@ -316,9 +312,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 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