本文整理汇总了Java中com.google.gwt.core.client.JavaScriptObject.createObject方法的典型用法代码示例。如果您正苦于以下问题:Java JavaScriptObject.createObject方法的具体用法?Java JavaScriptObject.createObject怎么用?Java JavaScriptObject.createObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.client.JavaScriptObject
的用法示例。
在下文中一共展示了JavaScriptObject.createObject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSocketObject
import com.google.gwt.core.client.JavaScriptObject; //导入方法依赖的package包/类
public static JavaScriptObject createSocketObject(Object module) {
JavaScriptObject jso = JavaScriptObject.createObject();
jso = addObjectFunctions(jso, module.getClass().getName());
if (module instanceof Lockable) {
jso = addLockableFunctions(jso, module);
}
if (module instanceof Resetable) {
jso = addResetableFunctions(jso, module);
}
if (module instanceof Activity) {
jso = addActivityFunctions(jso, module);
}
if (module instanceof IUniqueModule) {
jso = addUniqueFunctions(jso, module);
}
return jso;
}
示例2: testShouldGetStateObject
import com.google.gwt.core.client.JavaScriptObject; //导入方法依赖的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);
}
示例3: decodeState
import com.google.gwt.core.client.JavaScriptObject; //导入方法依赖的package包/类
public JavaScriptObject decodeState(JSONArray array) {
if (array.size() > 0) {
return getState(array.get(0));
}
return JavaScriptObject.createObject();
}
示例4: getStyle
import com.google.gwt.core.client.JavaScriptObject; //导入方法依赖的package包/类
private JavaScriptObject getStyle(com.google.gwt.dom.client.Element element) {
Element xmlElement = XMLParser.createDocument().createElement(element.getNodeName().toLowerCase());
Map<String, String> styles = styleSocket.getStyles(xmlElement);
JavaScriptObject stylesJsArray = JavaScriptObject.createObject();
for (String currKey : styles.keySet()) {
JSArrayUtils.fillArray(stylesJsArray, currKey, styles.get(currKey));
}
return stylesJsArray;
}
示例5: testShouldUnwrapStateFromArrayToJSO
import com.google.gwt.core.client.JavaScriptObject; //导入方法依赖的package包/类
public void testShouldUnwrapStateFromArrayToJSO() {
// given
JavaScriptObject state = JavaScriptObject.createObject();
JSONObject obj = new JSONObject(state);
JSONArray jsonArray = new JSONArray();
jsonArray.set(0, obj);
// when
JavaScriptObject jsObjectResult = testObj.decodeState(jsonArray);
// then
assertEquals(state, jsObjectResult);
}