Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /eyebrowse/src/java/org/tigris/eyebrowse/core/BrowseList.java

eyebrowse
Discussion topic

Back to topic list

CVS update: /eyebrowse/src/java/org/tigris/eyebrowse/core/BrowseList.java

Reply

Author dlr
Full name Daniel Rall
Date 2007-03-28 16:57:32 PDT
Message User: dlr
Date: 2007-03-28 16:57:32-0700
Log:
 A follow-up to CVS revision 1.55, fixing handling of a "Show all" bug
 injected in that rev which caused only "window size" worth of messages
 to be displayed.
 
 * org/tigris/eyebrowse​/core/BrowseList.jav​a
   Include maxMessagesPerPage in class JavaDoc.
   (BrowseInfo.maxMessa​gesPerPage): Change data type from int to
    Integer, and default to null.
   (BrowseInfo.BrowseInfo, BrowseInfo.accountFo​rTotalMatches): Update
    use of maxMessagesPerPage to handle its new data type.
 
 Patch by: me
 Reviewed by: Tim Dionne <tdionne at collab dot net>

File Changes:

Directory: /eyebrowse/src/java/​org/tigris/eyebrowse​/core/
====================​====================​=================

File [changed]: BrowseList.java
Url: http://eyebrowse.tig​ris.org/source/brows​e/eyebrowse/src/java​/org/tigris/eyebrows​e/core/BrowseList.ja​va?r1=1.55&r2=1.​56
Delta lines: +15 -12
---------------------
--- BrowseList.java 2007-03-28 14:43:11-0700 1.55
+++ BrowseList.java 2007-03-28 16:57:30-0700 1.56
@@ -73,6 +73,9 @@
  * selectedPage: Used for paging. If 'paged' is set a desired page can be
  * specified.
  * count: Total number of records matching the selection criteria.
+ * maxMessagesPerPage: Maximum number of messages shown per page. If
+ * the message count overflows this number, pagination is
+ * automatically enabled.
  * </pre></p>
  *
  * <p>Places the following values into the context:
@@ -190,7 +193,7 @@
         // Fields used in executing.
         int max;
         int startAt;
- int maxMessagesPerPage = Integer.MAX_VALUE;
+ Integer maxMessagesPerPage = null;
         
         protected BrowseInfo(EyebrowseDb con, EyebrowseDb.ListInfo listInfo,
                              Context context)
@@ -213,18 +216,12 @@
                 PropUtil.defaultInt((String) context.get(START_AT_KEY), -1);
             windowSize = MessageList.getInsta​nce().getWindowSize(​context);
             
- // maxMessagesPerPage is overridden by any value supplied
- // in the context.
- Integer mmpp = (Integer) context.get(MAX_MESS​AGES_PER_PAGE);
- if (mmpp != null)
- {
- maxMessagesPerPage = mmpp.intValue();
- }
+ maxMessagesPerPage = (Integer) context.get(MAX_MESS​AGES_PER_PAGE);
             
             // Don't allow windowSize to be greater then maxMessagesPerPage
- if (windowSize > maxMessagesPerPage)
+ if (maxMessagesPerPage != null && windowSize > maxMessagesPerPage)
             {
- windowSize = maxMessagesPerPage;
+ windowSize = maxMessagesPerPage.intValue();
             }
 
             if (paged)
@@ -247,7 +244,10 @@
             {
                 firstIndex = 1;
                 startAt = firstIndex - 1;
- max = windowSize = maxMessagesPerPage;
+ windowSize = (maxMessagesPerPage != null ?
+ maxMessagesPerPage.intValue() :
+ Integer.MAX_VALUE);
+ max = windowSize;
             }
         }
 
@@ -341,7 +341,10 @@
          */
         protected void accountForTotalMatches()
         {
- paged = (totalMatches > maxMessagesPerPage);
+ if (maxMessagesPerPage != null)
+ {
+ paged = (totalMatches > maxMessagesPerPage.intValue());
+ }
 
             if (firstIndex > totalMatches)
             {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /eyebrowse/src/java/org/tigris/eyebrowse/core/BrowseList.java dlr Daniel Rall 2007-03-28 16:57:32 PDT
Messages per page: