简体   繁体   English

GWT,如何在gwt中使用js库(如jqplot)

[英]GWT, How to use js libraries like jqplot in gwt

I am starting to learn GWT. 我开始学习GWT。 For now I have been using Spring, playframework, where I have been using JavaScript libraries. 目前,我一直在使用Spring,playframework和JavaScript库。 For example, I wrote my own JS library to print trees. 例如,我编写了自己的JS库来打印树。

Now I wonder, in case of lack some functionality in gwt widgets, can I import/ convert/ adopt my JS library to work inside in gwt library? 现在我想知道,如果gwt小部件中缺少某些功能,我可以导入/转换/采用我的JS库以在gwt库中工作吗?

I found some information about it, but none of them was new, so I am afraid that they will be outdated. 我找到了一些有关它的信息,但是它们都不是新的,因此我担心它们将过时。

Base widgets aren't plenty. 基本的小部件并不多。 Everybody discouraged me from using smartgwt, and gwt ext isn't open sourced. 每个人都劝阻我不要使用smartgwt,而且gwt ext不是开源的。

Please give me some thoughts, base on your experience. 请根据您的经验给我一些想法。

You can use JSNI . 您可以使用JSNI

Of course, it is not as easy as using js libraries directly in js code, but is very flexible. 当然,它不像直接在js代码中使用js库那样容易,但是非常灵活。 After you integrate the desired API parts from the underlying js library, you can invoke it with GWT (Java), thus utilizing the best from both worlds. 从基础js库中集成所需的API部分后,可以使用GWT(Java)调用它,从而利用两全其美的优势。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM