当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.put方法代码示例

本文整理汇总了Java中com.google.gwt.json.client.JSONObject.put方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.put方法的具体用法?Java JSONObject.put怎么用?Java JSONObject.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.json.client.JSONObject的用法示例。


在下文中一共展示了JSONObject.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getState

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public JSONArray getState() {

        JSONObject states = new JSONObject();

        for (IModule currModule : modules) {
            if (currModule instanceof StatefulModule) {
                StatefulModule statefulModule = (StatefulModule) currModule;
                states.put(statefulModule.getIdentifier(), statefulModule.getState());
            }
        }

        JSONArray statesArr = new JSONArray();
        statesArr.set(0, states);

        return statesArr;
    }
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:ItemBody.java

示例2: testShouldReturnIdentifierFromState

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public void testShouldReturnIdentifierFromState() throws Exception {
    // given
    String givenState = "givenState";
    String identifier = "identifier";

    JSONObject givenStateObject = new JSONObject();
    givenStateObject.put(EmpiriaState.STATE, new JSONString(givenState));
    givenStateObject.put(EmpiriaState.LESSON_IDENTIFIER, new JSONString(identifier));
    givenStateObject.put(EmpiriaState.TYPE, new JSONString("LZ_GWT"));

    // when
    EmpiriaState result = testObj.deserialize(givenStateObject);

    // then
    assertEquals(result.getState(), givenState);
    assertEquals(result.getLessonIdentifier(), identifier);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:EmpiriaStateDeserializerGWTTestCase.java

示例3: testShouldGetStateObject

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public void testShouldGetStateObject() {
    // given
    JavaScriptObject state = JavaScriptObject.createObject();
    JSONArray stateArray = new JSONArray();
    stateArray.set(0, new JSONObject(state));

    JSONObject stateObject = new JSONObject();
    stateObject.put("STATE", stateArray);

    JSONArray jsonArray = new JSONArray();
    jsonArray.set(0, stateObject);

    // when
    JavaScriptObject result = testObj.decodeState(jsonArray);

    // then
    assertEquals(result, state);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:ExternalStateEncoderGWTTestCase.java

示例4: toJSON

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public String toJSON() {

		JSONObject projectObject = new JSONObject();
		projectObject.put("version", new JSONString(getVersion()));
		projectObject.put("title", new JSONString(getTitle()));
		projectObject.put("description", new JSONString(getDescription()));
		projectObject.put("date", new JSONString(getDate()));		
		
		JSONArray layersArray = new JSONArray();
		int index = 0;
		for(ProjectVectorLayer projectLayer: vectors) {
			layersArray.set(index, projectLayer.getJSONObject());
			
			index++;
		}
		
		projectObject.put("vectors", layersArray);

		return projectObject.toString();
	}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:21,代码来源:Project.java

示例5: applyAlphaMapMaterial

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public void applyAlphaMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/Cesium_Logo_Color.jpg"));
    uniforms.put("channel", new JSONString("r"));

    JSONObject alphaMaterial = new JSONObject();
    alphaMaterial.put("type", new JSONString("AlphaMap"));
    alphaMaterial.put("uniforms", uniforms);

    JSONObject materials = new JSONObject();
    materials.put("alphaMaterial", alphaMaterial);

    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("vec3(1.0)"));
    components.put("alpha", new JSONString("alphaMaterial.alpha"));

    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);

    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:25,代码来源:Materials.java

示例6: applyWaterMaterial

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public void applyWaterMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("specularMap", new JSONString(GWT.getModuleBaseURL() + "images/earthspec1k.jpg"));
    uniforms.put("normalMap", new JSONString(GWT.getModuleBaseURL() + "images/waterNormals.jpg"));
    uniforms.put("frequency", new JSONNumber(10000.0));
    uniforms.put("animationSpeed", new JSONNumber(0.01));
    uniforms.put("amplitude", new JSONNumber(1.0));

    JSONObject fabric = new JSONObject();
    fabric.put("type", new JSONString("Water"));
    fabric.put("uniforms", uniforms);

    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:17,代码来源:Materials.java

示例7: setOption

import com.google.gwt.json.client.JSONObject; //导入方法依赖的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

示例8: getJsonObject

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
@Override
public String getJsonObject() {
	JSONObject config=new JSONObject();
	if(outputTables!=null) {
		config.put("outputTables", new JSONString(outputTables));
	}
	if(syncTables!=null) {
		config.put("syncTables", new JSONString(syncTables));
	}
	if(keepDays!=null) {
		config.put("keepDays", new JSONString(keepDays.toString()));
	}
	if(driftPercent!=null) {
		config.put("driftPercent", new JSONString(driftPercent.toString()));
	}
	JSONObject o=new JSONObject();
	o.put("id", new JSONString(HiveP.ID));
	o.put("config", config);
	return o.toString();
}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:21,代码来源:ProcesserType.java

