List of usage examples for com.google.gwt.json.client JSONValue isString
public JSONString isString()
From source file:org.jbpm.console.ng.ht.forms.client.display.displayers.process.PlaceManagerStartProcessDisplayerImpl.java
License:Apache License
@Override protected void initDisplayer() { JSONValue jsonValue = JSONParser.parseStrict(formContent); JSONObject jsonObject = jsonValue.isObject(); if (jsonObject != null) { formContainer.setWidth("100%"); formContainer.setHeight("400px"); JSONValue jsonDestination = jsonObject.get("destination"); if (jsonDestination == null) return; String destination = jsonDestination.isString().stringValue(); JSONObject jsonParams = jsonObject.get("params").isObject(); if (jsonParams == null) return; Map<String, String> params = jsniHelper.parseParams(jsonParams); placeManagerFormActivitySearcher.findFormActivityWidget(destination, formContainer); setFormParamsEvent.fire(new SetFormParamsEvent(params, false)); }/*from w w w. ja v a 2 s . co m*/ }
From source file:org.jbpm.console.ng.ht.forms.client.display.displayers.process.PlaceManagerStartProcessDisplayerImpl.java
License:Apache License
@Override public boolean supportsContent(String content) { try {/* w w w . ja v a2 s. c o m*/ JSONValue jsonValue = JSONParser.parseStrict(content); JSONObject jsonObject; if ((jsonObject = jsonValue.isObject()) == null) return false; jsonValue = jsonObject.get("handler"); if (jsonValue.isString() == null) return false; return jsonValue.isString().stringValue().equals("handledByPlaceManagerFormProvider"); } catch (Exception e) { } return false; }
From source file:org.jbpm.console.ng.ht.forms.client.display.displayers.task.PlaceManagerTaskDisplayerImpl.java
License:Apache License
@Override protected void initDisplayer() { JSONValue jsonValue = JSONParser.parseStrict(formContent); JSONObject jsonObject = jsonValue.isObject(); if (jsonObject != null) { formContainer.setWidth("100%"); formContainer.setHeight("400px"); JSONValue jsonDestination = jsonObject.get("destination"); if (jsonDestination == null) return; String destination = jsonDestination.isString().stringValue(); JSONObject jsonParams = jsonObject.get("params").isObject(); if (jsonParams == null) return; Map<String, String> params = jsniHelper.parseParams(jsonParams); String taskStatus = params.get("taskStatus"); placeManagerFormActivitySearcher.findFormActivityWidget(destination, formContainer); if ("InProgress".equals(taskStatus)) { setFormParamsEvent.fire(new SetFormParamsEvent(params, false)); } else {/*from www.j ava2s . c o m*/ setFormParamsEvent.fire(new SetFormParamsEvent(params, true)); } } }
From source file:org.jbpm.formapi.client.form.FormRepresentationDecoderClient.java
License:Apache License
private Object fromJsonValue(JSONValue elem) { if (elem.isString() != null) { return elem.isString().stringValue(); } else if (elem.isNumber() != null) { return elem.isNumber().doubleValue(); } else if (elem.isArray() != null) { return asList(elem.isArray()); } else if (elem.isNull() != null) { return null; } else if (elem.isObject() != null) { return asMap(elem.isObject()); } else {/* ww w.j av a 2s.com*/ return ""; } }
From source file:org.jbpm.formbuilder.client.JsonLoadInput.java
License:Apache License
public static JsonLoadInput parse(String innerHTML) throws FormEncodingException { JSONValue json = JSONParser.parseStrict(innerHTML); JsonLoadInput input = null;// ww w . j a v a 2s . co m if (json.isObject() != null) { input = new JsonLoadInput(); JSONObject jsonObj = json.isObject(); if (jsonObj.get("embedded") != null && jsonObj.get("embedded").isString() != null) { input.setProfile(jsonObj.get("embedded").isString().stringValue()); } JSONValue jsonPkg = jsonObj.get("packageName"); if (jsonPkg != null && jsonPkg.isString() != null) { input.setPackage(jsonPkg.isString().stringValue()); } JSONValue jsonCtx = jsonObj.get("contextPath"); if (jsonCtx != null && jsonCtx.isString() != null) { input.setContextPath(jsonCtx.isString().stringValue()); } if (jsonObj.get("task") != null && jsonObj.get("task").isObject() != null) { input.setTask(toTask(jsonObj.get("task").isObject())); } if (jsonObj.get("formData") != null && jsonObj.get("formData").isObject() != null) { input.setFormData(toFormData(jsonObj.get("formData").isObject())); } if (jsonObj.get("formjson") != null && jsonObj.get("formjson").isString() != null) { input.setForm(toForm(jsonObj.get("formjson").isString().stringValue())); } } return input; }
From source file:org.jbpm.formbuilder.client.JsonLoadInput.java
License:Apache License
private static Object asActualValue(JSONValue value) { if (value.isArray() != null) { JSONArray arr = value.isArray(); List<Object> retval = new ArrayList<Object>(); for (int index = 0; index < arr.size(); index++) { JSONValue subValue = arr.get(index); retval.add(asActualValue(subValue)); }/*from w w w.j a va 2 s .c o m*/ return retval; } else if (value.isBoolean() != null) { return String.valueOf(value.isBoolean().booleanValue()); } else if (value.isNull() != null) { return null; } else if (value.isNumber() != null) { return String.valueOf(value.isNumber().doubleValue()); } else if (value.isString() != null) { return value.isString().stringValue(); } else if (value.isObject() != null) { return toFormData(value.isObject()); } return null; }
From source file:org.jbpm.workbench.forms.client.display.util.JSNIHelper.java
License:Apache License
public Map<String, String> parseParams(JSONObject jsonParams) { Map<String, String> params = new HashMap<String, String>(); for (String key : jsonParams.keySet()) { JSONValue value = jsonParams.get(key); if (value != null) { if (value.isString() != null) { params.put(key, value.isString().stringValue()); } else { params.put(key, value.toString()); }//from w w w . j a v a 2 s . com } } return params; }
From source file:org.krypsis.gwt.store.client.javascript.JsStore.java
License:MIT License
/** * Loads the sequence from the backend or creates a new one. * * @return The sequence/*w w w .j av a 2s . co m*/ */ private JSONString loadSequence() { final String data = backend.get(key.getName() + SEQUENCE); JSONString jsonString; if (data == null) { jsonString = new JSONString("1"); } else { final JSONValue jsonValue = JSONParser.parse(data); jsonString = jsonValue.isString(); } if (jsonString == null) { throw new IllegalArgumentException("Database is broken. Array could not been deserialized"); } return jsonString; }
From source file:org.lirazs.gbackbone.client.core.data.Options.java
License:Apache License
public Options(JSONValue jsonObject) { JSONObject object = jsonObject.isObject(); if (object != null) { for (String s : object.keySet()) { JSONValue jsonValue = object.get(s); Object value = jsonValue; JSONNumber number = jsonValue.isNumber(); if (number != null) { if (number.toString().contains(".")) { value = number.doubleValue(); } else { value = (int) number.doubleValue(); }//from w w w.j a v a 2s . c om } JSONBoolean jsonBoolean = jsonValue.isBoolean(); if (jsonBoolean != null) value = jsonBoolean.booleanValue(); JSONNull jsonNull = jsonValue.isNull(); if (jsonNull != null) value = null; JSONString jsonString = jsonValue.isString(); if (jsonString != null) value = jsonString.stringValue(); put(s, value); } } }
From source file:org.nuxeo.ecm.platform.gwt.client.model.Document.java
License:Open Source License
public String getStringProperty(String schema, String property) { JSONValue v = getProperty(schema, property); if (v != null && v.isString() != null) { return v.isString().stringValue(); }/*from w w w .j ava2 s . c o m*/ return null; }