javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/ConvertTypes.java
branchfx
changeset 1016 6dc2c6c752df
parent 1014 7a7686e6f875
     1.1 --- a/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/ConvertTypes.java	Thu Apr 18 17:28:34 2013 +0200
     1.2 +++ b/javaquery/api/src/main/java/org/apidesign/bck2brwsr/htmlpage/ConvertTypes.java	Thu Apr 18 23:09:30 2013 +0200
     1.3 @@ -42,7 +42,6 @@
     1.4   * @author Jaroslav Tulach <jtulach@netbeans.org>
     1.5   */
     1.6  public final class ConvertTypes {
     1.7 -    private static final Logger LOG = Logger.getLogger(ConvertTypes.class.getName());
     1.8      ConvertTypes() {
     1.9      }
    1.10      
    1.11 @@ -123,14 +122,16 @@
    1.12          return "json" + Integer.toHexString(whenDone.hashCode());
    1.13      }
    1.14  
    1.15 +    @JavaScriptBody(args = { "url", "jsonResult", "whenDone", "jsonp" }, body = "throw 'ignore';")
    1.16      public static void loadJSON(
    1.17          String url, Object[] jsonResult, Runnable whenDone, String jsonp
    1.18      ) {
    1.19 -        REQ.execute(new LoadJSON(url, jsonResult, whenDone, jsonp));
    1.20 +        LoadJSON.REQ.execute(new LoadJSON(url, jsonResult, whenDone, jsonp));
    1.21      }
    1.22      
    1.23 -    private static final Executor REQ = Executors.newCachedThreadPool();
    1.24      private static final class LoadJSON implements Runnable {
    1.25 +        static final Executor REQ = Executors.newCachedThreadPool();
    1.26 +        private static final Logger LOG = Logger.getLogger(ConvertTypes.class.getName());
    1.27          
    1.28          private final String url;
    1.29          private final Object[] jsonResult;
    1.30 @@ -230,7 +231,8 @@
    1.31      private static void loadJSONP(String url, String jsonp) {
    1.32          
    1.33      }
    1.34 -    
    1.35 +
    1.36 +    @JavaScriptBody(args = { "jsonObject", "props", "values" }, body = "throw 'ignore extractJSON';")
    1.37      public static void extractJSON(Object jsonObject, String[] props, Object[] values) {
    1.38          if (jsonObject instanceof JSONObject) {
    1.39              JSONObject obj = (JSONObject)jsonObject;
    1.40 @@ -238,7 +240,7 @@
    1.41                  try {
    1.42                      values[i] = obj.has(props[i]) ? obj.get(props[i]) : null;
    1.43                  } catch (JSONException ex) {
    1.44 -                    LOG.log(Level.SEVERE, "Can't read " + props[i] + " from " + jsonObject, ex);
    1.45 +                    LoadJSON.LOG.log(Level.SEVERE, "Can't read " + props[i] + " from " + jsonObject, ex);
    1.46                  }
    1.47              }
    1.48