]> source.dussan.org Git - vaadin-framework.git/commitdiff
#7284 Disabling a VNativeButton should set v-disabled style
authorArtur Signell <artur.signell@itmill.com>
Mon, 18 Jul 2011 13:50:35 +0000 (13:50 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 18 Jul 2011 13:50:35 +0000 (13:50 +0000)
svn changeset:19822/svn branch:6.7

src/com/vaadin/terminal/gwt/client/ApplicationConnection.java
src/com/vaadin/terminal/gwt/client/ui/VNativeButton.java

index 056428881fd12af74c70475f02eb422970d0ba03..d320e463cb47b3b04f76db81a7b46791918537de 100755 (executable)
@@ -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(" ");
index 8ea2e1a68874d54f3c0f4d3f8b4e42203936471f..6a785ae211ce829040083a81f2cc9a6be0e032ec 100644 (file)
@@ -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);
+            }
+        }
+    }
+
 }