From c4e2abb513ed173d7bd6fe240b65af2646dc2fd7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Tue, 7 Jan 2014 08:26:21 +0100 Subject: [PATCH] Fix setters with Binder objects --- .../google/gwt/query/client/builders/JsonBuilderBase.java | 7 ++++++- .../com/google/gwt/query/rebind/JsonBuilderGenerator.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java index c4b5af88..40dbdae7 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java @@ -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> implements J @SuppressWarnings("unchecked") public 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; } diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java index 38f32b0e..5de9dc31 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/rebind/JsonBuilderGenerator.java @@ -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(), -- 2.39.5