Revision: 9080
Author: gwt.mirror...@gmail.com
Date: Fri Oct 15 09:53:49 2010
Log: Fixing a bug in CellBrowser where losing an open node causes an
exception the next time the CellBrowser is clicked. The code that nullifies
the focusedKey in a node should be in the loop the trimes the tree down to
size.
Review at http://gwt-code-reviews.appspot.com/1012801
Review by: p...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=9080
Modified:
/trunk/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
/trunk/user/test/com/google/gwt/user/cellview/client/AbstractCellTreeTestBase.java
=======================================
--- /trunk/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
Wed Oct 13 12:59:56 2010
+++ /trunk/user/src/com/google/gwt/user/cellview/client/CellBrowser.java
Fri Oct 15 09:53:49 2010
@@ -968,7 +968,7 @@
/**
* Set the open state of a tree node.
- *
+ *
* @param cellList the CellList that changed state.
* @param value the value to open
* @param open true to open, false to close
@@ -1029,12 +1029,9 @@
}
// Close the node.
- TreeNode closedNode = cellList.isFocusedOpen
+ TreeNode closedNode = (cellList.isFocusedOpen && (treeNodes.size() >
cellList.level + 1))
? treeNodes.get(cellList.level + 1) : null;
trimToLevel(cellList.level);
- cellList.focusedKey = null;
- cellList.focusedValue = null;
- cellList.isFocusedOpen = false;
// Refresh the display to update the styles for this node.
if (redraw) {
@@ -1065,5 +1062,13 @@
removed.destroy();
curLevel--;
}
+
+ // Nullify the focused key at the level.
+ if (level < treeNodes.size()) {
+ TreeNodeImpl<?> node = treeNodes.get(level);
+ node.display.focusedKey = null;
+ node.display.focusedValue = null;
+ node.display.isFocusedOpen = false;
+ }
}
}
=======================================
---
/trunk/user/test/com/google/gwt/user/cellview/client/AbstractCellTreeTestBase.java
Tue Aug 24 17:28:21 2010
+++
/trunk/user/test/com/google/gwt/user/cellview/client/AbstractCellTreeTestBase.java
Fri Oct 15 09:53:49 2010
@@ -387,6 +387,9 @@
// Verify the node is destroyed.
assertTrue(b.isDestroyed());
+
+ // True to open a new node.
+ assertNotNull(root.setChildOpen(0, true));
}
/**
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors