Java GWT 的最佳数据绑定解决方案
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/396786/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Best data binding solution for GWT
提问by Steve Buikhuizen
Have you ever used one of the many half-baked data binding solutions for GWT? If so, how well did it work?
您是否曾经为 GWT 使用过许多半生不熟的数据绑定解决方案之一?如果是这样,它的效果如何?
I'd like to stop rolling my own bindings for GWT but there's no clear winner in the data binding space.
我想停止为 GWT 滚动我自己的绑定,但在数据绑定领域没有明显的赢家。
I'd prefer to use something with a future e.g. GWT Incubator but there's nothing there yet.
我更喜欢使用未来的东西,例如 GWT Incubator,但目前还没有。
I use GWTDesigner and love it but it doesn't seem to have a solution for this either.
我使用 GWTDesigner 并喜欢它,但它似乎也没有解决方案。
Its a pretty fundamental missing feature. Do you know if the GWT team plans to add support for this? In that case, maybe I'll wait.
它是一个非常基本的缺失功能。您知道 GWT 团队是否计划增加对此的支持吗?那样的话,也许我会等。
Thanks
谢谢
回答by maerch
i have just read it a few minutes ago in a mailing list that a so called GWTEventService 1.0has been released. I am not completely sure, if that is what you want, but it sounds promising for me.
几分钟前,我刚刚在一个邮件列表中读到了一个所谓的GWTEventService 1.0已经发布。我不完全确定,如果这就是你想要的,但这对我来说听起来很有希望。
Let me cite the site:
让我引用该网站:
GWTEventService is an event-based client-server communication framework. It uses GWT-RPC and the Comet / server-push technique. The client side offers a high-level API with opportunities to register listeners to the server like to a GUI component. Events can be added to a context/domain on the server side and the listeners on the client side get informed about the incoming events. The server side is completely independent of the client implementation and is highly configurable. Domains can be defined to decide which events are important for the different contexts.
GWTEventService 是一个基于事件的客户端-服务器通信框架。它使用 GWT-RPC 和 Comet / 服务器推送技术。客户端提供了一个高级 API,可以像 GUI 组件一样将侦听器注册到服务器。事件可以添加到服务器端的上下文/域中,客户端的侦听器会收到有关传入事件的通知。服务器端完全独立于客户端实现,并且是高度可配置的。可以定义域来决定哪些事件对不同的上下文很重要。
Maybe this is a solution for you. I will give it a try.
也许这对你来说是一个解决方案。我会试试看。
回答by Edwin
SmartGWT ( http://www.jroller.com/sjivan/entry/smartgwt_1_0_released) is a GWT API for the product smartclient. They have a good databinding solution, because it was built with server side integration in mind. But the downside is that it's not a pure native GWT framework. It's a JSNI wrapper around another product (Smart Client Framework).
SmartGWT ( http://www.jroller.com/sjivan/entry/smartgwt_1_0_released) 是产品 smartclient 的 GWT API。他们有一个很好的数据绑定解决方案,因为它是在考虑服务器端集成的情况下构建的。但缺点是它不是一个纯粹的原生 GWT 框架。它是另一个产品(智能客户端框架)的 JSNI 包装器。
回答by Glenn
Gilead, formerly Hibernate4GWT, "defines a PersistentRemoteService class, inheriting from RemoteServiceServlet to handle seamlessly persistent entity management." It's been under active development for several years now.
Gilead,前身为 Hibernate4GWT,“定义了一个 PersistentRemoteService 类,从 RemoteServiceServlet 继承来处理无缝的持久实体管理。” 几年来,它一直在积极开发中。
回答by Chii
if its data binding of the UI to models (i.e. a textbox bound to a property of some model object), then GWT has a library feature called the UIBinder. Its not quite ready for production use yet apparently (thus unreleased), but the google wave team is using it (and looks like its working pretty good). Checkout this page for some info http://code.google.com/p/google-web-toolkit-incubator/wiki/UiBinder
如果它的 UI 数据绑定到模型(即绑定到某个模型对象的属性的文本框),那么 GWT 有一个称为 UIBinder 的库功能。它显然还没有完全准备好用于生产(因此未发布),但 google wave 团队正在使用它(看起来它工作得很好)。查看此页面以获取一些信息http://code.google.com/p/google-web-toolkit-incubator/wiki/UiBinder
If you are talking about GWT RPC returning model objects from the server (such as hibernate objects), Gileadas mentioned elsewhere is probably worth looking at - though i've never had any personal experience.
如果您谈论的是 GWT RPC 从服务器返回模型对象(例如休眠对象),那么其他地方提到的Gilead可能值得一看 - 尽管我从未有过任何个人经验。
There is another method, and that is using Javascript Object Overlays to turn json into their equivalent class models for use in GWT (good for frameworks like grails that can churn out json easily, but their domain model is not RPC compatible). check out these blog posts for some tips on that http://raibledesigns.com/rd/entry/json_parsing_with_javascript_overlay(and http://googlewebtoolkit.blogspot.com/2008/08/getting-to-really-know-gwt-part-2.html)
还有另一种方法,那就是使用 Javascript 对象覆盖将 json 转换为它们在 GWT 中使用的等效类模型(适用于像 grails 这样可以轻松生成 json 的框架,但它们的域模型与 RPC 不兼容)。查看这些博客文章,了解有关http://raibledesigns.com/rd/entry/json_parsing_with_javascript_overlay(以及http://googlewebtoolkit.blogspot.com/2008/08/getting-to-really-know-gwt-part -2.html)
回答by Christoph
check out the eclipse databinding 3.5 for gwt
回答by Christoph
use google-web-toolkit-incubator http://code.google.com/p/google-web-toolkit-incubator/wiki/Downloads?tm=2for databinding. uface doesnt have a compiled version out, and their source code DOESNT compile following their directions. (entry right above this one is referring to uface).
使用 google-web-toolkit-incubator http://code.google.com/p/google-web-toolkit-incubator/wiki/Downloads?tm=2进行数据绑定。uface 没有编译版本,并且他们的源代码不会按照他们的指示编译。(此条目正上方的条目指的是 uface)。
回答by Andrew
You can check out http://code.google.com/p/gwt-pectin/
回答by Trung
Check out the gwtXP at http://www.gdevelop.com/w/gwtxp/.
在http://www.gdevelop.com/w/gwtxp/查看 gwtXP 。
gwtXP allows you to declare UI elements, data binding and action handlers in XML. Examples:
gwtXP 允许您在 XML 中声明 UI 元素、数据绑定和操作处理程序。例子:
- Declare UI elements: <g:label text="User Name: "/>
- Declare data binding (uses Eclipse data binding): <g:textBox text="${user.userName}"/>
- Support both value binding and list binding.
- Declare action handlers: <g:button text="Save" onClick="#{saveUser}"/>
- 声明 UI 元素:<g:label text="用户名:"/>
- 声明数据绑定(使用 Eclipse 数据绑定):<g:textBox text="${user.userName}"/>
- 支持值绑定和列表绑定。
- 声明动作处理程序:<g:button text="Save" onClick="#{saveUser}"/>
Updated on March 06 20010: See the post at http://www.gdevelop.com/w/blog/2010/03/06/data-binding-in-gwt/
20010 年 3 月 6 日更新:请参阅http://www.gdevelop.com/w/blog/2010/03/06/data-binding-in-gwt/ 上的帖子
回答by Jon Vaughan
In case of any doubt about this nowadays, you should use GWT Editors:
如果现在对此有任何疑问,您应该使用 GWT 编辑器:
http://www.gwtproject.org/doc/latest/DevGuideUiEditors.html
http://www.gwtproject.org/doc/latest/DevGuideUiEditors.html
At some point in the future there will be support for jsr 303 validation too.
在未来的某个时候,也会支持 jsr 303 验证。
回答by Arnaud Tournier
I suggest you try HexaBinding, which is non invasive and only focused on dara binding. Here is the link : https://github.com/ltearno/hexa.tools/blob/master/hexa.binding/README.md
我建议你尝试 HexaBinding,它是非侵入性的,只专注于 dara 绑定。这是链接:https: //github.com/ltearno/hexa.tools/blob/master/hexa.binding/README.md