Fixing a bug in DatePickerCell where selecting a new date does not update the cell.
http://gwt-code-reviews.appspot.com/996801/show

Review by: rchandia@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9060 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/cell/client/DatePickerCell.java b/user/src/com/google/gwt/cell/client/DatePickerCell.java
index 65ca6ef..236fb03 100644
--- a/user/src/com/google/gwt/cell/client/DatePickerCell.java
+++ b/user/src/com/google/gwt/cell/client/DatePickerCell.java
@@ -137,10 +137,16 @@
     // Hide the panel and call valueUpdater.update when a date is selected
     datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
       public void onValueChange(ValueChangeEvent<Date> event) {
+        // Remember the values before hiding the popup.
+        Element cellParent = lastParent;
+        Date oldValue = lastValue;
+        Object key = lastKey;
         panel.hide();
+
+        // Update the cell and value updater.
         Date date = event.getValue();
-        setViewData(lastKey, date);
-        setValue(lastParent, lastValue, lastKey);
+        setViewData(key, date);
+        setValue(cellParent, oldValue, key);
         if (valueUpdater != null) {
           valueUpdater.update(date);
         }