aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-12-22 17:07:19 +0200
committerArtur Signell <artur@vaadin.com>2014-12-22 17:10:16 +0200
commitde22dbb220798b23f369e9685a49ac23c3af14b5 (patch)
tree208aca22f4d2c1cb28fd3dd26c61186e0b21e177 /client
parentb6910633fedce478a53db0fe6673acdaaebb4337 (diff)
downloadvaadin-framework-de22dbb220798b23f369e9685a49ac23c3af14b5.tar.gz
vaadin-framework-de22dbb220798b23f369e9685a49ac23c3af14b5.zip
Make SDM work again (#15452)
Only import the Json part of elemental and avoid using JsonUtil, which causes https://code.google.com/p/google-web-toolkit/issues/detail?id=9083 Change-Id: I7b93b18ad47b81b2e5bb3947b04bf4550ddd035c
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/Vaadin.gwt.xml2
-rw-r--r--client/src/com/vaadin/client/Util.java32
2 files changed, 29 insertions, 5 deletions
diff --git a/client/src/com/vaadin/Vaadin.gwt.xml b/client/src/com/vaadin/Vaadin.gwt.xml
index 40fbeb5a7a..7387d0f997 100644
--- a/client/src/com/vaadin/Vaadin.gwt.xml
+++ b/client/src/com/vaadin/Vaadin.gwt.xml
@@ -10,7 +10,7 @@
<inherits name="com.google.gwt.http.HTTP" />
- <inherits name="elemental.Elemental"/>
+ <inherits name="elemental.Json"/>
<inherits name="com.google.gwt.logging.Logging" />
<set-property name="gwt.logging.enabled" value="TRUE" />
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index ed9cfce062..8b23bf433b 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -60,9 +60,7 @@ import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.util.SharedUtil;
import elemental.js.json.JsJsonValue;
-import elemental.js.util.Json;
import elemental.json.JsonValue;
-import elemental.json.impl.JsonUtil;
public class Util {
@@ -1552,7 +1550,7 @@ public class Util {
if (GWT.isProdMode()) {
return (T) jso.<JsJsonValue> cast();
} else {
- return JsonUtil.parse(Json.stringify(jso));
+ return elemental.json.Json.instance().parse(stringify(jso));
}
}
@@ -1569,11 +1567,37 @@ public class Util {
if (GWT.isProdMode()) {
return ((JavaScriptObject) jsonValue.toNative()).cast();
} else {
- return Json.parse(jsonValue.toJson());
+ return parse(jsonValue.toJson());
}
}
/**
+ * Convert a {@link JavaScriptObject} into a string representation.
+ *
+ * @param json
+ * a JavaScript object to be converted to a string
+ * @return JSON in string representation
+ */
+ private native static String stringify(JavaScriptObject json)
+ /*-{
+ return JSON.stringify(json);
+ }-*/;
+
+ /**
+ * Parse a string containing JSON into a {@link JavaScriptObject}.
+ *
+ * @param <T>
+ * the overlay type to expect from the parse
+ * @param jsonAsString
+ * @return a JavaScript object constructed from the parse
+ */
+ public native static <T extends JavaScriptObject> T parse(
+ String jsonAsString)
+ /*-{
+ return JSON.parse(jsonAsString);
+ }-*/;
+
+ /**
* The allowed value inaccuracy when comparing two double-typed pixel
* values.
* <p>