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);
}
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);
}
}
});
}
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);
}
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);
}
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);
}
Aggregations