Examples of JsonValue


Examples of com.badlogic.gdx.utils.JsonValue

    if (file == null) throw new IllegalArgumentException("file cannot be null.");

    SkeletonData skeletonData = new SkeletonData();
    skeletonData.setName(file.nameWithoutExtension());

    JsonValue root = new JsonReader().parse(file);

    // Bones.
    for (JsonValue boneMap = root.getChild("bones"); boneMap != null; boneMap = boneMap.next()) {
      BoneData parent = null;
      String parentName = boneMap.getString("parent", null);
      if (parentName != null) {
        parent = skeletonData.findBone(parentName);
        if (parent == null) throw new SerializationException("Parent bone not found: " + parentName);
      }
      BoneData boneData = new BoneData(boneMap.getString("name"), parent);
      boneData.length = boneMap.getFloat("length", 0) * scale;
      boneData.x = boneMap.getFloat("x", 0) * scale;
      boneData.y = boneMap.getFloat("y", 0) * scale;
      boneData.rotation = boneMap.getFloat("rotation", 0);
      boneData.scaleX = boneMap.getFloat("scaleX", 1);
      boneData.scaleY = boneMap.getFloat("scaleY", 1);
      boneData.inheritScale = boneMap.getBoolean("inheritScale", true);
      boneData.inheritRotation = boneMap.getBoolean("inheritRotation", true);
      skeletonData.addBone(boneData);
    }

    // Slots.
    for (JsonValue slotMap = root.getChild("slots"); slotMap != null; slotMap = slotMap.next()) {
      String slotName = slotMap.getString("name");
      String boneName = slotMap.getString("bone");
      BoneData boneData = skeletonData.findBone(boneName);
      if (boneData == null) throw new SerializationException("Slot bone not found: " + boneName);
      SlotData slotData = new SlotData(slotName, boneData);

      String color = slotMap.getString("color", null);
      if (color != null) slotData.getColor().set(Color.valueOf(color));

      slotData.setAttachmentName(slotMap.getString("attachment", null));

      slotData.additiveBlending = slotMap.getBoolean("additive", false);

      skeletonData.addSlot(slotData);
    }

    // Skins.
    for (JsonValue skinMap = root.getChild("skins"); skinMap != null; skinMap = skinMap.next()) {
      Skin skin = new Skin(skinMap.name());
      for (JsonValue slotEntry = skinMap.child(); slotEntry != null; slotEntry = slotEntry.next()) {
        int slotIndex = skeletonData.findSlotIndex(slotEntry.name());
        for (JsonValue entry = slotEntry.child(); entry != null; entry = entry.next()) {
          Attachment attachment = readAttachment(skin, entry.name(), entry);
          if (attachment != null) skin.addAttachment(slotIndex, entry.name(), attachment);
        }
      }
      skeletonData.addSkin(skin);
      if (skin.name.equals("default")) skeletonData.setDefaultSkin(skin);
    }

    // Animations.
    for (JsonValue animationMap = root.getChild("animations"); animationMap != null; animationMap = animationMap.next())
      readAnimation(animationMap.name(), animationMap, skeletonData);

    skeletonData.bones.shrink();
    skeletonData.slots.shrink();
    skeletonData.skins.shrink();
View Full Code Here

Examples of com.dubture.getcomposer.core.entities.JsonValue

    if (filterItem.isChecked()) {
      downloadButton.setSelection(true);
    }

    GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.CENTER).span(1, 2).applyTo(downloadButton);
    JsonValue downloads = item.get("downloads");
    JsonValue favorites = item.get("favers");
    if (downloads != null && favorites != null) {
      Number number = downloads.getAsNumber();
      DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(new Locale("en_US"));
      DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
      symbols.setGroupingSeparator(' ');
      downloadButton.setText(formatter.format(number));
      downloadButton.setImage(ComposerUIPluginImages.DOWNLOAD.createImage());
      favorButton.setText("" + favorites.getAsNumber());
    }

    versionCombo = new Combo(this, SWT.READ_ONLY);
   
    GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).span(1, 2).hint(200, SWT.DEFAULT).applyTo(versionCombo);
