You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2009/11/13 17:08:49 UTC

svn commit: r835896 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/widgets/PagingOptions.java widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java

Author: norman
Date: Fri Nov 13 16:08:49 2009
New Revision: 835896

URL: http://svn.apache.org/viewvc?rev=835896&view=rev
Log:
Fix refetching of messages on delete and update row count on PagingOptions

Modified:
    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/PagingOptions.java
    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java

Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/PagingOptions.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/PagingOptions.java?rev=835896&r1=835895&r2=835896&view=diff
==============================================================================
--- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/PagingOptions.java (original)
+++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/widgets/PagingOptions.java Fri Nov 13 16:08:49 2009
@@ -35,6 +35,8 @@
 import com.google.gwt.gen2.table.event.client.PageLoadHandler;
 import com.google.gwt.gen2.table.event.client.PagingFailureEvent;
 import com.google.gwt.gen2.table.event.client.PagingFailureHandler;
+import com.google.gwt.gen2.table.event.client.RowCountChangeEvent;
+import com.google.gwt.gen2.table.event.client.RowCountChangeHandler;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Label;
@@ -159,6 +161,24 @@
             }
             
         });
+        
+        table.getTableModel().addRowCountChangeHandler(new RowCountChangeHandler() {
+
+            public void onRowCountChange(RowCountChangeEvent event) {
+                int startCount =  currentPage * table.getPageSize();
+                
+                if (currentPage == 0) {
+                    startCount = 0;
+                }
+                
+                int endCount  = startCount + table.getPageSize();
+                
+                int rows =event.getNewRowCount();
+                updateControl(startCount, endCount, rows);
+
+            }
+            
+        });
         initWidget(pagingPanel);
     }
     

Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java?rev=835896&r1=835895&r2=835896&view=diff
==============================================================================
--- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java (original)
+++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/ui/RefetchPagingScrollTable.java Fri Nov 13 16:08:49 2009
@@ -107,13 +107,13 @@
             }
             
             // Check if we need to refetch rows
-            if (getTableModel().getRowCount() > (getPageCount() * getPageSize())) {
+            if (getTableModel().getRowCount() >= getPageSize()) {
                 // request new rows to fill the table again
-                Request r = new Request(getAbsoluteLastRowIndex(),rowsIndex.size());
+                Request r = new Request(getAbsoluteLastRowIndex() +1,rowsIndex.size());
                 getTableModel().requestRows(r, new Callback<RowType>() {
 
                     public void onFailure(Throwable caught) {
-                    // Nothing todo
+                        // Nothing todo
                     }
 
                     public void onRowsReady(Request request,



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org