incubator-olio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From klich...@apache.org
Subject svn commit: r831489 - in /incubator/olio/webapp/java/trunk/ws/apps/webapp: src/java/org/apache/olio/webapp/controller/PersonAction.java src/java/org/apache/olio/webapp/util/WebappUtil.java web/friends.jsp
Date Fri, 30 Oct 2009 23:42:01 GMT
Author: klichong
Date: Fri Oct 30 23:42:00 2009
New Revision: 831489

URL: http://svn.apache.org/viewvc?rev=831489&view=rev
Log:
OLIO 107 - have to paginate the friends.jsp page as well, as well as the user profile page.
Made the WebappUtil.getPagedList generic rather than just for SocialEvent.

Modified:
    incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/controller/PersonAction.java
    incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/WebappUtil.java
    incubator/olio/webapp/java/trunk/ws/apps/webapp/web/friends.jsp

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/controller/PersonAction.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/controller/PersonAction.java?rev=831489&r1=831488&r2=831489&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/controller/PersonAction.java
(original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/controller/PersonAction.java
Fri Oct 30 23:42:00 2009
@@ -22,11 +22,13 @@
 import org.apache.olio.webapp.util.WebappUtil;
 import java.io.IOException;
 import java.util.logging.Level;
+import java.util.List;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import static org.apache.olio.webapp.controller.WebConstants.*;
+import org.apache.olio.webapp.util.WebappConstants;
 import org.apache.olio.webapp.model.Address;
 import org.apache.olio.webapp.model.SocialEvent;
 import org.apache.olio.webapp.model.Invitation;
@@ -116,6 +118,19 @@
                 String username = request.getParameter("user_name");
                 Person displayUser = mf.findPerson(username);
                 request.setAttribute("displayPerson", displayUser);
+                //addition here for pages
+                 int index = WebappUtil.getIntProperty(request.getParameter("index"));
+                 
+            List<Person> list = (List)displayUser.getFriends();
+                
+            if (list != null) {
+                List friendList = WebappUtil.getPagedList(list, index);                
+                request.setAttribute("numPages", WebappUtil.getNumPages(list));
+                request.setAttribute("pageUrl", request.getContextPath() + "/person?user_name="+username+"&page=friends.jsp&actionType=display_friends");
+                request.setAttribute("itemList", friendList);
+                request.setAttribute("index", index);
+            }
+          
                 returnURL = "/site.jsp?page=friends.jsp";
 
             } else if (actionType.equalsIgnoreCase("add_person")) {

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/WebappUtil.java
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/WebappUtil.java?rev=831489&r1=831488&r2=831489&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/WebappUtil.java
(original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/src/java/org/apache/olio/webapp/util/WebappUtil.java
Fri Oct 30 23:42:00 2009
@@ -391,8 +391,8 @@
         }
         return strb.toString();
     }
-    
-    public static List<SocialEvent> getPagedList (List<SocialEvent> list, int
index) {
+   
+         public static List getPagedList (List list, int index) {
         int size = list.size();
         int numPages = getNumPages(list);
         if (size <= WebappConstants.ITEMS_PER_PAGE) {
@@ -408,10 +408,9 @@
         if (endIndex > size)
             endIndex = size;
 
-        List<SocialEvent> slist = list.subList(startIndex, endIndex);
+        List slist = list.subList(startIndex, endIndex);
         return slist;
     }
-    
     public static int getNumPages (long size) {
         if (size % WebappConstants.ITEMS_PER_PAGE != 0)
             return (int) size/WebappConstants.ITEMS_PER_PAGE + 1;

Modified: incubator/olio/webapp/java/trunk/ws/apps/webapp/web/friends.jsp
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/java/trunk/ws/apps/webapp/web/friends.jsp?rev=831489&r1=831488&r2=831489&view=diff
==============================================================================
--- incubator/olio/webapp/java/trunk/ws/apps/webapp/web/friends.jsp (original)
+++ incubator/olio/webapp/java/trunk/ws/apps/webapp/web/friends.jsp Fri Oct 30 23:42:00 2009
@@ -53,7 +53,8 @@
               <h1 id="friendslist">Friends of ${requestScope['displayPerson'].userName}</h1>
               <ol id="friends_list" >
 
-                <c:forEach var="myFriend" items="${requestScope['displayPerson'].friends}">
  
+                <c:forEach var="myFriend" items="${requestScope['itemList']}" varStatus="rowCounter">
+
                
                     <li style="padding: 7px;" class="my_friend" id="friend_${myFriend.userName}">
 
@@ -75,9 +76,15 @@
                </c:forEach>
             </ol>
 
-                <div class="clr"></div>
-                <br />          
-            </div>
+<div class="clr"></div>
+<br />
+<div>
+    <jsp:include flush="true" page="paginate.jsp">
+        <jsp:param name="*" value="*"/>
+    </jsp:include>
+</div>
+<div class="clr"></div><br/>
+</div>
   
 <!--
           <div class="rounded_corner bottom_right"><span></span></div>



Mime
View raw message