本文整理汇总了Java中com.google.gwt.core.client.JavaScriptObject类的典型用法代码示例。如果您正苦于以下问题:Java JavaScriptObject类的具体用法?Java JavaScriptObject怎么用?Java JavaScriptObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaScriptObject类属于com.google.gwt.core.client包,在下文中一共展示了JavaScriptObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldReturnEncodedState
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
@Test
public void shouldReturnEncodedState() throws Exception {
// GIVEN
JavaScriptObject givenStateObject = mock(JavaScriptObject.class);
JSONArray encodedState = mock(JSONArray.class);
when(externalApiProvider.getExternalApi().getStateFromExternal()).thenReturn(givenStateObject);
when(stateEncoder.encodeState(givenStateObject)).thenReturn(encodedState);
// WHEN
JSONArray result = testObj.getState();
// THEN
assertThat(result).isEqualTo(encodedState);
verify(externalStateSaver).setExternalState(givenStateObject);
}
示例2: 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;
}
示例3: peopleLookup
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
public static void peopleLookup(String query, final JavaScriptObject callback, String options) {
final Lookup lookup = new Lookup();
if (query != null && !query.trim().isEmpty())
lookup.setQuery(query);
lookup.addValueChangeHandler(new ValueChangeHandler<PersonInterface>() {
@Override
public void onValueChange(ValueChangeEvent<PersonInterface> event) {
if (event.getValue() != null)
lookup.fireCallback(callback,
event.getValue().getId(),
event.getValue().getFirstName(),
event.getValue().getMiddleName(),
event.getValue().getLastName(),
event.getValue().getEmail(),
event.getValue().getPhone(),
event.getValue().getAcademicTitle(),
event.getValue().getName());
}
});
lookup.setOptions(options);
lookup.center();
}
示例4: fromJsObject
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
public static FlowActivityEvent fromJsObject(JavaScriptObject jsObject) {
String currTypeString = getTypeJs(jsObject);
final String groupIdentifierString = getGroupIdentifierJs(jsObject); // NOPMD
if (currTypeString != null) {
currTypeString = currTypeString.trim().toUpperCase();
for (FlowActivityEventType currType : FlowActivityEventType.values()) {
if (currType.toString().equals(currTypeString)) {
return new FlowActivityEvent(currType, new GroupIdentifier() { // NOPMD
@Override
public String getIdentifier() {
return groupIdentifierString;
}
});
}
}
}
return null;
}
示例5: 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);
}
示例6: createJsObject
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private native JavaScriptObject createJsObject()/*-{
var obj = [];
var instance = this;
obj.getTimeTotal = function () {
return [email protected]nDataCarrier::timeTotal;
}
obj.getVariableTotalValue = function () {
return [email protected]nDataCarrier::timeTotal;
}
obj.getDoneTotal = function () {
return [email protected]nDataCarrier::doneTotal;
}
obj.getTodoTotal = function () {
return [email protected]nDataCarrier::todoTotal;
}
obj.getVisitedCount = function () {
return [email protected]nDataCarrier::visitedCount;
}
return obj;
}-*/;
示例7: createJsObject
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private native JavaScriptObject createJsObject()/*-{
var obj = [];
var instance = this;
obj.isShowToc = function () {
return [email protected]FlowOptions::showToC;
}
obj.isShowSummary = function () {
return [email protected]FlowOptions::showSummary;
}
obj.getPageItemsDisplayMode = function () {
return [email protected]FlowOptions::getItemsDisplayModeString()();
}
obj.getActivityMode = function () {
return [email protected]FlowOptions::getActivityModeString()();
}
return obj;
}-*/;
示例8: getDesktopOptions
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private native final JavaScriptObject getDesktopOptions() /*-{
var options = {
link: false,
indent: false,
outdent: false,
unlink: false,
remove: false,
source: false,
rule: false
};
return options;
}-*/;
示例9: getOptions
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
/**
* Returns the plugin options, if exist.
* @param pluginId plugin id.
* @return java script object used to configure the plugin or <code>null</code> if not exist.
* @throws InvalidPluginIdException occurs if the plugin id is invalid.
*/
public JavaScriptObject getOptions(String pluginId) throws InvalidPluginIdException{
// checks the plugin id
PluginIdChecker.check(pluginId);
// returns the configuration creating a key by plugin id.
return getValue(new StandardKey(pluginId));
}
示例10: callImportInitialItemIndex
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private native int callImportInitialItemIndex(JavaScriptObject playerJsObject)/*-{
var itemIndex = -1;
if (typeof playerJsObject.importInitialItemIndex == 'function') {
var importedIndex = playerJsObject.importInitialItemIndex();
if (!isNaN(importedIndex)) {
itemIndex = parseInt(importedIndex);
}
}
return itemIndex;
}-*/;
示例11: addObjectFunctions
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private static native JavaScriptObject addObjectFunctions(JavaScriptObject jso, String className)/*-{
var instanceClassName = className;
jso.getClassName = function () {
return instanceClassName;
}
return jso;
}-*/;
示例12: addLockableFunctions
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private static native JavaScriptObject addLockableFunctions(JavaScriptObject jso, Object moduleInstance)/*-{
var instance = moduleInstance;
jso.lock = function () {
i[email protected]::lock(Z)(true);
}
jso.unlock = function () {
[email protected]::lock(Z)(false);
}
return jso;
}-*/;
示例13: addResetableFunctions
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
private static native JavaScriptObject addResetableFunctions(JavaScriptObject jso, Object moduleInstance)/*-{
var instance = moduleInstance;
jso.reset = function () {
[email protected]e::reset()();
}
return jso;
}-*/;
示例14: processSingleAction
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
@Override
public void processSingleAction(FeedbackAction action, FeedbackMark mark) {
ShowTextAction textAction = (ShowTextAction) action;
feedbackCounter.add(textAction);
Element element = textAction.getContent().getValue();
Widget widget = inlineBodyGenerator.generateInlineBody(element);
feedbackPresenter.setFeedbackContent(widget, mark);
JavaScriptObject mathJaxCallback = createCallback(textAction);
mathJaxNative.renderMath(mathJaxCallback);
}
示例15: getExternalBookmarks
import com.google.gwt.core.client.JavaScriptObject; //导入依赖的package包/类
native JavaScriptObject getExternalBookmarks()/*-{
var playerJso = [email protected]l.bookmark.BookmarkProcessorExtension::playerJsObject;
if (typeof playerJso != 'undefined' && playerJso != null && typeof playerJso.getExternalBookmarks == 'function') {
return playerJso.getExternalBookmarks();
}
return null;
}-*/;