2013-02-15 71 views
1

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

<!-- 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。那可能嗎?爲了達到這個目的,從元素移植到它自己的模塊是否會相當容易?感謝您的幫助。

+0

僅供參考,我們就會將JSON和集合了元素的進入自己的模塊。這應該有望在今年晚些時候在GWT 2.6中發佈。 – 2013-02-15 10:10:03

+0

之類的。謝謝。 – Ezward 2013-02-16 17:14:26

回答

4

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

<inherits name="elemental.Elemental"/> 

elemental example在GWT樹幹。

0

我無法獲得GWT元素項目silvercomet或簡單在FireFox中執行。

但是,下面的簡單元素測試代碼在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)); 
    } 
} 
相關問題