當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。