Search in sources :

Example 96 with JSONString

use of com.google.gwt.json.client.JSONString in project pentaho-platform by pentaho.

the class RecentPickItem method toJson.

public JSONObject toJson() {
    JSONObject jso = new JSONObject();
    jso.put("fullPath", new JSONString(fullPath));
    jso.put("title", new JSONString(title));
    jso.put("lastUse", new JSONNumber(lastUse));
    return jso;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONNumber(com.google.gwt.json.client.JSONNumber) JSONString(com.google.gwt.json.client.JSONString)

Example 97 with JSONString

use of com.google.gwt.json.client.JSONString in project pentaho-platform by pentaho.

the class SchedulesPanel method controlJobs.

private void controlJobs(final Set<JsJob> jobs, String function, final Method method, final boolean refreshData) {
    for (final JsJob job : jobs) {
        // $NON-NLS-1$
        final String url = GWT.getHostPageBaseURL() + "api/scheduler/" + function;
        RequestBuilder builder = new RequestBuilder(method, url);
        builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
        // $NON-NLS-1$//$NON-NLS-2$
        builder.setHeader("Content-Type", "application/json");
        JSONObject startJobRequest = new JSONObject();
        // $NON-NLS-1$
        startJobRequest.put("jobId", new JSONString(job.getJobId()));
        try {
            builder.sendRequest(startJobRequest.toString(), new RequestCallback() {

                public void onError(Request request, Throwable exception) {
                // showError(exception);
                }

                public void onResponseReceived(Request request, Response response) {
                    job.setState(response.getText());
                    table.redraw();
                    boolean isRunning = "NORMAL".equalsIgnoreCase(response.getText());
                    if (isRunning) {
                        controlScheduleButton.setToolTip(Messages.getString("stop"));
                        controlScheduleButton.setImage(ImageUtil.getThemeableImage("icon-small", "icon-stop"));
                    } else {
                        controlScheduleButton.setToolTip(Messages.getString("start"));
                        controlScheduleButton.setImage(ImageUtil.getThemeableImage("icon-small", "icon-run"));
                    }
                    if (refreshData) {
                        refresh();
                    }
                }
            });
        } catch (RequestException e) {
        // showError(e);
        }
    }
}
Also used : Response(com.google.gwt.http.client.Response) RequestBuilder(com.google.gwt.http.client.RequestBuilder) JSONObject(com.google.gwt.json.client.JSONObject) RequestCallback(com.google.gwt.http.client.RequestCallback) Request(com.google.gwt.http.client.Request) JSONString(com.google.gwt.json.client.JSONString) RequestException(com.google.gwt.http.client.RequestException) JSONString(com.google.gwt.json.client.JSONString)

Example 98 with JSONString

use of com.google.gwt.json.client.JSONString in project lienzo-core by ahome-it.

the class AbstractStorageEngine method toJSONObject.

@Override
public JSONObject toJSONObject() {
    final JSONObject object = new JSONObject();
    object.put("type", new JSONString(getStorageEngineType().getValue()));
    if (false == getMetaData().isEmpty()) {
        object.put("meta", new JSONObject(getMetaData().getJSO()));
    }
    return object;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) JSONString(com.google.gwt.json.client.JSONString)

Example 99 with JSONString

use of com.google.gwt.json.client.JSONString in project lienzo-core by ahome-it.

the class EnumValidator method validate.

@Override
public void validate(final JSONValue jval, final ValidationContext ctx) throws ValidationException {
    if (null == jval) {
        ctx.addBadTypeError(getTypeName());
        return;
    }
    final JSONString sval = jval.isString();
    if (null == sval) {
        ctx.addBadTypeError(getTypeName());
    } else {
        final String string = sval.stringValue();
        if (null != string) {
            for (final T value : m_values) {
                if (string.equals(value.getValue())) {
                    return;
                }
            }
        }
        ctx.addBadValueError(getTypeName(), jval);
    }
}
Also used : JSONString(com.google.gwt.json.client.JSONString) JSONString(com.google.gwt.json.client.JSONString)

Example 100 with JSONString

use of com.google.gwt.json.client.JSONString in project lienzo-core by ahome-it.

the class Layer method toJSONObject.

/**
 * Serializes this Layer as a {@link com.google.gwt.json.client.JSONObject}
 *
 * @return JSONObject
 */
@Override
public JSONObject toJSONObject() {
    final JSONObject object = new JSONObject();
    object.put("type", new JSONString(getNodeType().getValue()));
    if (hasMetaData()) {
        final MetaData meta = getMetaData();
        if (false == meta.isEmpty()) {
            object.put("meta", new JSONObject(meta.getJSO()));
        }
    }
    object.put("attributes", new JSONObject(getAttributes().getJSO()));
    final NFastArrayList<IPrimitive<?>> list = getChildNodes();
    final JSONArray children = new JSONArray();
    if (null != list) {
        final int size = list.size();
        for (int i = 0; i < size; i++) {
            final IPrimitive<?> prim = list.get(i);
            if (null != prim) {
                final JSONObject make = prim.toJSONObject();
                if (null != make) {
                    children.set(children.size(), make);
                }
            }
        }
    }
    object.put("children", children);
    object.put("storage", getStorageEngine().toJSONObject());
    return object;
}
Also used : JSONObject(com.google.gwt.json.client.JSONObject) MetaData(com.ait.tooling.nativetools.client.collection.MetaData) 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