Refreshing POJO often updated

Hi guys,

I’m learning the framework since few days and I have a question about the design of my app.

I have few (10~30) POJOs (Thread) doing some stuffs and I would like render their status on a Table.
These POJOs are backed in a database.

Their state (could) change every 5 seconds for the faster, every few minutes for the slower.

The prototype of my app (w/o Vaadin) was (really) simple and I wrote a simple HTML renderer where I force a refresh every 15sec (through a simple )

Now that I need to go further, I thought about linking the Table to a BeanItemContainer and use Add-on “Refresher” to refresh the client side “in time”.

Is there a better way ?


Depending on the update frequency, either a polling solution using Refresher as you suggested or a push-based solution (with the ICEPush add-on) could be better.

If you change the Item Properties in the table using the Vaadin data API, the changes automatically cause a notification for the table to update itself. If you change the POJOs directly, you might need to trigger a refresh of the table. A full refresh can be achieved e.g. by setting the data source of the table IIRC, but you can probably find examples of that on the forum.

Note that any operations performed in background threads that may affect the UI of a Vaadin application must be synchronized to the Application instance.

Right, I read that yesterday in a Sample delivery.

Thanks Henri, I’ll try that.