]> source.dussan.org Git - gwtquery.git/commitdiff
Fix setters with Binder objects
authorManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>
Tue, 7 Jan 2014 07:26:21 +0000 (08:26 +0100)
committerManuel Carrasco Moñino <manuel.carrasco.m@gmail.com>
Tue, 7 Jan 2014 07:26:21 +0000 (08:26 +0100)
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java

index c4b5af88a7e9a8ea82dd0a00a58957cd0f3f6a5e..40dbdae75e1ecb7a481c8fb1fac4cfec62ee162c 100644 (file)
@@ -17,6 +17,7 @@ package com.google.gwt.query.client.builders;
 
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.JsArray;
+import com.google.gwt.query.client.Binder;
 import com.google.gwt.query.client.Properties;
 import com.google.gwt.query.client.js.JsObjectArray;
 import com.google.gwt.query.client.js.JsUtils;
@@ -123,7 +124,11 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
   
   @SuppressWarnings("unchecked")
   public <T> T set(Object key, Object val) {
-    p.set(key, val);
+    if (val instanceof Binder) {
+      p.set(key, ((Binder)val).getBound());
+    } else {
+      p.set(key, val);
+    }
     return (T)this;
   }
   
index 38f32b0ef19a6eac267baac9a235064dfd83b070..5de9dc31f736a21fd8cd517581175d83bfd78425 100644 (file)
@@ -256,7 +256,7 @@ public class JsonBuilderGenerator extends Generator {
       } else if (type.isEnum() != null){
         sw.println("p.set(\"" + name + "\", a.name());");
       }else {
-        sw.println("p.set(\"" + name + "\", a);");
+        sw.println("set(\"" + name + "\", a);");
       }
       if (!"void".equals(retType)) {
         if (isTypeAssignableTo(method.getReturnType(),