Reviewers: ,

Description:
I am submitting a patch to issue 7876 in the GWT issue tracker
(http://code.google.com/p/google-web-toolkit/issues/detail?id=7876) as
part of a university software engineering project. I found that each
datepicker cell has a boolean "enabled" value, and the method
setTransientEnabledOnDates(false, ...) properly sets this "enabled"
variable to false.

However, on line 76 of CellGridImpl.java, the cell is being selected
when the click event is handled regardless of whether or not the cell is
enabled.

I modified this by adding a check with Cell.this.isEnabled() and re-ran
my test project and it seems to have fixed the issue. I've attached the
patch file in the data section of this form.

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

Affected files:
  CellGridImpl.java


Index: CellGridImpl.java
===================================================================
--- CellGridImpl.java   (revision 11440)
+++ CellGridImpl.java   (working copy)
@@ -64,7 +64,8 @@
         public void onKeyDown(KeyDownEvent event) {
           if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER ||
              event.getNativeKeyCode() == ' ') {
-            if (isActive(Cell.this)) {
+            if (isActive(Cell.this) &&
+               Cell.this.isEnabled()) {
               setSelected(Cell.this);
             }
           }
@@ -74,7 +75,9 @@
       addDomHandler(new ClickHandler() {
           @Override
           public void onClick(ClickEvent event) {
-            setSelected(Cell.this);
+            if (Cell.this.isEnabled()) {
+              setSelected(Cell.this);
+            }
           }
         }, ClickEvent.getType());
     }


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


Reply via email to