Search in sources :

Example 61 with JSONArray

use of com.google.gwt.json.client.JSONArray in project gwtphonegap by dankurka.

the class ContactBrowserImpl method createOrganisation.

private JSONArray createOrganisation(LightArray<ContactOrganisation> organisations) {
    JSONArray jsonArray = new JSONArray();
    for (int i = 0; i < organisations.length(); i++) {
        ContactOrganisation co = organisations.get(i);
        JSONObject orga = new JSONObject();
        orga.put(ORGANISATION_NAME, getAsJSONString(co.getName()));
        orga.put(ORGANISATION_DEPARTMENT, getAsJSONString(co.getDepartment()));
        orga.put(ORGANISATION_TITLE, getAsJSONString(co.getTitle()));
        orga.put(ORGANISATION_TYPE, getAsJSONString(co.getType()));
        orga.put(ORGANISATION_PREF, JSONBoolean.getInstance(co.isPref()));
        jsonArray.set(i, orga);
    }
    return jsonArray;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) ContactOrganisation(com.googlecode.gwtphonegap.client.contacts.ContactOrganisation)

Example 62 with JSONArray

use of com.google.gwt.json.client.JSONArray in project rstudio by rstudio.

the class RemoteServer method sendRequest.

private <T> void sendRequest(String scope, String method, String param1, String param2, ServerRequestCallback<T> requestCallback) {
    JSONArray params = new JSONArray();
    // pass JSONNull if the string is null
    params.set(0, param1 != null ? new JSONString(param1) : JSONNull.getInstance());
    params.set(1, param2 != null ? new JSONString(param2) : JSONNull.getInstance());
    sendRequest(scope, method, params, requestCallback);
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 63 with JSONArray

use of com.google.gwt.json.client.JSONArray in project perun by CESNET.

the class AssignGroupToResources method prepareJSONObject.

/**
	 * Prepares a JSON object
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    JSONObject jsonQuery = new JSONObject();
    JSONArray array = new JSONArray();
    for (int i = 0; i < resources.size(); i++) {
        array.set(i, new JSONNumber(resources.get(i).getId()));
    }
    jsonQuery.put("resources", array);
    jsonQuery.put("group", new JSONNumber(group.getId()));
    return jsonQuery;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONNumber(com.google.gwt.json.client.JSONNumber)

Example 64 with JSONArray

use of com.google.gwt.json.client.JSONArray in project perun by CESNET.

the class RemoveGroupsFromResource method prepareJSONObject.

/**
	 * Prepares a JSON object
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    JSONObject jsonQuery = new JSONObject();
    JSONArray array = new JSONArray();
    for (int i = 0; i < groups.size(); i++) {
        array.set(i, new JSONNumber(groups.get(i).getId()));
    }
    jsonQuery.put("groups", array);
    jsonQuery.put("resource", new JSONNumber(resource.getId()));
    return jsonQuery;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONNumber(com.google.gwt.json.client.JSONNumber)

Example 65 with JSONArray

use of com.google.gwt.json.client.JSONArray in project perun by CESNET.

the class AddDestination method prepareJSONObject.

/**
	 * Prepares a JSON object
	 *
	 * @return JSONObject the whole query
	 */
private JSONObject prepareJSONObject() {
    // whole JSON query
    JSONObject jsonQuery = new JSONObject();
    jsonQuery.put("destination", new JSONString(destination));
    jsonQuery.put("type", new JSONString(type));
    jsonQuery.put("facility", new JSONNumber(facility.getId()));
    JSONArray servs = new JSONArray();
    for (int i = 0; i < services.size(); i++) {
        // rebuild service object
        JSONObject srv = new JSONObject();
        srv.put("id", new JSONNumber(services.get(i).getId()));
        srv.put("name", new JSONString(services.get(i).getName()));
        servs.set(i, srv);
    }
    jsonQuery.put("services", servs);
    return jsonQuery;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONNumber(com.google.gwt.json.client.JSONNumber) JSONString(com.google.gwt.json.client.JSONString)

Aggregations

JSONArray (com.google.gwt.json.client.JSONArray)261 JSONString (com.google.gwt.json.client.JSONString)182 JSONNumber (com.google.gwt.json.client.JSONNumber)69 JSONObject (com.google.gwt.json.client.JSONObject)62 JSONValue (com.google.gwt.json.client.JSONValue)10 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)8 Point (org.rstudio.studio.client.workbench.views.plots.model.Point)8 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 Date (java.util.Date)5 Map (java.util.Map)5 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 JsArrayString (com.google.gwt.core.client.JsArrayString)2 JSONBoolean (com.google.gwt.json.client.JSONBoolean)2 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)2 ContactOrganisation (com.googlecode.gwtphonegap.client.contacts.ContactOrganisation)2 Test (org.junit.Test)2 EntryPoint (com.google.gwt.core.client.EntryPoint)1 Style (com.google.gwt.dom.client.Style)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1