本文整理汇总了Java中com.google.gwt.json.client.JSONValue.isObject方法的典型用法代码示例。如果您正苦于以下问题:Java JSONValue.isObject方法的具体用法?Java JSONValue.isObject怎么用?Java JSONValue.isObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.json.client.JSONValue
的用法示例。
在下文中一共展示了JSONValue.isObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStyle
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
public static ProjectLayerStyle getStyle(String geoJSONCSS) {
ProjectLayerStyle style = null;
final JSONValue jsonValue = JSONParser.parseLenient(geoJSONCSS);
final JSONObject geoJSONCssObject = jsonValue.isObject();
if (geoJSONCssObject.containsKey(GeoJSONCSS.STYLE_NAME)) {
JSONObject styleObject = geoJSONCssObject
.get(GeoJSONCSS.STYLE_NAME).isObject();
String fillColor = getStringValue(styleObject, FILL_COLOR_NAME);
Double fillOpacity = getDoubleValue(styleObject, FILL_OPACITY_NAME);
if(fillOpacity == null) {
fillOpacity = getDoubleValue(styleObject, FILL_OPACITY2_NAME);
}
String strokeColor = getStringValue(styleObject, STROKE_COLOR_NAME);
Double strokeWidth = getDoubleValue(styleObject, STROKE_WIDTH_NAME);
style = new ProjectLayerStyle(fillColor, fillOpacity, strokeColor,
strokeWidth);
}
return style;
}
示例2: extractFormName
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
private static String extractFormName(RpcResult result) {
String extraString = result.getExtra();
if (extraString != null) {
JSONValue extraJSONValue = JSONParser.parseStrict(extraString);
JSONObject extraJSONObject = extraJSONValue.isObject();
if (extraJSONObject != null) {
JSONValue formNameJSONValue = extraJSONObject.get("formName");
if (formNameJSONValue != null) {
JSONString formNameJSONString = formNameJSONValue.isString();
if (formNameJSONString != null) {
return formNameJSONString.stringValue();
}
}
}
}
return "Screen1";
}
示例3: setOption
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
private void setOption(JSONObject rootObject, String path, Object value) {
if (path == null) {
return;
}
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.length() <= 0) {
return;
}
String nodeName = path;
if (nodeName.contains("/")) {
nodeName = nodeName.substring(0, nodeName.indexOf("/"));
JSONValue objectAsValue = rootObject.get(nodeName);
if (objectAsValue == null || objectAsValue.isObject() == null) {
rootObject.put(nodeName, new JSONObject());
}
JSONObject object = (JSONObject) rootObject.get(nodeName);
setOption(object, path.substring(path.indexOf("/") + 1), value);
} else {
rootObject.put(nodeName, convertToJSONValue(value));
}
}
示例4: parseGadgetInfo
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
private GadgetInfo parseGadgetInfo(JSONValue item) {
JSONObject object = item.isObject();
if (object != null) {
String name = object.get("name").isString().stringValue();
String desc = object.get("desc").isString().stringValue();
GadgetCategoryType primaryCategory =
GadgetCategoryType.of(object.get("primaryCategory").isString().stringValue());
GadgetCategoryType secondaryCategory =
GadgetCategoryType.of(object.get("secondaryCategory").isString().stringValue());
String gadgetUrl = object.get("gadgetUrl").isString().stringValue();
String author = object.get("author").isString().stringValue();
String submittedBy = object.get("submittedBy").isString().stringValue();
String imageUrl = object.get("imageUrl").isString().stringValue();
return new GadgetInfo(name, desc, primaryCategory, secondaryCategory, gadgetUrl, author,
submittedBy, imageUrl);
}
return null;
}
示例5: onJsonReceived
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
public void onJsonReceived(JSONValue jsonValue) {
JSONObject jsonObject = jsonValue.isObject();
if (jsonObject == null) {
return;
}
if (jsonObject.containsKey("resumptionToken")) {
resumptionToken = jsonObject.get("resumptionToken").isString().stringValue();
nextCall();
} else {
if (jsonObject.containsKey("serverTime"))
dataSourceModel.setServerTime((long) jsonObject.get("serverTime").isNumber().doubleValue());
}
if (jsonObject.get("error") != null) {
Authentication.getInstance().disAuthenticate();
} else {
onJsonArrayReceived(jsonObject);
}
}
示例6: updateVariables
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
private void updateVariables(JSONValue updatedVariablesJsonValue) {
JSONObject obj = updatedVariablesJsonValue.isObject();
if (obj != null) {
for (String varName : obj.keySet()) {
JobVariable variable = variables.get(varName);
if (variable != null) {
JSONValue variableJsonValue = obj.get(varName);
JSONString variableJsonString = variableJsonValue.isString();
if (variableJsonString != null) {
variable.setValue(variableJsonString.stringValue());
}
}
}
}
}
示例7: parseVersion
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
public static Version parseVersion(JSONValue jsonValue) {
JSONObject obj = jsonValue.isObject();
Version version = new Version();
if (obj != null) {
JSONValue value = obj.get("version");
if (value != null) {
JSONString str = value.isString();
if (str != null) {
version.version = str.stringValue();
}
}
}
return version;
}
示例8: getState
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
private JavaScriptObject getState(JSONValue jsonValue) {
JSONObject state = jsonValue.isObject();
if (state.containsKey(STATE)) {
return state.get(STATE).isArray().get(0).isObject().getJavaScriptObject();
}
return state.getJavaScriptObject();
}
示例9: Project
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
public Project(String json) {
final JSONValue jsonValue = JSONParser.parseLenient(json);
final JSONObject jsonObject = jsonValue.isObject();
String projectDate = jsonObject.get(DATE_NAME).isString().stringValue();
String projectTitle = jsonObject.get(TITLE_NAME).isString().stringValue();
String projectVersion = jsonObject.get(VERSION_NAME).isString().stringValue();
String projectDescription = jsonObject.get(DESCRIPTION_NAME).isString().stringValue();
setDate(projectDate);
setTitle(projectTitle);
setVersion(projectVersion);
setDescription(projectDescription);
JSONArray layersArray = jsonObject.get(VECTORS_NAME).isArray();
if (layersArray != null) {
for (int i = 0; i < layersArray.size(); i++) {
JSONObject projectLayerObj = layersArray.get(i).isObject();
String name = projectLayerObj.get(NAME).isString().stringValue();
String content = projectLayerObj.get(CONTENT_NAME).isString().stringValue();
JSONObject styleProjectLayer = projectLayerObj.get(STYLE_NAME).isObject();
String fillColor = styleProjectLayer.get(ProjectLayerStyle.FILL_COLOR_NAME).isString().stringValue();
Double fillOpacity = styleProjectLayer.get(ProjectLayerStyle.FILL_OPACITY_NAME).isNumber().doubleValue();
String strokeColor = styleProjectLayer.get(ProjectLayerStyle.STROKE_COLOR_NAME).isString().stringValue();
Double strokeWidth = styleProjectLayer.get(ProjectLayerStyle.STROKE_WIDTH_NAME).isNumber().doubleValue();
add(name, content, fillColor, fillOpacity, strokeColor, strokeWidth);
}
}
}
示例10: getLayerStyle
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
public VectorStyleDef getLayerStyle(String vectorFormatString) {
VectorFeatureStyleDef def = null;
final JSONValue jsonValue = JSONParser.parseLenient(vectorFormatString);
final JSONObject geoJSONCssObject = jsonValue.isObject();
if (geoJSONCssObject.containsKey(GeoJSONCSS.STYLE_NAME)) {
JSONObject styleObject = geoJSONCssObject.get(GeoJSONCSS.STYLE_NAME).isObject();
JSObject styleJSObject = styleObject.getJavaScriptObject().cast();
def = getStyleDef(styleJSObject);
}
return def;
}
示例11: getTemplates
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
/**
* Returns a list of Template objects containing data needed
* to load a template from a zip file. Each non-null template object
* is created from its Json string
*
* @return ArrayList of TemplateInfo objects
*/
protected static ArrayList<TemplateInfo> getTemplates() {
JSONValue jsonVal = JSONParser.parseLenient(templateDataString);
JSONArray jsonArr = jsonVal.isArray();
ArrayList<TemplateInfo> templates = new ArrayList<TemplateInfo>();
for (int i = 0; i < jsonArr.size(); i++) {
JSONValue value = jsonArr.get(i);
JSONObject obj = value.isObject();
if (obj != null)
templates.add(new TemplateInfo(obj)); // Create TemplateInfo from Json
}
return templates;
}
示例12: onSuccess
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
@Override
public void onSuccess(String json) {
/*
{
"table": {
"columnNames": ["expocode", "vessel_name", "investigators", "qc_flag"],
"columnTypes": ["String", "String", "String", "String"],
"columnUnits": [null, null, null, null],
"rows": [
["01AA20110928", "Nuka Arctica", "Truls Johannessen ; Abdirahman Omar ; Ingunn Skjelvan", "N"]
]
}
}
*/
JSONValue jsonV = JSONParser.parseStrict(json);
JSONObject jsonO = jsonV.isObject();
if ( jsonO != null) {
JSONObject table = (JSONObject) jsonO.get("table");
JSONArray names = (JSONArray) table.get("columnNames");
JSONArray rows = (JSONArray) table.get("rows");
JSONArray r0 = (JSONArray) rows.get(0);
for (int i = 0; i < names.size(); i++) {
String name = names.get(i).toString();
if ( name.endsWith("") ) name = name.substring(0,name.length()-1);
if ( name.startsWith("") ) name = name.substring(1,name.length());
String value = r0.get(i).toString();
if ( value.endsWith("") ) value = value.substring(0,value.length()-1);
if ( value.startsWith("") ) value = value.substring(1,value.length());
metadata.put(name.toUpperCase(Locale.ENGLISH), value);
}
}
showMetadata();
}
示例13: onSuccess
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
@Override
public void onSuccess(String json) {
JSONValue jsonV = JSONParser.parseStrict(json);
JSONObject jsonO = jsonV.isObject();
MarkerClustererOptions clusterOptions = MarkerClustererOptions.newInstance();
clusterOptions.setIgnoreHidden(true);
MarkerClusterer cluster = MarkerClusterer.newInstance(mapUI.getMap(), clusterOptions);
List<LatLng> locations = new ArrayList<LatLng>();
if ( jsonO != null) {
JSONObject table = (JSONObject) jsonO.get("table");
JSONValue id = (JSONValue) table.get("catid");
String catid = id.toString().trim().replace("\"", "");
JSONArray names = (JSONArray) table.get("columnNames");
JSONArray rows = (JSONArray) table.get("rows");
int index = 0;
for(int i = 1; i < rows.size(); i++) {
JSONArray row = (JSONArray) rows.get(i);
String latitude = row.get(0).toString();
String longitude = row.get(1).toString();
if ( latitude != null && longitude != null & !latitude.equals("null") && !longitude.equals("null")) {
LatLng p = LatLng.newInstance(Double.valueOf(latitude), Double.valueOf(longitude));
MarkerOptions options = MarkerOptions.newInstance();
options.setPosition(p);
options.setMap(mapUI.getMap());
Marker marker = Marker.newInstance(options);
locations.add(p);
cluster.addMarker(marker);
}
index++;
}
mapUI.addMarkerClustererToPanel(catid, cluster);
mapUI.addLocationsToPanel(catid, locations);
}
}
示例14: GWTFileUploadResponse
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
/**
* GWTFileUploadResponse
*
* @param text json encoded parameters.
*/
public GWTFileUploadResponse(String text) {
text = text.substring(text.indexOf("{"));
text = text.substring(0, text.lastIndexOf("}") + 1);
JSONValue responseValue = JSONParser.parseStrict(text);
JSONObject response = responseValue.isObject();
// Deserialize information
hasAutomation = response.get("hasAutomation").isBoolean().booleanValue();
path = URL.decodeQueryString(response.get("path").isString().stringValue());
error = response.get("error").isString().stringValue();
showWizardCategories = response.get("showWizardCategories").isBoolean().booleanValue();
showWizardKeywords = response.get("showWizardKeywords").isBoolean().booleanValue();
digitalSignature = response.get("digitalSignature").isBoolean().booleanValue();
// Getting property groups
JSONArray groupsArray = response.get("groupsList").isArray();
if (groupsArray != null) {
for (int i = 0; i <= groupsArray.size() - 1; i++) {
groupsList.add(groupsArray.get(i).isString().stringValue());
}
}
// Getting workflows
JSONArray workflowArray = response.get("workflowList").isArray();
if (workflowArray != null) {
for (int i = 0; i <= workflowArray.size() - 1; i++) {
workflowList.add(workflowArray.get(i).isString().stringValue());
}
}
}
示例15: isEnabled
import com.google.gwt.json.client.JSONValue; //导入方法依赖的package包/类
public boolean isEnabled( String rdcName ) {
JSONValue v = root.get( rdcName );
if( v == null ) return false;
if( v.isObject() == null ) return false;
JSONObject o = v.isObject();
if( o.get( "enabled" ) == null ) return false;
if( o.get( "enabled" ).isBoolean() == null ) return false;
return ( o.get( "enabled" ).isBoolean().booleanValue() == true );
}