Search in sources :

Example 11 with JSONObject

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

the class RemoteServer method connectionPreviewTable.

@Override
public void connectionPreviewTable(ConnectionId connectionId, String table, ServerRequestCallback<Void> callback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONObject(connectionId));
    params.set(1, new JSONString(table));
    sendRequest(RPC_SCOPE, CONNECTION_PREVIEW_TABLE, params, callback);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 12 with JSONObject

use of com.google.gwt.json.client.JSONObject 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 13 with JSONObject

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

the class RemoteServer method synctexForwardSearch.

@Override
public void synctexForwardSearch(String rootDocument, SourceLocation sourceLocation, ServerRequestCallback<PdfLocation> callback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(rootDocument));
    params.set(1, new JSONObject(sourceLocation));
    sendRequest(RPC_SCOPE, SYNCTEX_FORWARD_SEARCH, params, callback);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Example 14 with JSONObject

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

the class RemoteServer method previewDataImportAsync.

@Override
public void previewDataImportAsync(DataImportOptions dataImportOptions, int maxCols, int maxFactors, ServerRequestCallback<DataImportPreviewResponse> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONObject(dataImportOptions));
    params.set(1, new JSONNumber(maxCols));
    params.set(2, new JSONNumber(maxFactors));
    sendRequest(RPC_SCOPE, PREVIEW_DATA_IMPORT_ASYNC, params, requestCallback);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONNumber(com.google.gwt.json.client.JSONNumber)

Example 15 with JSONObject

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

the class RemoteServer method compilePdf.

public void compilePdf(FileSystemItem targetFile, String encoding, SourceLocation sourceLocation, String completedAction, ServerRequestCallback<Boolean> requestCallback) {
    JSONArray params = new JSONArray();
    params.set(0, new JSONString(targetFile.getPath()));
    params.set(1, new JSONString(encoding));
    params.set(2, new JSONObject(sourceLocation));
    params.set(3, new JSONString(completedAction));
    sendRequest(RPC_SCOPE, COMPILE_PDF, params, requestCallback);
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONArray(com.google.gwt.json.client.JSONArray) JSONString(com.google.gwt.json.client.JSONString)

Aggregations

JSONObject (com.google.gwt.json.client.JSONObject)227 JSONNumber (com.google.gwt.json.client.JSONNumber)109 JSONString (com.google.gwt.json.client.JSONString)74 JSONArray (com.google.gwt.json.client.JSONArray)62 PerunError (cz.metacentrum.perun.webgui.model.PerunError)55 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)54 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)54 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)50 JSONValue (com.google.gwt.json.client.JSONValue)13 HashMap (java.util.HashMap)12 Map (java.util.Map)8 ArrayList (java.util.ArrayList)6 JsArrayString (com.google.gwt.core.client.JsArrayString)3 User (cz.metacentrum.perun.webgui.model.User)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 Command (com.google.gwt.user.client.Command)2 Contact (com.googlecode.gwtphonegap.client.contacts.Contact)2 ContactField (com.googlecode.gwtphonegap.client.contacts.ContactField)2 StringCallback (com.gwtmobile.phonegap.client.plugins.Bluetooth.StringCallback)2