Package com.google.gwt.json.client

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


      return label_;
   }
  
   protected void onValueChanged(JSONValue value)
   {
      JSONObject values = new JSONObject();
      values.put(variable_, value);
      changedHandler_.onManipulatorChanged(values);
   }
View Full Code Here


   }
  
   public final ArrayList<String> getOptions()
   {
      ArrayList<String> options = new ArrayList<String>(
                                                new JSONObject(this).keySet());
      Collections.sort(options);
      return options;
   }
View Full Code Here

                        // if I get this exception it means I shouldn't strip out the html
                        // this issue still needs more research
                        Log.debug("Failed to strip out HTML.  This should be preferred?");
                    }

                    JSONObject response  = JSONParser.parseLenient(json).isObject();
                    JSONObject result = response.get("result").isObject();
                    String hash= result.get("BYTES_VALUE").isString().stringValue();
                    // step2: assign name and group
                    wizard.onUploadComplete(upload.getFilename(), hash);

                } catch (Exception e) {
                    Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e);
View Full Code Here

      JSONNumber n1 = v1.isNumber();
      JSONNumber n2 = v2.isNumber();
      return n1.doubleValue() == n2.doubleValue();
    }
    else if (v1.isObject() != null) {
      JSONObject o1 = v1.isObject();
      JSONObject o2 = v2.isObject();
      if (!o1.keySet().equals(o2.keySet())) {
        return false;
      }
      for (String key : o1.keySet()) {
        if (!equals(o1.get(key), o2.get(key))) {
          return false;
        }
      }
      return true;
    }
View Full Code Here

    }
  }

  public JSONValue toJson(EntityManager em, X targetEntity) {
    final ErraiEntityManager eem = (ErraiEntityManager) em;
    JSONObject jsonValue = new JSONObject();

    // TODO get all attributes, not just singular ones
    for (Attribute<? super X, ?> a : getAttributes()) {
      ErraiAttribute<? super X, ?> attr = (ErraiAttribute<? super X, ?>) a;
      switch (attr.getPersistentAttributeType()) {
      case ELEMENT_COLLECTION:
      case EMBEDDED:
      case BASIC:
        jsonValue.put(attr.getName(), makeInlineJson(targetEntity, attr, eem));
      break;

      case MANY_TO_MANY:
      case MANY_TO_ONE:
      case ONE_TO_MANY:
      case ONE_TO_ONE:
        JSONValue attributeValue;
        if (attr instanceof ErraiSingularAttribute) {
          attributeValue = makeJsonReference(targetEntity, (ErraiSingularAttribute<? super X, ?>) attr, eem);
        }
        else if (attr instanceof ErraiPluralAttribute) {
          attributeValue = makeJsonReference(targetEntity, (ErraiPluralAttribute<? super X, ?, ?>) attr, eem);
        }
        else {
          throw new PersistenceException("Unknown attribute type " + attr);
        }
        jsonValue.put(attr.getName(), attributeValue);
      }
    }

    return jsonValue;
  }
View Full Code Here

    ErraiEntityType<Y> attrEntityType = eem.getMetamodel().entity(attributeType);
    if (attrEntityType == null) {
      throw new IllegalArgumentException("Can't make a reference to non-entity-typed attribute " + attr);
    }

    JSONObject ref = new JSONObject();
    ref.put("entityReference", attrEntityType.makeInlineJson(attrValue, attrEntityType.getId(Object.class), eem));
    return ref;
  }
View Full Code Here

    JSONArray array = new JSONArray();
    int index = 0;
    for (E element : (Iterable<E>) attrValue) {
      Object idToReference = attrEntityType.getId(Object.class).get(element);
      JSONObject ref = new JSONObject();
      ref.put("entityReference", JsonUtil.basicValueToJson(idToReference));
      array.set(index++, ref);
    }
    return array;
  }
View Full Code Here

        Key<?, ?> k = Key.fromJson(em, key, false);
        if (k == null) return;
        System.out.println("getAll(): considering " + value);
        if (k.getEntityType() == type) {
          System.out.println(" --> correct type");
          JSONObject candidate = JSONParser.parseStrict(value).isObject();
          Assert.notNull(candidate);
          if (matcher.matches(candidate)) {
            @SuppressWarnings("unchecked")
            Key<X, ?> typedKey = (Key<X, ?>) k;
View Full Code Here

  protected static final String P1="p1";
  protected static final String P2="p2";
  public void build(JSONObject creation){
    Point p1;
    Point p2;
    JSONObject point;
    point=creation.get(P1).isObject();
    p1=new Point(point.get(X).isNumber().doubleValue(),
           point.get(Y).isNumber().doubleValue());
    point=creation.get(P2).isObject();
    p2=new Point(point.get(X).isNumber().doubleValue(),
           point.get(Y).isNumber().doubleValue());
    this.buildLine( p1, p2);
  }
View Full Code Here

    toNextStep();
  }
  private void parseSteps(JsonFile jsonConfigs,TaskHandler[] handlers){
    JSONArray stepConfigs=jsonConfigs.getJsonValue().isObject().get("tutorial_steps").isArray();
    this.steps=new Step[stepConfigs.size()];
    JSONObject jsonStep;
    for(int i=0;i<steps.length;i++){
      jsonStep=stepConfigs.get(i).isObject();
      this.steps[i]=new Step(jsonStep.get(Step.TITLE_KEY).isString().stringValue(),
          (int)jsonStep.get(Step.CORNER_X_KEY).isNumber().doubleValue(),
          (int)jsonStep.get(Step.CORNER_Y_KEY).isNumber().doubleValue(),
          parseTasks(jsonStep), handlers[i]);
    }
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.json.client.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.