我正在研究GWT元素作为在GWT中访问java dom的更快方法。但是,当我查看maven依赖项的源代码时,我看到的只是js叠加层。例如:
public class JsNode extends JsElementalMixinBase implements Node {
protected JsNode() {}
public final native JsNamedNodeMap getAttributes() /*-{
return this.attributes;
}-*/;
public final native String getBaseURI() /*-{
return this.baseURI;
}-*/;
public final native JsNodeList getChildNodes() /*-{
return this.childNodes;
}-*/;
public final native JsNode getFirstChild() /*-{
return this.firstChild;
}-*/;
public final native JsNode getLastChild() /*-{
return this.lastChild;
}-*/;
....
这与默认的gwt xml dom中的内容相差甚远。我在这里缺少什么?
谢谢!
答案 0 :(得分:2)
元素v1,不再定期更新,使用JSO和JSNI,因为那是当时唯一的选择。
Elemental v2使用JsInterop,这是一种从Java代码中描述JS对象的新的,面向未来的方法。来源(和问题跟踪)位于https://github.com/google/elemental2/。你可以通过搜索groupId com.google.elemental2
来找到maven中的elemental2:http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.google.elemental2%22
https://github.com/google/jsinterop-generator是用于自动生成elemental2的工具,理论上可以在任何其他JS库上使用,以让GWT应用程序使用它。我个人没有太多运气让它运转起来,但该工具的主要目的仍然是生成elemental2源,所以当人们使用它时,这将继续改进。