Package com.google.gwt.json.client

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


    /**
     * Convert the Object to JSON
     */
    public JSONObject toJSON() {
      JSONObject json = new JSONObject();
      json.put("_uuid", new JSONString(_uuid));
      json.put("_updateSeq", new JSONNumber(_updateSeq));
     
      json.put("name", new JSONString(name));
      json.put("capacity", new JSONNumber(capacity));
      json.put("store", new JSONString(store));
     
      // json.put("_childs", new JSONArray()); // TODO: remove
      return json;
    }   
View Full Code Here


      for (int i = 0; i < array.size(); i++) {
        Truck truck = trucks.get(index + i);

        Truck checkTruck = null;
        JSONValue value = array.get(i);
        JSONObject item = null;
        if (value != null) {
          item = value.isObject();
        }
        if (item != null) {
          checkTruck = new Truck(item);
View Full Code Here

          if (title != null) {
            // apply the new title
            JSONValue value = data.get(row);
            if (value != null && value.isObject() != null) {
              JSONObject item = value.isObject();

              item.put("content", new JSONString(title));
              timeline.setData(data.getJavaScriptObject());

              String info = "Added event " + String.valueOf(row);
              RootPanel.get("lblInfo").add(new Label(info));
            }
View Full Code Here

        JsArray<Selection> sel = timeline.getSelections();
        if (sel.length() > 0) {
          int row = sel.get(0).getRow();
          JSONValue value = data.get(row);
          if (value != null && value.isObject() != null) {
            JSONObject item = value.isObject();
            String content = "";
            if (item.get("content") != null &&
                item.get("content").isString() != null) {
              content = item.get("content").isString().stringValue();
            }
           
            // request new title
            String title =
              Window.prompt("Change the title of this event",
                  content);
 
            if (title != null) {
              // apply the new title
              item.put("content", new JSONString(title));
              timeline.setData(data.getJavaScriptObject());

              String info = "Edited event " + String.valueOf(row);
              RootPanel.get("lblInfo").add(new Label(info));
            }
View Full Code Here

    // create data
    Date d = dtf.parse("2012-08-23");
    int n = 200; // number of datapoints
    for (int i = 0; i < n; i++) {
      JSONObject pointA = new JSONObject();
      pointA.put("date", new JSONNumber(d.getTime()));
      pointA.put("value", new JSONNumber(customFunctionA(i)));
      dataA.set(i, pointA);

      JSONObject pointB = new JSONObject();
      pointB.put("date", new JSONNumber(d.getTime()));
      pointB.put("value", new JSONNumber(customFunctionB(i)));
      dataB.set(i, pointB);

      d.setTime(d.getTime() + 1000 * 60); // steps of one minute
    }
   
    JSONObject dataSetA = new JSONObject();
    dataSetA.put("label", new JSONString("Function A"));
    dataSetA.put("data", dataA);
   
    JSONObject dataSetB = new JSONObject();
    dataSetB.put("label", new JSONString("Function B"));
    dataSetB.put("data", dataB);

    Graph.Options options = Graph.Options.create();
    options.setHeight("400px");
    options.setLineStyle(Graph.Options.LINESTYLE.DOT, 1);
    options.setLineColor("blue", 1);
View Full Code Here

    /**
     * Convert the Object to JSON
     */
    public JSONObject toJSON() {
      JSONObject json = new JSONObject();
      json.put("_uuid", new JSONString(_uuid));
      json.put("_updateSeq", new JSONNumber(_updateSeq));
     
      json.put("name", new JSONString(name));
      json.put("capacity", new JSONNumber(capacity));
      json.put("store", new JSONString(store));
     
      // json.put("_childs", new JSONArray()); // TODO: remove
      return json;
    }   
View Full Code Here

      assertTrue(extended.getBounds().getSouthWest().getLongitude() != 0);
    }

    void testMockPlacemark() {
      JSONValue v = JSONParser.parse(jsonString);
      JSONObject obj = v.isObject();
      assertNotNull("Couldn't JSON parse an object from : " + addressQuery
          + " : \n" + jsonString, obj);
      Placemark place = (Placemark) obj.getJavaScriptObject();
      comparePlacemark(place);
    }
View Full Code Here

    String id = DOM.getElementProperty(container, "id");
    if (id == null || id.length() == 0) {
      id = "gflot-legend-container";
      DOM.setElementProperty(container, "id", id);
    }
    put("container", JSONHelper.wrapObject(new JSONObject(JQueryHelper.getJQueryObj(id))));
    return this;
  }
View Full Code Here

public class JSONObjectWrapper extends JSONWrapper {

  private final JSONObject m_jsonObj;

  protected JSONObjectWrapper() {
    m_jsonObj = new JSONObject();
  }
View Full Code Here

  public Integer getDataIndex() {
    return getInteger(DATA_INDEX);
  }

  public Series getSeries() {
    JSONObject obj = getObject(SERIES);
    if (obj == null) {
      return null;
    }
    return new Series(obj);
  }
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.