2013-02-15 49 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)); 
    } 
} 
相关问题