示例9: toJSONObject

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public static JSONObject toJSONObject(FormData data) {
	
	if (data == null)
		return null;
	
	JSONObject obj = new JSONObject();
	
	obj.put("version", JsonUtil.toJSONObject(data.version));
	obj.put("main", JsonUtil.toJSONObject(data.main));
	obj.put("calculator", JsonUtil.toJSONObject(data.calculator));
	obj.put("passives", JsonUtil.toJSONObject(data.passives));
	obj.put("gems", JsonUtil.toJSONObject(data.gems));
	obj.put("equipment", JsonUtil.toJSONObject(data.specialItems));
	obj.put("skills", JsonUtil.toJSONObject(data.skills));
	obj.put("elementalDamage", JsonUtil.toJSONObject(data.elementalDamage));
	obj.put("skillDamage", JsonUtil.toJSONObject(data.skillDamage));
	obj.put("items", JsonUtil.toJSONObject(data.items));
	obj.put("hero", JsonUtil.toJSONObject(data.hero));
	obj.put("career", JsonUtil.toJSONObject(data.career));

	return obj;
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:23,代码来源:JsonUtil.java

示例10: setModelList

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public void setModelList( String layer, List<String> models ) {
	try {
		JSONArray jmodels = new JSONArray();
		for( int i = 0; i < models.size(); i++ ) {
			jmodels.set( jmodels.size(), new JSONString( models.get( i ) ) );
		}
		JSONArray array = json.get( "layers" ).isArray();
		for( int i = 0; i < array.size(); i++ ) {
			JSONObject o = array.get( i ).isObject();
			if( layer.equals( o.get( "name" ).isString().stringValue() ) ) {
				o.put( "models", jmodels );
				return;
			}
		}
	}
	catch( Exception ex ) {
		
	}
}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:20,代码来源:SimpleRiskCconf.java

示例11: plotHistogram

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public static void plotHistogram(JscriptRequest jspr, String div) {

        JSONObject jsonObj = new JSONObject();

        for (String p : jspr.keySet()) {
            if (p.equals("source")) {
                String url =  FFToolEnv.modifyURLToFull(jspr.getParam("source"));
                jsonObj.put("source", new JSONString(url));
            } else if (p.equals("data")) {
                jsonObj.put("data", new JSONString(jspr.getParam("data")));
            } else {
                if (jspr.getParam(p) != null) {
                    jsonObj.put(p, new JSONString(jspr.getParam(p)));
                }
            }
        }

        ReactUIWrapper.ReactJavaInterface reactInterface = getReactInterface();
        reactInterface.createHistogram(jsonObj, div);
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:21,代码来源:HistogramJSInterface.java

示例12: uploadFile

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
private void uploadFile() {
    JSONObject post = new JSONObject();
    String mime = form.getValueAsString(FIELD_MIMETYPE);
    if (mime != null && !mime.trim().isEmpty()) {
        post.put(FIELD_MIMETYPE, new JSONString(mime));
    }
    post.put(FIELD_PID, new JSONString(dobj.getPid()));
    String batchId = dobj.getBatchId();
    if (batchId != null) {
        post.put(FIELD_BATCHID, new JSONString(batchId));
    }
    post.put(DigitalObjectResourceApi.DISSEMINATION_ERROR, JSONBoolean.getInstance(true));
    uploader.setPostParams(post);
    uploader.startUpload();
    showUploading(true);
}
 
开发者ID:proarc,项目名称:proarc,代码行数:17,代码来源:UploadFile.java

示例13: serialize

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public JSONValue serialize(EmpiriaState empiriaState) {

        String typeFormat = empiriaState.getFormatType().name();
        String state = empiriaState.getState();
        String lessonIdentifier = empiriaState.getLessonIdentifier();

        JSONObject stateObject = new JSONObject();
        stateObject.put(EmpiriaState.TYPE, new JSONString(typeFormat));
        stateObject.put(EmpiriaState.STATE, new JSONString(state));
        stateObject.put(EmpiriaState.LESSON_IDENTIFIER, new JSONString(lessonIdentifier));

        return stateObject;
    }
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:14,代码来源:EmpiriaStateSerializer.java

示例14: getItemState

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
private JSONObject getItemState(StackMap<Integer, BookmarkProperties> map) {
    JSONObject obj = new JSONObject();
    for (Integer key : map.keySet()) {
        obj.put(key.toString(), map.get(key).toJSON());
    }
    return obj;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:BookmarkProcessorExtension.java

示例15: getJSONObject

import com.google.gwt.json.client.JSONObject; //导入方法依赖的package包/类
public JavaScriptObject getJSONObject() {
    JSONObject jsonEvent = new JSONObject();
    String type = getEventType();
    jsonEvent.put(EVENT_TYPE, new JSONString(type));

    JavaScriptObject jsPayload = getPayload().getJavaScriptObject();
    jsonEvent.put(EVENT_PAYLOAD, new JSONObject(jsPayload));

    return jsonEvent.getJavaScriptObject();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:11,代码来源:ExternalEvent.java


注:本文中的com.google.gwt.json.client.JSONObject.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。