GWT可视化API数据表序列化 [英] GWT Visualisation API DataTable Serialization

查看:101
本文介绍了GWT可视化API数据表序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图按照本教程关于如何连接到GWT中的数据库,但不是创建登录程序,而是试图从我的数据库中检索GWT Visulation DataTable,以便我可以创建一个Annotated TimeLine 。我已经走得很远了,但我碰到了我无法弄清的最后一堵墙。与tut不同,我不是从RPC返回一个简单的User类,而是一个复杂的DataTable。问题是这个DataTable必须可以通过GWT标准进行序列化。有没有简单的方法来实现这一点?



为安全起见,我使用RPC而不是Query系统。我不希望人们能够查看我的javascript并查看我的查询等。

谢谢。



更新:回到问题后,我发现DataTable是一个JavaScriptObject,可能从来不打算在服务器端进行。所以,新的问题是,什么是手动使DataTable成为serlizable的最佳方式,然后什么是重新创建客户端的最佳方式。再次感谢!

解决方案

好的,我自己计算出来(sorta),所以我想我会在这里发布答案,其他的恰好在以后出现同样的问题。



简而言之,这是不可能的。 DataTable是JSO对象,在GWT当前版本(1.6something)中,它不能序列化这些类型的对象。我所要做的就是将我的数据分解成一系列ArrayLists,并将它们放在Temray对象中。然后可以将该对象序列化并发送到客户端。这个问题是,你必须在客户端构造DataTable对象。



如果其他人碰巧提出了一个更好的主意,我仍然有兴趣找出答案。



谢谢。



<-E>


I am trying to follow this tutorial on how to connect to a database in GWT, but instead of creating a login program, I am trying to retrieve a GWT Visulation DataTable from my DB so that I can then create a Annotated TimeLine. I have gotten very far, but I hit the final wall I can't figure out. Unlike the tut, I am not returning a simple User class from the RPC, but a complex DataTable. The problem is that this DataTable must be serializable by GWT standards. Is there any easy way for accomplish this?

I am using a RPC, instead of a Query system for security reasons. I don't want people to by able to look at my javascript and see my queries and such.

Thank you.

UPDATE: After going back to the problem I have found that DataTable is a JavaScriptObject and was probably never meant to be made on the server side. So new question, What is the best way to manually make DataTable into something serlizable and then what is the best way to remake it client side. Thanks Again!

解决方案

Ok so I figured it out myself (sorta) so I thought I would post the answer here in case someone else happens to have the same problem later.

The answer in short that is impossible. DataTable is a JSO object, and in GWT current release (1.6something) it can not serialize those types of objects. What I had to do was break down my data into a series of ArrayLists and hold those in a temperay Object. That object can then be serialized and sent to the client side. The problem with this is that you must then construct the DataTable object on the client side.

If anyone else happens to come up with a better idea I would still be interested on finding out.

Thanks.

-Eric

这篇关于GWT可视化API数据表序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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