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


Java JavaScriptObject类代码示例

本文整理汇总了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);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:ExternalInteractionStateProviderTest.java

示例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;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:24,代码来源:ModuleJsSocketFactory.java

示例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();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:23,代码来源:Lookup.java

示例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;
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:20,代码来源:FlowActivityEvent.java

示例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);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:ExternalStateEncoderGWTTestCase.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:21,代码来源:SessionDataCarrier.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:FlowOptions.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:13,代码来源:TextEditorDesktopOptions.java

示例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));
}
 
开发者ID:pepstock-org,项目名称:Charba,代码行数:13,代码来源:Plugins.java

示例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;

}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:13,代码来源:PlayerCoreApiExtension.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:ModuleJsSocketFactory.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:11,代码来源:ModuleJsSocketFactory.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:ModuleJsSocketFactory.java

示例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);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:13,代码来源:TextActionProcessor.java

示例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;
}-*/;
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:BookmarkProcessorExtension.java


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