3

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.

user405458
  • 1,107
  • 3
  • 24
  • 38

5 Answers5

2

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.

Nico Huysamen
  • 10,217
  • 9
  • 62
  • 88
  • thank you for the answer actually my problem is not with the progressbar component but how to retrieve values ​​from a server to be able to dynamically theme in the progressbar – user405458 Aug 01 '11 at 17:59
  • This must be dead. It doesn't even show up in the GWT Designer, and it gives an error `The import com.google.gwt.widgetideas cannot be resolved`. Try http://www.java2s.com/Code/Java/GWT/GWTprogressbar.htm instead. – Chloe Oct 08 '13 at 15:23
  • @Chloe - Wow, a down vote because an answer older than a year does not apply anymore... Well done... – Nico Huysamen Oct 08 '13 at 16:07
  • 1
    It didn't seem right for the top answer to be wrong. A random user would expect the most correct answer to be at the top. – Chloe Oct 08 '13 at 21:59
  • @Chloe - Do you even know what the gwt incubator is? It's a place where community can commit code that *might* get into the trunk. The source is still available at the link and can be used. Just because it does not 'show up' in the designer does not mean it cannot be used... – Nico Huysamen Oct 09 '13 at 05:39
1

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/

Bart
  • 11
  • 1
1

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.

Basanth Roy
  • 6,272
  • 5
  • 25
  • 25
0

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.

Chloe
  • 25,162
  • 40
  • 190
  • 357
0

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

Nick Siderakis
  • 1,961
  • 2
  • 21
  • 39