View Full Code Here

Examples of com.eclipsesource.json.JsonValue

        TOTAL_REMOVE_LATENCIES_UPDATER.set(this, getLong(json, "totalRemoveLatencies", -1L));
        MAX_GET_LATENCY_UPDATER.set(this, getLong(json, "maxGetLatency", -1L));
        MAX_PUT_LATENCY_UPDATER.set(this, getLong(json, "maxPutLatency", -1L));
        MAX_REMOVE_LATENCY_UPDATER.set(this, getLong(json, "maxRemoveLatency", -1L));
        heapCost = getLong(json, "heapCost", -1L);
        final JsonValue jsonNearCacheStats = json.get("nearCacheStats");
        if (jsonNearCacheStats != null) {
            nearCacheStats = new NearCacheStatsImpl();
            nearCacheStats.fromJson(jsonNearCacheStats.asObject());
        }
    }
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

    private SessionInfo getSessionInfo(Response response) {

      try {
        // parse the response text into JSON
        JSONValue jsonValue = JSONParser.parse(response.getText());
        JSONObject jsonObject = jsonValue.isObject();

        if (jsonObject != null) {
          GWT.log("send request get value end", null);
          return new SessionInfo(jsonObject.get(USER_ID).toString(), jsonObject.get(WORKSPACE).toString());
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

    private void addTreeItems(Response response) {
      GWT.log(response.getText(), null);
      try {
        // parse the response text into JSON
        JSONValue jsonValue = JSONParser.parse(response.getText());
        JSONArray jsonArray = jsonValue.isArray();

        if (jsonArray != null) {
          for (int index = 0; index < jsonArray.size(); index++) {
            addTreeItem(((JSONObject) jsonArray.get(index)), index);
          }
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

    private void addProperties(Response response) {
      GWT.log(response.getText(), null);
      try {
        // parse the response text into JSON
        JSONValue jsonValue = JSONParser.parse(response.getText());
        JSONArray jsonArray = jsonValue.isArray();

        if (jsonArray != null) {
          for (int index = 0; index < jsonArray.size(); index++) {
            addProperty(((JSONObject) jsonArray.get(index)), index);
          }
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

        super.handleUIDLMessage(start, jsonText, json);
    }

    @Override
    protected void doUidlRequest(String uri, JSONObject payload) {
        JSONValue jsonValue = payload.get(ApplicationConstants.CSRF_TOKEN);
        lastCsrfTokenSent = jsonValue != null ? jsonValue.toString() : null;

        super.doUidlRequest(uri, payload);
    }
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

        TranslatedURLReference reference = GWT
                .create(TranslatedURLReference.class);
        reference.setConnection(connection);
        JSONObject json = (JSONObject) jsonValue;
        if (json.containsKey(URL_FIELD)) {
            JSONValue jsonURL = json.get(URL_FIELD);
            String URL = (String) JsonDecoder.decodeValue(
                    new Type(String.class.getName(), null), jsonURL, null,
                    connection);
            reference.setURL(URL);
        }
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

                JSONObject jsonObject = jsonValue.isObject();

                int size = properties.size();
                for (int i = 0; i < size; i++) {
                    Property property = properties.get(i);
                    JSONValue encodedPropertyValue = jsonObject.get(property
                            .getName());
                    if (encodedPropertyValue == null) {
                        continue;
                    }
View Full Code Here

Examples of com.google.gwt.json.client.JSONValue

    private static void decodeIntoCollection(Type childType,
            JSONArray jsonArray, ApplicationConnection connection,
            Collection<Object> tokens) {
        for (int i = 0; i < jsonArray.size(); ++i) {
            // each entry always has two elements: type and value
            JSONValue entryValue = jsonArray.get(i);
            tokens.add(decodeValue(childType, entryValue, null, connection));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.