From: hansonr Date: Tue, 29 Jan 2019 21:10:46 +0000 (-0600) Subject: JSON writing fix, JColorChooser (mnemonic change) fix X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~68^2~272 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b41e1c5deef715310a5b2c4c7dc9c4672dd46860;p=jalview.git JSON writing fix, JColorChooser (mnemonic change) fix --- diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index 390c771..427ad8f 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -218,8 +218,8 @@ public class JSONFile extends AlignFile implements ComplexAlignFile jsonAlignmentPojo.getSeqGroups().add(seqGrpPojo); } } - org.json.JSONObject generatedJSon = new org.json.JSONObject(jsonAlignmentPojo); - jsonOutput = generatedJSon.toString(); + + jsonOutput = JSONUtils.stringify(jsonAlignmentPojo); return jsonOutput.replaceAll("xstart", "xStart").replaceAll("xend", "xEnd"); } catch (Exception e) diff --git a/src/jalview/javascript/json/JSON.java b/src/jalview/javascript/json/JSON.java index 1c3ac98..57ab8c8 100644 --- a/src/jalview/javascript/json/JSON.java +++ b/src/jalview/javascript/json/JSON.java @@ -57,4 +57,9 @@ public class JSON { return /** @j2sNative swingjs.JSUtil.parseJSON$O(br) || */null; } + public static String stringify(Object obj) { + // not actually implemented. + return /** @j2sNative swingjs.JSUtil.stringifyJSON$O(obj) || */null; + } + } diff --git a/src/jalview/util/JSONUtils.java b/src/jalview/util/JSONUtils.java index f91275d..127a085 100644 --- a/src/jalview/util/JSONUtils.java +++ b/src/jalview/util/JSONUtils.java @@ -1,6 +1,7 @@ package jalview.util; import jalview.javascript.json.JSON; +import jalview.json.binding.biojson.v1.AlignmentPojo; import java.io.FileReader; import java.io.IOException; @@ -84,4 +85,8 @@ public class JSONUtils return (Platform.isJS() ? JSON.parse(json) : new JSONParser().parse(json)); } +public static String stringify(Object obj) { + return new org.json.JSONObject(obj).toString(); +} + } diff --git a/srcjar/org/json/JSONObject.java b/srcjar/org/json/JSONObject.java index d2ea0f9..3a3307e 100644 --- a/srcjar/org/json/JSONObject.java +++ b/srcjar/org/json/JSONObject.java @@ -1549,6 +1549,13 @@ public class JSONObject { key = key.toLowerCase(Locale.ROOT); } else if (!Character.isUpperCase(key.charAt(1))) { key = key.substring(0, 1).toLowerCase(Locale.ROOT) + key.substring(1); + /** + * remove j2s signature + * + * @j2sNative + * + * key = key.split("$")[0]; + */ } return key; } diff --git a/swingjs/SwingJS-site.zip b/swingjs/SwingJS-site.zip index 7079c67..e50b5bb 100644 Binary files a/swingjs/SwingJS-site.zip and b/swingjs/SwingJS-site.zip differ diff --git a/swingjs/timestamp b/swingjs/timestamp index 4f24039..a0bfab3 100644 --- a/swingjs/timestamp +++ b/swingjs/timestamp @@ -1 +1 @@ -20190129013326 +20190129150841 diff --git a/swingjs/ver/3.2.4/SwingJS-site.zip b/swingjs/ver/3.2.4/SwingJS-site.zip index 7079c67..e50b5bb 100644 Binary files a/swingjs/ver/3.2.4/SwingJS-site.zip and b/swingjs/ver/3.2.4/SwingJS-site.zip differ diff --git a/swingjs/ver/3.2.4/timestamp b/swingjs/ver/3.2.4/timestamp index 4f24039..a0bfab3 100644 --- a/swingjs/ver/3.2.4/timestamp +++ b/swingjs/ver/3.2.4/timestamp @@ -1 +1 @@ -20190129013326 +20190129150841