Package com.google.gwt.json.client

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


    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

    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

        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

        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

                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

    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

                    int size = properties.size();
                    for (int i = 0; i < size; i++) {
                        Property property = properties.get(i);
                        Object propertyValue = property.getValue(value);
                        Type propertyType = property.getType();
                        JSONValue encodedPropertyValue = encode(propertyValue,
                                propertyType, connection);
                        jsonObject
                                .put(property.getName(), encodedPropertyValue);
                    }
                    return jsonObject;
View Full Code Here

        JSONObject jsonMap = new JSONObject();

        for (Entry<?, ?> entry : map.entrySet()) {
            Connector connector = (Connector) entry.getKey();

            JSONValue encodedValue = encodeChildValue(entry.getValue(), type,
                    1, connection);

            jsonMap.put(connector.getConnectorId(), encodedValue);
        }
View Full Code Here

    private static JSONValue encodeCollection(Collection collection, Type type,
            ApplicationConnection connection) {
        JSONArray jsonArray = new JSONArray();
        int idx = 0;
        for (Object o : collection) {
            JSONValue encodedObject = encodeChildValue(o, type, 0, connection);
            jsonArray.set(idx++, encodedObject);
        }
        if (collection instanceof Set) {
            return jsonArray;
        } else if (collection instanceof List) {
View Full Code Here

TOP

Related Classes of com.google.gwt.json.client.JSONValue

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.