如何在GWT应用程序中集成或调用或与第三方小部件接口? [英] how to integrate or call or interface with a 3rd party widget within a GWT app?

查看:110
本文介绍了如何在GWT应用程序中集成或调用或与第三方小部件接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在GWT制作一个应用程序。它就像一个仪表板,并且将不在这些小部件中。

I am making an app in GWT. It is like a dashboard and will have out of the widgets.

现在,当我们发布这个时,有一个用例可能是客户想要创建自己的GWT小部件,并在仪表板应用程序中使用它。

Now when we ship this out, there is a use case that the customer might want to create their own GWT widget and use this in the dashboard app.

据我所知,他们将无法做到这一点,因为我们无法提供编译所需的源代码整个应用程序再次一旦它们的widget /模块的标签进入我的应用程序的gwt.xml文件。

As I understand it, they will not be able to do this since we cannot ship our source code which is needed to compile the whole app again once tag of their widget/module gets into the gwt.xml file of my app.

我不能使用其他GWT的任何东西来制作这个仪表板。他们的小部件可以是一个闪存堆图,一个jquery小部件/插件,另一个GWT模块,一个从后端呈现可视化的jsp页面。

I cannot use anything other that GWT to make this dashboard. And their widget could be say a flash heapmap, a jquery widget/plugin, another GWT module, a jsp page that renders a visualization from back end.

到目前为止,我的想法已经在我的应用程序中提供了一个小部件,它是一个Iframe格式的包装器,并调用它们的主页面(它们将提供url),并且有一个API来让我的应用程序和它们的小部件交谈。

So far my thoughts have been to provide a widget in my app which is a wrapper in the form of an Iframe and call their main page (they will provide url), and have an api to let my app and their widget talk.

但是我想知道是否还有其他更好的方法?

But I would like to know if there are other / better approaches?

推荐答案

您的应用程序的封闭源代码是多少(可以将自定义JS / HTML添加到页面中?),您可以始终为某些自定义仪表板小部件提供本机Javascript(JSNI)API。我想到的最简单的解决方案将是JSNI方法,客户可以调用该方法来设置所述小部件的HTML内容。这个方法允许他们使用各种选项,比如JQuery小部件,他们自己的GWT小部件生成的HTML,甚至是一个指向他们的JSP页面的IFrame ......然后你可以提供额外的JSNI API方法,这些方法可以让他们与之交互您的应用/小部件也以其他方式。这将比IFrame方法更好,因为您不必处理跨域脚本安全问题。

Depending on how closed source your application is (can custom JS/HTML be added to pages?), you could always provide a native Javascript (JSNI) API for some custom dashboard widgets. The simplest solution I'm thinking of would be a JSNI method which your customers could call to set the HTML content of said widget. This method would allow them to use a variety of options such as JQuery widgets, their own GWT widget generated HTML or even an IFrame pointing to their JSP pages etc... You could then provide additional JSNI API methods which would allow them to interact with your app/widget in other ways as well. This would be better than the IFrame method because you wouldn't have to deal with cross domain scripting security issues.

这篇关于如何在GWT应用程序中集成或调用或与第三方小部件接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