簡體   English   中英

是否可以在非元素應用程序中使用GWT元素集合?

[英]Is it possible to use the GWT Elemental collections in a non-elemental app?

是否可以在非元素GWT應用程序中使用元素集合(elemental.util.Collections,elemental.util.ArrayOfInt,elemental.util.MapFromStringTo等)。 我已經在使用這些模塊了:

<!-- Inherit the core Web Toolkit stuff.                        -->
<inherits name='com.google.gwt.user.User' />

<!-- Inherit the RequestBuilder stuff.                        -->
<inherits name="com.google.gwt.http.HTTP" />


<!--  Inherit GQuery -->
<inherits name='com.google.gwt.query.Query' />

但是我想開始使用輕量級元素集合而不是Java ArrayList和HashMap。 那可能嗎? 為此目的從Elemental移植到它自己的模塊中是否相當容易? 謝謝你的幫助。

當然,您所要做的就是在模塊描述符( *.gwt.xml )中包含以下聲明:

<inherits name="elemental.Elemental"/>

請參閱GWT中繼上的基本示例

我無法在FireFox中獲得GWT Elemental項目的銀色或簡單的執行。

但是,下面簡單的元素測試代碼在FireFox和Chrome中以及gwt用戶和http模塊中執行。

模塊文件。

<module rename-to="HelloElemental">
    <inherits name="elemental.Elemental" />
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.google.gwt.user.User' />
    <!-- Inherit the RequestBuilder stuff. -->
    <inherits name="com.google.gwt.http.HTTP" />
    <add-linker name="xsiframe" />
    <set-configuration-property name="devModeRedirectEnabled" value="true" />
    <entry-point class="com.google.silvercomet.client.Main" />
</module>

入境點類 -

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Window;

import elemental.util.ArrayOf;
import elemental.util.Collections;

public class Main implements EntryPoint
{
    public void onModuleLoad()
    {
        ArrayOf<String> items = Collections.arrayOf();
        items.insert( 0, "First" );
        Window.alert( items.get( 0 ) );
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM