incremental content provider [message #502629] |
Wed, 09 December 2009 03:48  |
Eclipse User |
|
|
|
Hi all,
in my project I've got a few table views that display data loaded from a database.
Now my content providers do all the same thing, that is:
@Override
public Object[] getElements(Object inputElement) {
// load the data from the DAO
this.loadDataFromDAO();
// provide all the objects
return this.dataModelList.toArray();
}
that loads all the data from the database and place it into a collection (dataModelList) and then returns it as array. This is fine if the list is short, but when the list is very long I have to wait a lot before all the data is loaded, and maybe the view shows only the first ten rows in the table. So my question is if there is a way to load data on demand, so the view that notifies the content provider to provide the next rows when the table is scrolled and such rows are visibile.
Any clue?
Thanks
|
|
|
Re: incremental content provider [message #502809 is a reply to message #502629] |
Wed, 09 December 2009 13:42  |
Eclipse User |
|
|
|
> the table. So my question is if there is a way to load data on demand,
> so the view that notifies the content provider to provide the next rows
> when the table is scrolled and such rows are visibile.
> Any clue?
you can do that using lazy / virtual tables, see the TableViewer javadoc:
---
As of 3.1 the TableViewer now supports the SWT.VIRTUAL flag. If the
underlying table is SWT.VIRTUAL, the content provider may implement {@link
ILazyContentProvider} instead of {@link IStructuredContentProvider} . Note
that in this case, the viewer does not support sorting or filtering. Also
note that in this case, the Widget based APIs may return null if the element
is not specified or not created yet.
---
Greetings,
Ralf
--
http://www.ralfebert.de/blog/eclipsercp/
|
|
|
Powered by
FUDForum. Page generated in 0.12904 seconds