Package com.google.gwt.dev.json

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


      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) {
        jsonChildren.add(child.toJson());
      }
      json.put("children", jsonChildren);

      return json;
    }
View Full Code Here


    Set<String> sourceFiles = new LinkedHashSet<String>();
    for (EmittedArtifact map : sourceMaps) {
      // TODO maybe improve performance by not re-reading the sourcemap files.
      // (We'd need another way for SourceMapRecorder to pass the list of files here.)
      JsonObject json = loadSourceMap(logger, map);
      JsonArray sources = json.get("sources").asArray();
      for (int i = 0; i < sources.getLength(); i++) {
        sourceFiles.add(sources.get(i).asString().getString());
      }
    }
    return sourceFiles;
  }
View Full Code Here

      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) {
        jsonChildren.add(child.toJson());
      }
      json.put("children", jsonChildren);

      return json;
    }
View Full Code Here

    ModuleState moduleState = modules.get(moduleName);
    SourceMap map = SourceMap.load(moduleState.findSourceMap());

    JsonObject config = new JsonObject();
    config.put("moduleName", moduleName);
    JsonArray directories = new JsonArray();
    for (String name : map.getSourceDirectories()) {
      JsonObject dir = new JsonObject();
      dir.put("name", name);
      dir.put("link", name + "/");
      directories.add(dir);
    }
    config.put("directories", directories);
    PageUtil.sendJsonAndHtml("config", config, "directorylist.html", response, logger);
  }
View Full Code Here

    SourceMap map = SourceMap.load(moduleState.findSourceMap());

    JsonObject config = new JsonObject();
    config.put("moduleName", moduleName);
    config.put("directory", rest);
    JsonArray files = new JsonArray();
    for (String name : map.getSourceFilesInDirectory(rest)) {
      JsonObject file = new JsonObject();
      file.put("name", name);
      file.put("link", name);
      files.add(file);
    }
    config.put("files", files);
    PageUtil.sendJsonAndHtml("config", config, "filelist.html", response, logger);
  }
View Full Code Here

        .sendJsonAndHtml("config", module.getTemplateVariables(), "modulepage.html", response,
            logger);
  }

  private JsonObject makeConfig() {
    JsonArray moduleNames = new JsonArray();
    for (String module : modules) {
      moduleNames.add(module);
    }
    JsonObject config = JsonObject.create();
    config.put("moduleNames", moduleNames);
    return config;
  }
View Full Code Here

  }

  private JsonArray listModuleFiles() {
    File[] files = new File(getWarDir(), getModuleName()).listFiles();
    if (files == null) {
      return new JsonArray();
    }
    Arrays.sort(files);

    JsonArray result = new JsonArray();
    for (File file : files) {
      if (file.isFile()) {
        JsonObject map = new JsonObject();
        map.put("name", file.getName());
        map.put("link", file.getName());
        result.add(map);
      }
    }
    return result;
  }
View Full Code Here

  /**
   * Adds the given prefix to each source filename in the source map.
   */
  void addPrefixToEachSourceFile(String serverPrefix) {
    JsonArray sources = (JsonArray) json.get("sources");
    JsonArray newSources = new JsonArray();
    for (int i = 0; i < sources.getLength(); i++) {
      String filename = sources.get(i).asString().getString();
      newSources.add(serverPrefix + filename);
    }
    json.put("sources", newSources);
  }
View Full Code Here

  /**
   * Returns a sorted list of all the directories containing at least one filename
   * in the source map.
   */
  List<String> getSourceDirectories() {
    JsonArray sources = (JsonArray) json.get("sources");
    Set<String> directories = new HashSet<String>();
    for (int i = 0; i < sources.getLength(); i++) {
      String filename = sources.get(i).asString().getString();
      directories.add(new File(filename).getParent());
    }

    List<String> result = new ArrayList<String>();
    result.addAll(directories);
View Full Code Here

  public List<String> getSourceFilesInDirectory(String parent) {
    if (!parent.endsWith("/")) {
      throw new IllegalArgumentException("unexpected: " + parent);
    }

    JsonArray sources = (JsonArray) json.get("sources");

    List<String> result = new ArrayList<String>();
    for (int i = 0; i < sources.getLength(); i++) {
      File candidate = new File(sources.get(i).asString().getString());
      if (parent.equals(candidate.getParent() + "/")) {
        result.add(candidate.getName());
      }
    }
View Full Code Here

TOP

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

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.