[jboss-svn-commits] JBL Code SVN: r9923 - labs/jbossforums/trunk/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:56:56 EST 2007


Author: unibrew
Date: 2007-03-02 20:56:56 -0500 (Fri, 02 Mar 2007)
New Revision: 9923

Modified:
   labs/jbossforums/trunk/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/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java
===================================================================
--- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java	2007-03-03 01:55:31 UTC (rev 9922)
+++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/view/ViewForum.java	2007-03-03 01:56:56 UTC (rev 9923)
@@ -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) {
@@ -194,8 +191,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;
              }
@@ -311,9 +307,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