Package com.google.gwt.json.client

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


            public void onClick(Widget sender) {
                if (!"".equals(textBoxNewMessage.getText())) {
                    JSONArray array = new JSONArray();
                    array.set(0, new JSONString(textBoxNewMessage.getText()));

                    JSONObject container = new JSONObject();
                    container.put("value", array);

                    streamingService.sendMessage(textBoxTopic.getText(), container);
                    textBoxNewMessage.setText("");
                    textBoxNewMessage.setFocus(true);
                }
View Full Code Here


            Window.alert(throwable.getMessage());
        }

        public void onSuccess(Object result) {

            JSONObject resultObject = (JSONObject) result;
            JSONArray resultArray = (JSONArray) resultObject.get("value");
            JSONString resultString = (JSONString) resultArray.get(0);

            StringBuffer newText = new StringBuffer(textAreaHistory.getText());
            newText.append(queueName);
            newText.append(':');
View Full Code Here

        JSONArray array = new JSONArray();
        array.set(0, new JSONNumber(itemId));
        array.set(1, new JSONNumber(newBidValue));
        array.set(2, new JSONNumber(numberOfBids));

        JSONObject container = new JSONObject();
        container.put("value", array);

        streamingService.sendMessage(TOPIC, container);
        myBid.setText("");
        myBid.setFocus(true);
    }
View Full Code Here

            Window.alert(throwable.getMessage());
        }

        public void onSuccess(Object result) {

            JSONObject resultObject = (JSONObject) result;
            JSONArray resultArray = (JSONArray) resultObject.get("value");
            JSONNumber itemId = (JSONNumber) resultArray.get(0);
            JSONNumber itemPrice = (JSONNumber) resultArray.get(1);
            JSONNumber numberOfBids = (JSONNumber) resultArray.get(2);

            Integer itemKey = new Integer((int) itemId.getValue());
View Full Code Here

    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());

                }
        throw new JSONException(
            "Invalid Json structure when retrieve the Sling nodes");
      } catch (JSONException e) {
View Full Code Here

   * Returns a table filled with data
   * @return data
   */
  private JSONArray createData() {
    JSONArray data = new JSONArray();
    JSONObject item;
   
    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-23")));
    item.put("content", new JSONString("<div>Conversation</div><img src='img/comments-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);
   
    item = new JSONObject();
    item.put("start", new JSONNumber(datetimeToLong("2010-08-23 23:00:00")));
    item.put("content", new JSONString("<div>Mail from boss</div><img src='img/mail-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(datetimeToLong("2010-08-24 16:00:00")));
    item.put("content", new JSONString("Report"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-26")));
    item.put("end", new JSONNumber(dateToLong("2010-09-02")));
    item.put("content", new JSONString("Traject A"));
    data.set(data.size(), item);
   
    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-28")));
    item.put("content", new JSONString("<div>Memo</div><img src='img/notes-edit-icon.png' style='width:48px; height:48px;'>"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-29")));
    item.put("content", new JSONString("<div>Phone call</div><img src='img/Hardware-Mobile-Phone-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-31")));
    item.put("end", new JSONNumber(dateToLong("2010-09-03")));
    item.put("content", new JSONString("Traject B"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(datetimeToLong("2010-09-04 12:00:00")));
    item.put("content", new JSONString("<div>Report</div><img src='img/attachment-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);

    return data;
  }
View Full Code Here

            throw new UnsupportedOperationException("value not object");
        }
    }

    public JSONWrapper() {
        this(new JSONObject());
    }
View Full Code Here

            FastStringSet changedProperties, String context) {
        for (String key : json.keySet()) {
            String fieldName = context + key;
            changedProperties.add(fieldName);

            JSONObject object = json.get(key).isObject();
            if (object != null) {
                addJsonFields(object, changedProperties, fieldName + ".");
            }
        }
    }
View Full Code Here

    public URLReference deserialize(Type type, JSONValue jsonValue,
            ApplicationConnection connection) {
        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

    }

    @Override
    public JSONValue serialize(URLReference value,
            ApplicationConnection connection) {
        JSONObject json = new JSONObject();
        // No type info required for encoding a String...
        json.put(URL_FIELD,
                JsonEncoder.encode(value.getURL(), null, connection));
        return json;
    }
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.