How to Implement progressbar with GWT?

2019-05-13 05:35发布

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.

5条回答
相关推荐>>
2楼-- · 2019-05-13 05:57

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.

查看更多
别忘想泡老子
3楼-- · 2019-05-13 05:57

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.

查看更多
【Aperson】
4楼-- · 2019-05-13 06:16

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

查看更多
Anthone
5楼-- · 2019-05-13 06:19

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.

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-05-13 06:19

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/

查看更多
登录 后发表回答