Search in sources :

Example 51 with JSONString

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

the class RemoteServer method svnApplyPatch.

@Override
public void svnApplyPatch(String path, String patch, String sourceEncoding, ServerRequestCallback<Void> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(path));
    params.set(1, new JSONString(patch));
    params.set(2, new JSONString(sourceEncoding));
    sendRequest(RPC_SCOPE, SVN_APPLY_PATCH, params, requestCallback);
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 52 with JSONString

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

the class RnwChunkOptions method getOptionValues.

public final ArrayList<String> getOptionValues(String name) {
    JSONArray arr = new JSONArray(getOptionTypeNative(name));
    ArrayList<String> values = new ArrayList<String>();
    for (int i = 0; i < arr.size(); i++) {
        JSONArray array = arr.get(i).isArray();
        if (array == null)
            break;
        if (array.size() == 0)
            break;
        JSONString string = array.get(0).isString();
        if (string == null)
            break;
        values.add(string.stringValue());
    }
    return values;
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) ArrayList(java.util.ArrayList) JsArrayString(com.google.gwt.core.client.JsArrayString) JSONString(com.google.gwt.json.client.JSONString) JSONString(com.google.gwt.json.client.JSONString)

Example 53 with JSONString

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

the class RemoteServer method gitCreateBranch.

@Override
public void gitCreateBranch(String branch, ServerRequestCallback<ConsoleProcess> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(branch));
    sendRequest(RPC_SCOPE, GIT_CREATE_BRANCH, params, new ConsoleProcessCallbackAdapter(requestCallback));
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 54 with JSONString

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

the class RemoteServer method sendRequestViaMainWorkbench.

// call made from satellite -- this delegates to a native method which
// sets up a javascript callback and then calls the main workbench
private <T> void sendRequestViaMainWorkbench(String scope, String method, JSONArray params, boolean redactLog, final ServerRequestCallback<T> requestCallback) {
    JSONObject request = new JSONObject();
    request.put("method", new JSONString(method));
    if (params != null)
        request.put("params", params);
    final RequestLogEntry requestLogEntry = RequestLog.log(Integer.toString(Random.nextInt()), redactLog ? "[REDACTED]" : request.toString());
    sendRequestViaMainWorkbench(scope, method, params.getJavaScriptObject(), redactLog, new RpcResponseHandler() {

        @Override
        public void onResponseReceived(RpcResponse response) {
            String responseText = response.toString();
            requestLogEntry.logResponse(ResponseType.Normal, responseText);
            if (response.getError() != null) {
                RpcError error = response.getError();
                requestCallback.onError(new RemoteServerError(error));
            } else {
                T result = response.<T>getResult();
                requestCallback.onResponseReceived(result);
            }
        }
    });
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) RequestLogEntry(org.rstudio.core.client.jsonrpc.RequestLogEntry) GWT(com.google.gwt.core.client.GWT) RpcResponseHandler(org.rstudio.core.client.jsonrpc.RpcResponseHandler) RpcError(org.rstudio.core.client.jsonrpc.RpcError) JSONString(com.google.gwt.json.client.JSONString) JsArrayString(com.google.gwt.core.client.JsArrayString) RpcResponse(org.rstudio.core.client.jsonrpc.RpcResponse) JSONString(com.google.gwt.json.client.JSONString)

Example 55 with JSONString

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

the class RemoteServer method getSlideNavigationForCode.

@Override
public void getSlideNavigationForCode(String code, String baseDir, ServerRequestCallback<SlideNavigation> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(code));
    params.set(1, new JSONString(baseDir));
    sendRequest(RPC_SCOPE, GET_SLIDE_NAVIGATION_FOR_CODE, params, requestCallback);
}
Also used : JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Aggregations

JSONString (com.google.gwt.json.client.JSONString)277 JSONArray (com.google.gwt.json.client.JSONArray)189 JSONObject (com.google.gwt.json.client.JSONObject)110 JSONNumber (com.google.gwt.json.client.JSONNumber)85 JSONValue (com.google.gwt.json.client.JSONValue)13 HashMap (java.util.HashMap)12 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)10 Map (java.util.Map)10 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)9 PerunError (cz.metacentrum.perun.webgui.model.PerunError)9 Material (org.cesiumjs.cs.scene.Material)9 MaterialOptions (org.cesiumjs.cs.scene.options.MaterialOptions)9 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)8 MetaData (com.ait.tooling.nativetools.client.collection.MetaData)7 ArrayList (java.util.ArrayList)7 JsArrayString (com.google.gwt.core.client.JsArrayString)6 RequestBuilder (com.google.gwt.http.client.RequestBuilder)6 Breakpoint (org.rstudio.studio.client.common.debugging.model.Breakpoint)6 Point (org.rstudio.studio.client.workbench.views.plots.model.Point)6 Request (com.google.gwt.http.client.Request)5