diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2012-11-05 14:00:21 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-05 14:32:28 +0000 |
commit | 1746dff124c644f4348ccf3ecf55d250a8869d75 (patch) | |
tree | 8b1a34d61bc3e137019fefefafe706152c63f9ef /server/src/com | |
parent | 282fbd32a1deb70565be0ed4718c3ee29d26651d (diff) | |
download | vaadin-framework-1746dff124c644f4348ccf3ecf55d250a8869d75.tar.gz vaadin-framework-1746dff124c644f4348ccf3ecf55d250a8869d75.zip |
10030 Button.DisableOnClick not working properly
Change-Id: I0514bc4da186360a84d9cdb48140245108847115
Diffstat (limited to 'server/src/com')
-rw-r--r-- | server/src/com/vaadin/ui/Button.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/server/src/com/vaadin/ui/Button.java b/server/src/com/vaadin/ui/Button.java index d248efd570..b4b7bf64be 100644 --- a/server/src/com/vaadin/ui/Button.java +++ b/server/src/com/vaadin/ui/Button.java @@ -19,6 +19,8 @@ package com.vaadin.ui; import java.io.Serializable; import java.lang.reflect.Method; +import org.json.JSONException; + import com.vaadin.event.Action; import com.vaadin.event.FieldEvents; import com.vaadin.event.FieldEvents.BlurEvent; @@ -55,10 +57,17 @@ public class Button extends AbstractComponent implements } @Override - public void disableOnClick() { - // Could be optimized so the button is not repainted because of - // this (client side has already disabled the button) + public void disableOnClick() throws RuntimeException { setEnabled(false); + // Makes sure the enabled=false state is noticed at once - otherwise + // a following setEnabled(true) call might have no effect. see + // ticket #10030 + try { + getUI().getConnectorTracker().getDiffState(Button.this) + .put("enabled", false); + } catch (JSONException e) { + throw new RuntimeException(e); + } } }; |