Reviewers: devint,

Description:
Fixing a bug in HasDataPresenter where it does not pass the complete
list of modified rows if a pending state is detecting while we are
resolving the current state.  We were leaving off rows that were
modified, as well as the keyboard selected rows.  By passing all of
these rows to the recursive call to resolvePendingState(), we ensure
that all modified rows are updated.

Review by: dev...@google.com

Please review this at http://gwt-code-reviews.appspot.com/1583805/

Affected files:
  M user/src/com/google/gwt/user/cellview/client/HasDataPresenter.java


Index: user/src/com/google/gwt/user/cellview/client/HasDataPresenter.java
===================================================================
--- user/src/com/google/gwt/user/cellview/client/HasDataPresenter.java (revision 10728) +++ user/src/com/google/gwt/user/cellview/client/HasDataPresenter.java (working copy)
@@ -1056,7 +1056,7 @@
    * Resolve the pending state and push updates to the view.
    *
* @param modifiedRows the modified rows that need to be updated, or null if
-   *          none. The modified rows may be mutated.
+   *        none. The modified rows may be mutated.
    * @return true if the state changed, false if not
    */
   private boolean resolvePendingState(JsArrayInteger modifiedRows) {
@@ -1247,24 +1247,6 @@
       throw e;
     }

-    /*
- * We called methods in user code that could modify the view, so early exit
-     * if there is a new pending state waiting to be resolved.
-     */
-    if (pendingState != null) {
-      isResolvingState = false;
- // Do not reset pendingStateLoop, or we will not detect the infinite loop.
-
-      /*
- * Try to resolve state again. If we are successful, then the modified - * rows will be redrawn. If we are not successful, then we still need to
-       * redraw the modified rows.
-       */
-      if (resolvePendingState(modifiedRows)) {
-        return true;
-      }
-    }
-
     // Add the replaced ranges as modified rows.
     boolean replacedEmptyRange = false;
     for (Range replacedRange : pending.replacedRanges) {
@@ -1283,6 +1265,31 @@
     if (modifiedRows.length() > 0 && keyboardRowChanged) {
       modifiedRows.push(oldState.getKeyboardSelectedRow());
       modifiedRows.push(pending.keyboardSelectedRow);
+    }
+
+    /*
+ * We called methods in user code that could modify the view, so early exit
+     * if there is a new pending state waiting to be resolved.
+     */
+    if (pendingState != null) {
+      isResolvingState = false;
+ // Do not reset pendingStateLoop, or we will not detect the infinite loop.
+
+      /*
+       * Add the keyboard selected rows to the modified rows so they can be
+       * re-rendered in the new state.
+       */
+      modifiedRows.push(oldState.getKeyboardSelectedRow());
+      modifiedRows.push(pending.keyboardSelectedRow);
+
+      /*
+ * Try to resolve state again. If we are successful, then the modified + * rows will be redrawn. If we are not successful, then we still need to
+       * redraw the modified rows.
+       */
+      if (resolvePendingState(modifiedRows)) {
+        return true;
+      }
     }

     // Calculate the modified ranges.


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to