本文整理匯總了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);
}