List of usage examples for com.google.gwt.json.client JSONNumber JSONNumber
public JSONNumber(double value)
From source file:org.pentaho.mantle.client.solutionbrowser.filepicklist.RecentPickItem.java
License:Open Source License
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;/*from ww w. j a v a 2 s.c om*/ }
From source file:org.rest.client.ExternalEventsFactory.java
License:Apache License
/** * Register handlers for all custom events available for application. * @param eventBus//from ww w . ja va 2 s . c om */ public static void init(EventBus eventBus) { // // Register application's actions handlers // ApplicationReadyEvent.register(eventBus, new ApplicationReadyEvent.Handler() { @Override public void onReady() { fireDocumentEvent(CustomEvent.APPLICATION_READY.getValue()); } }); AddEncodingEvent.register(eventBus, new AddEncodingEvent.Handler() { @Override public void onAddEncoding(String encoding) { fireDocumentEvent(CustomEvent.ADD_ENCODING.getValue(), encoding); } }); UrlValueChangeEvent.register(eventBus, new UrlValueChangeEvent.Handler() { @Override public void onUrlChange(String url) { fireDocumentEvent(CustomEvent.URL_CHANGE.getValue(), url); } }); RequestStartActionEvent.register(eventBus, new RequestStartActionEvent.Handler() { @Override public void onStart(Date time) { double startTime = (double) time.getTime(); fireDocumentEvent(CustomEvent.REQUEST_START_ACTION.getValue(), startTime); } }); RequestEndEvent.register(eventBus, new RequestEndEvent.Handler() { @Override public void onResponse(boolean success, Response response, long requestTime) { JSONObject obj = new JSONObject(); obj.put("error", JSONBoolean.getInstance(!success)); obj.put("requesttime", new JSONNumber(requestTime)); fireDocumentEvent(CustomEvent.REQUEST_STOP.getValue(), obj.getJavaScriptObject()); } }); HttpEncodingChangeEvent.register(eventBus, new HttpEncodingChangeEvent.Handler() { @Override public void onChange(String method) { fireDocumentEvent(CustomEvent.HTTP_ENCODING_CHANGE.getValue(), method); } }); // // Register application's UI state change handlers // ClearFormEvent.register(eventBus, new ClearFormEvent.Handler() { @Override public void onClearForm() { fireDocumentEvent(CustomEvent.CLEAR_ALL.getValue()); } }); URLFieldToggleEvent.register(eventBus, new URLFieldToggleEvent.Handler() { @Override public void onClearForm(boolean isNowSimpleView) { String value = "simple"; if (!isNowSimpleView) { value = "detailed"; } fireDocumentEvent(CustomEvent.URL_FIELD_TOGGLE.getValue(), value); } }); HttpMethodChangeEvent.register(eventBus, new HttpMethodChangeEvent.Handler() { @Override public void onMethodChange(String method) { fireDocumentEvent(CustomEvent.HTTP_METHOD_CHANGE.getValue(), method); } }); ClearHistoryEvent.register(eventBus, new ClearHistoryEvent.Handler() { @Override public void onClearForm() { fireDocumentEvent(CustomEvent.CLEAR_HISTORY.getValue()); } }); ProjectChangeEvent.register(eventBus, new ProjectChangeEvent.Handler() { @Override public void onProjectChange(ProjectObject project) { fireDocumentEvent(CustomEvent.PROJECT_CHANGE.getValue(), project); } }); ProjectDeleteEvent.register(eventBus, new ProjectDeleteEvent.Handler() { @Override public void onProjectDelete(int projectId) { fireDocumentEvent(CustomEvent.PROJECT_DELETE.getValue(), projectId + ""); } }); }
From source file:org.rest.client.jso.HistoryObject.java
License:Apache License
/** * @return {@link RequestObject} as a {@link JSONObject} *//* w w w. jav a2 s. c om*/ public final JSONObject toJSONObject() { JSONObject obj = new JSONObject(); obj.put("encoding", new JSONString(getEncoding() == null ? "" : getEncoding())); obj.put("headers", new JSONString(getHeaders() == null ? "" : getHeaders())); obj.put("method", new JSONString(getMethod() == null ? "" : getMethod())); obj.put("payload", new JSONString(getPayload() == null ? "" : getPayload())); obj.put("time", new JSONNumber(getTime())); obj.put("url", new JSONString(getURL() == null ? "" : getURL())); return obj; }
From source file:org.rest.client.jso.ProjectObject.java
License:Apache License
/** * @return {@link RequestObject} as a {@link JSONObject} *///from w w w . j a v a 2 s. c o m public final JSONObject toJSONObject() { JSONObject obj = new JSONObject(); obj.put("id", new JSONNumber(getId())); obj.put("name", new JSONString(getName() == null ? "" : getName())); obj.put("created", new JSONNumber(getCreated())); return obj; }
From source file:org.rest.client.jso.RequestObject.java
License:Apache License
/** * @return {@link RequestObject} as a {@link JSONObject} *//*from w ww . j a v a2 s . c o m*/ public final JSONObject toJSONObject() { JSONObject obj = new JSONObject(); obj.put("id", new JSONNumber(getId())); obj.put("encoding", new JSONString("")); obj.put("headers", new JSONString(getHeaders() == null ? "" : getHeaders())); obj.put("method", new JSONString(getMethod() == null ? "" : getMethod())); obj.put("name", new JSONString(getName() == null ? "" : getName())); obj.put("payload", new JSONString(getPayload() == null ? "" : getPayload())); obj.put("project", new JSONNumber(getProject())); obj.put("time", new JSONNumber(getTime())); obj.put("url", new JSONString(getURL() == null ? "" : getURL())); obj.put("driveId", new JSONString(getGDriveId() == null ? "" : getGDriveId())); return obj; }
From source file:org.rest.client.storage.store.objects.ProjectObject.java
License:Apache License
/** * @return {@link RequestObject} as a {@link JSONObject} *//* w w w . j a v a 2 s . co m*/ public final JSONObject toJSONObject() { JSONObject obj = new JSONObject(); obj.put("id", new JSONNumber(getId())); obj.put("name", new JSONString(getName() == null ? "" : getName())); obj.put("time", new JSONNumber(getCreated())); return obj; }
From source file:org.rest.client.storage.store.objects.RequestObject.java
License:Apache License
/** * @return {@link RequestObject} as a {@link JSONObject} *///from ww w . j a v a 2 s . com public final JSONObject toJSONObject() { JSONObject obj = new JSONObject(); obj.put("id", new JSONNumber(getId())); obj.put("encoding", new JSONString(getEncoding() == null ? "" : getEncoding())); obj.put("headers", new JSONString(getHeaders() == null ? "" : getHeaders())); obj.put("method", new JSONString(getMethod() == null ? "" : getMethod())); obj.put("name", new JSONString(getName() == null ? "" : getName())); obj.put("payload", new JSONString(getPayload() == null ? "" : getPayload())); obj.put("project", new JSONNumber(getProject())); obj.put("skipHeaders", JSONBoolean.getInstance(getSkipHeaders() == 1 ? true : false)); obj.put("skipHistory", JSONBoolean.getInstance(getSkipHistory() == 1 ? true : false)); obj.put("skipMethod", JSONBoolean.getInstance(getSkipMethod() == 1 ? true : false)); obj.put("skipParams", JSONBoolean.getInstance(getSkipParams() == 1 ? true : false)); obj.put("skipPath", JSONBoolean.getInstance(getSkipPath() == 1 ? true : false)); obj.put("skipPayload", JSONBoolean.getInstance(getSkipPayload() == 1 ? true : false)); obj.put("skipProtocol", JSONBoolean.getInstance(getSkipProtocol() == 1 ? true : false)); obj.put("skipServer", JSONBoolean.getInstance(getSkipServer() == 1 ? true : false)); obj.put("time", new JSONNumber(getTime())); obj.put("url", new JSONString(getURL() == null ? "" : getURL())); obj.put("driveId", new JSONString(getGDriveId() == null ? "" : getGDriveId())); return obj; }
From source file:org.rstudio.core.client.jsonrpc.RpcRequest.java
License:Open Source License
public RpcRequest(String url, String method, JSONArray params, JSONObject kwparams, boolean redactLog, String sourceWindow, String clientId, double clientVersion) { url_ = url;/*from w w w . j a va 2 s . com*/ method_ = method; params_ = params; kwparams_ = kwparams; redactLog_ = redactLog; if (sourceWindow != null) sourceWindow_ = new JSONString(sourceWindow); else sourceWindow_ = null; if (clientId != null) clientId_ = new JSONString(clientId); else clientId_ = null; clientVersion_ = new JSONNumber(clientVersion); }
From source file:org.rstudio.studio.client.common.JSONArrayBuilder.java
License:Open Source License
public final JSONArrayBuilder add(int value) { append(new JSONNumber(value)); return this; }
From source file:org.rstudio.studio.client.common.JSONArrayBuilder.java
License:Open Source License
public final JSONArrayBuilder add(double value) { append(new JSONNumber(value)); return this; }