如何用GWT实现进度条?

发布于 2024-11-27 03:33:10 字数 139 浏览 0 评论 0原文

在 GWT 应用程序中,我有一个运行服务器端并使用 rpc(GWT 调度程序)调用的长进程,我希望以显示消息和总进度的进度条向客户端提供反馈。 我的问题是如何从服务器动态恢复消息和进度?

我对任何解决方案感兴趣,

提前感谢您的帮助。

In a GWT application, I have a long process that runs server side and invoked using rpc(GWT dispatcher) and I want to have a feedback to the Client as a progress bar showing messages and the total progress.
My question is how to recover messages and the progress dynamically from the server?

I'm interested in any solution

thank you in advance for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

红颜悴 2024-12-04 03:33:10

查看孵化器中的获取进度条。 这里是某人使用它的另一个示例。


更新

如果您想在客户端显示进度,您需要定期对服务器进行异步调用以获取进度值。换句话说,服务器需要在某处写入/存储其进度有多远。然后,客户端对服务器进行异步调用,服务器读取该值并将其发送回客户端,客户端可以更新进度条。

Have a look at the get progress bar in the incubator. Here is another example of someone using it.


UPDATE

If you want to display the progress on the client side, you will need to make async calls to the server periodically to fetch the progress value. In other words, the server needs to write / store somewhere how far it is with its progress. The client then makes an async call to the server, which reads that value and sends it back to the client, which can update the progress bar.

剩一世无双 2024-12-04 03:33:10

常规的异步调用应该可以做到这一点。但是您还需要从客户端实现某种轮询机制,以便它定期向服务器发送异步请求。

请参阅有关异步调用的教程
http://code.google.com/webtoolkit/doc/latest/tutorial /RPC.html

对于轮询机制,您应该能够通过简单的 while 循环来完成。在 while 循环内,继续调用 getStatus() 服务器调用,直到达到 100% 完成状态。

A regular Async call should do it. But you will also need to implement some sort of polling mechanism from the client side so that it will send an Async request to the server at periodic intervals.

See the tutorials on Async calls
http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html

For the polling mechanism, you should be able to do it with a simple while loop. Inside the while loop, keep calling the getStatus() server call till you get to 100% complete status.

客…行舟 2024-12-04 03:33:10

或者您可以使用通道 API。它在 Python 和 Java 中都可用(可能还有其他受支持的叶猴)。 https://developers.google.com/appengine/docs/java/channel/

Or you can use the Channel API. It is available in both Python and Java (and probably the other supported langurs as well). https://developers.google.com/appengine/docs/java/channel/

白馒头 2024-12-04 03:33:10

查看进度同步器进度条 来自 upload4gwt 可能会给你一些想法。

Taking a look at the progress syncer and progress bar from upload4gwt might give you some ideas.

海未深 2024-12-04 03:33:10

http://www.java2s.com/Code/Java/GWT/GWTprogressbar.htm

您必须使用计时器定期轮询服务器,并将进度计算保留在服务器上。

http://www.java2s.com/Code/Java/GWT/GWTprogressbar.htm

You must use a timer to periodically poll the server, and keep the progress calculation on the server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文