I’m trying to add a web ui to an existing java/swing application.
There are a number of tables which are being updated a modified constantly by the java server (no database, just pojos).
I need the UI to update on a regular basis to show the new data.
I’ve been trying to use ListGrid but have not found a way to smoothly have it refresh itself. I can have it do a fetchData() based on a timer but that doesn’t redraw the screen.
I’ve tried doing a setData() in the callback from the fetchData() but that causes a complete redraw/resize of the ListGrid contents.
If I invoke invalidateCache() it erases the screen rather than merely overwriting it causing unacceptable appearance (flicker/artifacts).
I just want the contents of the cells to be redrawn, not to have the entire widget erased and repainted.
Am I missing something in the framework or is there really no way to do this using the built-in datasource?
Maybe I should go back to Comet/GWT?
setData() refreshes just the cells and will not resize the grid, unless of course you’ve told it to autosize, in which case it will resize the grid. So you may have also had some other code that was doing extra work?
Thanks for the quick response!
Sure enough, there was a place that enabled autosizing.
Now I’m onto my next issue.. figuring out why the first load of data displays properly but after that the rows are empty and it say ‘No items to show’
Here’s the snippet that gets called by my refresh timer:
public void refresh()
{
mDataSource.fetchData(new Criteria(),
new DSCallback()
{
@Override
public void execute(final DSResponse aResponse,
final Object aRawData,
final DSRequest aRequest)
{
setData(aResponse.getDataAsRecordList());
}
});
}
I’m guessing that the getDataAsRecordList() isn’t quite the transformation I’m looking for.
I just noticed that the first fetch asks for rows 0..75 but the subsequent calls to fetchData() result in a fetch that asks for rows 0..-1
Sounds like there’s simply no data in the response - you can check this in the RPC tab.
It looks like the fetchData() is querying for all records instead of just the visible ones. I set the ListGrid to setAutoFetchData(true), do I need to specify something in the Criteria that’s being passed to fetchData()?