Problem in paintContent(PaintTarget target)...

Hi all,

I’m trying to draw a graph using Vaadin & GWT & having some trouble.
The scenario is as follows.

  1. I get some initial data for the graph
    (say x1, y1, x2, y2 coordinates)
    & i set them using the
    setValue()
    method. At this point the
    paintContent(PaintTarget target)
    method is called & data is passed to the client & client draws the coordinates nicely.

  2. Then I get some secondary data (coordinates) every 50 milliseconds & again I set them using the
    setValue()
    method. And at this point the
    paintContent(PaintTarget target)
    method is NOT called.

    However, If I click a button or another component in the server-side, then the new data is sent to the client & graph is drawn with the new data.

I tried calling
requestRepaint()
method after setting my new data & it didn’t work out too. :frowning: :wacko:

Is there a way I can call
paintContent(PaintTarget target)
method after I set my new data?

Any help is greatly appreciated.

Thanks,
Asela.

Best guess is that you are doing the updating in a background thread and must use Refresher or ICEPush to ensure that the server can get the changes sent to the client. Otherwise the changes are just made on the server side and not sent to the client until the user does something that causes the client to contact the server (like push a button). There should be a lot of threads about this in the forum.

Hi Artur,

Thanks for the quick reply.
It was my fault that I failed to mention that I have already used the Refresher & it worked fine.

But there was a problem in using the refresher, since it was taking a lot of CPU usage.
Therefore I’m trying to NOT to use Refresher or IcePush.

Is there any other way to accomplish the task without using Refresher or IcePush?

Thanks,
Asela.

In short, no. You can’t get data to the client without sending the data.

The refresher itself does not use any CPU but if you set the polling interval to low it will make a lot of requests. Especially if you have many simultaneous users it can cause a high load. Make the update intervals longer and you will get less server traffic. 50ms is a really short time and will probably cause the client to constantly check for updates, fetch the updates and update the component on screen.