Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » incremental content provider(is there a way to load data on demand?)
incremental content provider [message #502629] Wed, 09 December 2009 08:48 Go to next message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
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 18:42 Go to previous message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 72
Registered: July 2009
Member
> 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/
Previous Topic:Overriding delete command of the project explorer
Next Topic:Why is Eclipse RCP good
Goto Forum:
  


Current Time: Tue Mar 19 03:01:08 GMT 2024

Powered by FUDForum. Page generated in 0.05697 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top