Revision: 8895
Author: [email protected]
Date: Wed Sep 29 08:06:29 2010
Log: Refactor selection in CellList to allow targeted overriding of
selection behavior. This is the absolute smallest change possible to allow
custom selection management without duplication of logic.
Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8895
Modified:
/trunk/user/src/com/google/gwt/user/cellview/client/CellList.java
=======================================
--- /trunk/user/src/com/google/gwt/user/cellview/client/CellList.java Wed
Sep 22 12:58:01 2010
+++ /trunk/user/src/com/google/gwt/user/cellview/client/CellList.java Wed
Sep 29 08:06:29 2010
@@ -256,6 +256,13 @@
protected boolean dependsOnSelection() {
return cell.dependsOnSelection();
}
+
+ protected void doSelection(Event event, T value, int indexOnPage) {
+ SelectionModel<? super T> selectionModel = getSelectionModel();
+ if (selectionModel != null) {
+ selectionModel.setSelected(value, true);
+ }
+ }
/**
* Fire an event to the cell.
@@ -349,9 +356,8 @@
return;
}
T value = getDisplayedItem(indexOnPage);
- SelectionModel<? super T> selectionModel = getSelectionModel();
- if (selectionModel != null && isMouseDown
&& !cell.handlesSelection()) {
- selectionModel.setSelected(value, true);
+ if (isMouseDown && !cell.handlesSelection()) {
+ doSelection(event, value, indexOnPage);
}
// Focus on the cell.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors