當前位置: 首頁>>代碼示例>>Java>>正文


Java JSONValue.isObject方法代碼示例

本文整理匯總了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;
}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:25,代碼來源:LeafletStyle.java

示例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";
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:18,代碼來源:WaitForBuildResultCommand.java

示例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));
  }
}
 
開發者ID:jiakuan,項目名稱:gwt-uploader,代碼行數:24,代碼來源:Configurable.java

示例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;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:20,代碼來源:GwtGadgetInfoParser.java

示例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);
	}
}
 
開發者ID:WELTEN,項目名稱:dojo-ibl,代碼行數:19,代碼來源:JsonResumptionListCallback.java

示例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());
                }

            }
        }
    }
}
 
開發者ID:ow2-proactive,項目名稱:scheduling-portal,代碼行數:17,代碼來源:SubmitWindow.java

示例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;
}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:21,代碼來源:JsonUtil.java

示例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();
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:10,代碼來源:ExternalStateEncoder.java

示例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);	           
        }
	
	}
}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:34,代碼來源:Project.java

示例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;
}
 
開發者ID:geowe,項目名稱:sig-seguimiento-vehiculos,代碼行數:16,代碼來源:GeoJSONCSS.java

示例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;
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:20,代碼來源:TemplateUploadWizard.java

示例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();
        }
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:41,代碼來源:ThumbnailPropProp.java

示例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);
	}
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:38,代碼來源:Inventory.java

示例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());
		}
	}
}
 
開發者ID:openkm,項目名稱:document-management-system,代碼行數:38,代碼來源:GWTFileUploadResponse.java

示例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 );
}
 
開發者ID:RISCOSS,項目名稱:riscoss-corporate,代碼行數:10,代碼來源:JsonRDCValueMap.java


注:本文中的com.google.gwt.json.client.JSONValue.isObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。