From 430c759be0a18b8f5573899dc89e23590302577a Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 18 Jul 2011 13:50:35 +0000 Subject: [PATCH] #7284 Disabling a VNativeButton should set v-disabled style svn changeset:19822/svn branch:6.7 --- .../terminal/gwt/client/ApplicationConnection.java | 4 +++- .../vaadin/terminal/gwt/client/ui/VNativeButton.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java index 056428881f..d320e463cb 100755 --- a/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java +++ b/src/com/vaadin/terminal/gwt/client/ApplicationConnection.java @@ -65,6 +65,8 @@ public class ApplicationConnection { private static final String MODIFIED_CLASSNAME = "v-modified"; + public static final String DISABLED_CLASSNAME = "v-disabled"; + private static final String REQUIRED_CLASSNAME_EXT = "-required"; private static final String ERROR_CLASSNAME_EXT = "-error"; @@ -1768,7 +1770,7 @@ public class ApplicationConnection { // first disabling and read-only status if (!enabled) { styleBuf.append(" "); - styleBuf.append("v-disabled"); + styleBuf.append(DISABLED_CLASSNAME); } if (uidl.getBooleanAttribute("readonly")) { styleBuf.append(" "); diff --git a/src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java b/src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java index 8ea2e1a688..6a785ae211 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java @@ -227,4 +227,16 @@ public class VNativeButton extends Button implements Paintable, ClickHandler, client.updateVariable(id, EventId.BLUR, "", true); } + @Override + public void setEnabled(boolean enabled) { + if (isEnabled() != enabled) { + super.setEnabled(enabled); + if (enabled) { + removeStyleName(ApplicationConnection.DISABLED_CLASSNAME); + } else { + addStyleName(ApplicationConnection.DISABLED_CLASSNAME); + } + } + } + } -- 2.39.5