List of usage examples for com.google.gwt.json.client JSONValue isObject
public JSONObject isObject()
From source file:org.spiffyui.spsample.client.rest.VersionInfo.java
License:Apache License
private static void createVersionInfo(JSONValue val, RESTObjectCallBack<VersionInfo> callback) { JSONObject bi = val.isObject(); if (bi == null) { MessageUtil.showError("An error occurred trying to get version info."); return;// w w w . ja v a 2s. co m } g_versionInfo = new VersionInfo(); g_versionInfo.m_version = JSONUtil.getStringValue(bi, "version"); g_versionInfo.m_user = JSONUtil.getStringValue(bi, "user"); g_versionInfo.m_rev = JSONUtil.getStringValue(bi, "rev"); g_versionInfo.m_date = JSONUtil.getStringValue(bi, "date"); g_versionInfo.m_revDate = JSONUtil.getStringValue(bi, "revdate"); callback.success(g_versionInfo); }
From source file:org.talend.mdm.webapp.browserecords.client.rest.ExplainRestServiceHandler.java
License:Open Source License
public void retriveNode(JSONValue jsonValue, BaseTreeModel parent) { if (jsonValue.isArray() != null) { JSONArray array = jsonValue.isArray(); for (int i = 0; i < array.size(); i++) { JSONValue value = array.get(i); String content = getStringValue(value); if (content != null) { addChildNode(content, parent); }/*from w ww. ja v a 2s. c om*/ retriveNode(value, parent); } } else if (jsonValue.isObject() != null) { JSONObject object = jsonValue.isObject(); Set<String> keySet = object.keySet(); for (String key : keySet) { JSONValue value = object.get(key); String content = getStringValue(value); if (content != null) { addChildNode(key + StagingConstant.VALUE_SEPARATOR + content, parent); } else { BaseTreeModel treeModel = addChildNode(key, parent); retriveNode(value, treeModel); } } } }
From source file:org.talend.mdm.webapp.browserecords.client.rest.ExplainRestServiceHandler.java
License:Open Source License
public JSONArray getJSONArray(JSONValue value, String key) { JSONArray childArray = null;/*www . ja v a2 s .co m*/ if (value != null && value.isObject() != null) { JSONObject object = value.isObject(); JSONValue childValue = object.get(key); if (childValue != null && childValue.isArray() != null) { childArray = childValue.isArray(); } } return childArray; }
From source file:org.talend.mdm.webapp.browserecords.client.rest.ExplainRestServiceHandler.java
License:Open Source License
private JSONValue getJSONValue(JSONArray array, String key) { JSONValue value = null;/* ww w .j a v a2s . c om*/ for (int i = 0; i < array.size(); i++) { JSONValue jsonValue = array.get(i); if (jsonValue.isObject() != null) { JSONObject object = jsonValue.isObject(); if (object.get(key) != null) { value = object.get(key); break; } } } return value; }
From source file:org.thechiselgroup.biomixer.client.json.JsJsonParser.java
License:Apache License
@Override public Object get(Object jsonValue, String property) { JSONValue node = (JSONValue) jsonValue; JSONObject object = node.isObject(); return object != null ? object.get(property) : null; }
From source file:org.thechiselgroup.biomixer.client.json.JsJsonParser.java
License:Apache License
@Override public Set<String> getObjectProperties(Object jsonValue) { JSONValue node = (JSONValue) jsonValue; JSONObject object = node.isObject(); return object.keySet(); }
From source file:org.utgenome.gwt.utgb.client.db.DatabaseCatalog.java
License:Apache License
/** * parsing the given JSONData representing database schema * // www .j a v a2 s.c o m * @param jsonData * @throws UTGBClientException */ public void load(String jsonData) throws UTGBClientException { _relationList.clear(); _tableNameList.clear(); JSONValue json = JSONParser.parse(jsonData); JSONObject jsonObj = json.isObject(); if (jsonObj == null) throw new UTGBClientException("invalid json data:" + jsonData); // read relations for (String tableName : jsonObj.keySet()) { JSONValue relationValue = jsonObj.get(tableName); Relation r = new Relation(relationValue.isObject()); // update _tableNameList.add(tableName); _relationList.add(r); } }
From source file:org.utgenome.gwt.utgb.client.db.DatabaseTable.java
License:Apache License
public void setTableData(String jsonData) { // clear the row data while (_table.getRowCount() > 1) _table.removeRow(_table.getRowCount() - 1); try {/*from w ww .jav a 2 s . com*/ JSONValue json = JSONParser.parse(jsonData); JSONObject root; if ((root = json.isObject()) != null) { JSONValue array = root.get("data"); if (array == null) return; JSONArray rowArray; if ((rowArray = array.isArray()) != null) { for (int i = 0; i < rowArray.size(); i++) { addRow(rowArray.get(i)); } } } } catch (JSONException e) { GWT.log("JSON error", e); } }
From source file:org.utgenome.gwt.utgb.client.db.DatabaseTable.java
License:Apache License
public void addRow(JSONValue rowValue) { JSONObject rowData;// ww w.ja v a2 s. c o m int row = _table.getRowCount(); if ((rowData = rowValue.isObject()) != null) { int columnIndex = 0; for (DataType dt : _relation.getDataTypeList()) { JSONValue jsonValue = rowData.get(dt.getName()); setValue(row, columnIndex, jsonValue); columnIndex++; } _table.getRowFormatter().setStyleName(row, "table-data"); } else { GWT.log("invalid json data", new UTGBClientException()); } }
From source file:org.utgenome.gwt.utgb.client.db.Relation.java
License:Apache License
public Relation(String jsonStr) throws UTGBClientException { JSONValue json = JSONParser.parse(jsonStr); parse(json.isObject()); }