Package com.google.gwt.dev.json

Examples of com.google.gwt.dev.json.JsonObject


            shuttingDown = true;
          } else if (event == flushSentinel) {
            writer.flush();
            flushLatch.countDown();
          } else {
            JsonObject json = event.toJson();
            json.write(writer);
            writer.write('\n');
          }
        }
        // All queued events have been written.
        if (outputFormat.equals(Format.HTML)) {
View Full Code Here


      }
    }

    @Override
    JsonObject toJson() {
      JsonObject json = JsonObject.create();
      json.put("type", 11);
      double startMs = convertToMilliseconds(startTimeNanos);
      json.put("time", startMs);
      json.put("duration", 0.0);
      JsonObject jsonData = JsonObject.create();
      for (int i = 0; i < data.size(); i += 2) {
        jsonData.put(data.get(i), data.get(i + 1));
      }
      json.put("data", jsonData);
      return json;
    }
View Full Code Here

    protected double convertToMilliseconds(long nanos) {
      return nanos / 1000000.0d;
    }

    JsonObject toJson() {
      JsonObject json = JsonObject.create();
      json.put("type", -2);
      json.put("typeName", type.getName());
      json.put("color", type.getColor());
      double startMs = convertToMilliseconds(startTimeNanos);
      json.put("time", startMs);
      double durationMs = convertToMilliseconds(durationNanos);
      json.put("duration", durationMs);

      JsonObject jsonData = JsonObject.create();
      for (int i = 0; i < data.size(); i += 2) {
        jsonData.put(data.get(i), data.get(i + 1));
      }
      json.put("data", jsonData);

      JsonArray jsonChildren = JsonArray.create();
      for (Event child : children) {
View Full Code Here

  }

  static SourceMap load(File file) {
    String sourceMapJson = Util.readFileAsString(file);

    JsonObject json;
    try {
      json = JsonObject.parse(new StringReader(sourceMapJson));
    } catch (JsonException e) {
      throw new RuntimeException("can't parse sourcemap as json", e);
    } catch (IOException e) {
View Full Code Here

  /**
   * Creates the response to a /recompile request.
   */
  JsonObject exportRecompileResponse(Result result) {
    JsonObject out = JsonObject.create();
    out.put("status", result.isOk() ? "ok" : "failed");
    // This doesn't seem to be used but was there in 2.6.1.
    // TODO: consider removing for 2.7?
    out.put("moduleNames", exportOutputModuleNames());
    return out;
  }
View Full Code Here

  /**
   * Creates the response to a /progress request.
   */
  JsonObject exportProgressResponse(JobEvent progress) {
    // TODO: upgrade for multiple compiles and finalize API for 2.7.
    JsonObject out = new JsonObject();
    out.put("jobId", progress.getJobId());
    out.put("status", progress.getStatus().jsonName);
    out.put("message", progress.getMessage());
    out.put("inputModule", progress.getInputModuleName());
    out.put("bindings", exportMap(progress.getBindings()));
    return out;
  }
View Full Code Here

  /**
   * Exports the template variables for frontpage.html.
   */
  JsonObject exportFrontPageVars() {
    JsonObject out = JsonObject.create();
    out.put("moduleNames", exportOutputModuleNames()); // TODO: rename
    return out;
  }
View Full Code Here

  /**
   * Exports the template variables for modulepage.html.
   */
  JsonObject exportModulePageVars(Outbox box) {
    JsonObject result = new JsonObject();
    result.put("moduleName", box.getOutputModuleName()); // TODO: rename
    result.put("files", exportOutputFiles(box));
    result.put("isCompiled", !box.containsStubCompile());
    return result;
  }
View Full Code Here

   * in the source map.
   * (These directories are relative to a classpath entry or -sourceDir argument.)
   * Used in directorylist.html.
   */
  JsonObject exportSourceMapDirectoryListVars(Outbox box, SourceMap map) {
    JsonObject out = new JsonObject();
    out.put("moduleName", box.getOutputModuleName()); // TODO: rename
    JsonArray directories = new JsonArray();
    for (String name : map.getSourceDirectories()) {
      JsonObject dir = new JsonObject();
      dir.put("name", name);
      dir.put("link", name + "/");
      directories.add(dir);
    }
    out.put("directories", directories);
    return out;
  }
View Full Code Here

   * Used in filelist.html.
   * @param directory A directory name ending with "/".
   */
  JsonObject exportSourceMapFileListVars(Outbox box, SourceMap map,
      String directory) {
    JsonObject out = new JsonObject();
    out.put("moduleName", box.getOutputModuleName()); // TODO: rename
    out.put("directory", directory);
    JsonArray files = new JsonArray();
    for (String name : map.getSourceFilesInDirectory(directory)) {
      JsonObject file = new JsonObject();
      file.put("name", name);
      file.put("link", name + "?html");
      files.add(file);
    }
    out.put("files", files);
    return out;
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.json.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.