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