Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 21284 - [Viewers] More flexible ContentProvider for TableViewer
Summary: [Viewers] More flexible ContentProvider for TableViewer
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P4 enhancement with 2 votes (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 74368
  Show dependency tree
 
Reported: 2002-07-07 07:28 EDT by Joern Ihlenburg CLA
Modified: 2005-05-10 14:54 EDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joern Ihlenburg CLA 2002-07-07 07:28:47 EDT
The current IStructuredContentProvider for TableViewer has only one method to 
deliver the content to the TableViewer (getElements()). However, getElements 
returns one (sometimes) big array of objects representng the column data. In 
some scenarios the data to be displayed in the table is very large (e.g. 
database content) and can't be successfully stored in one single array. Another 
scenario would be if more data is being appended to the curret data at a very 
high frequency, resulting in the allocation of a new array (containing n+1 
entries) everytime a new data row is being appended. This can leed to very high 
memory load and poor performance.
Therefore we need a more sophisticated ContentProvider (e.g 
IRowDataContentProvider) with a method like "Object getElementAt(int row)" 
or "Object[] getElementsAt(int startRow, int endRow)" and another method 
like "int getNumberOfElements()" that allows us to retrieve only that data, 
that is visibe at the moment. This is inprired from the way the Swing 
DefaultTablModel works. But in contrast to DefaultTableModel where the cell 
data is retrieved, the enhanced ContentProvider would retrieve full rows which 
would fit more closely into the exisiting JFace/SWT model and would not 
decrease performance too much when scrolling in tables. A highly advanced 
TableViewer could cache some rows outside the current view area so that the 
ContentProvied isn't called that often when the user is scrolling.
Comment 1 Nick Edgar CLA 2003-02-09 23:22:51 EST
There are no plans for the UI team to work on this defect until higher priority 
items are addressed.  If you would like to work on this defect, please let us 
know on the platform-ui-dev mailing list.
Note that this will require a new kind of table widget from SWT which allows 
for lazy population.
Comment 2 Tod Creasey CLA 2005-05-09 09:03:24 EDT
See ILazyContentProvider added in 3.1. which is designed for use with the
VIRTUAL table which only gets the visible items.

Object getElementAt(int row) is possible with the method updateElement(int index)

Object[] getElementsAt(int startRow, int endRow)is not implemented because the
OS asks for items one at a time. You may want to batch your updates but it would
be pointless for us to give it to you are startRow and endRow would always be
the same. 

getNumberOfElements() has OS issues as well as the indicies requested by the OS
are not sequential if the user scrolls quickly. You could keep the last index if
that suited your algoirthm but the number of elements that were visible at any
time is a list of grouped items.

An implementation of ILazyContentProvider (DeferredContentProvider) is also
avialable that supports filtering and sorting as well. Adding Stefan Xenos as he
is the author and so may be interested in this discussion.

I am going to mark this fixed as I think we have provided what you are after
within the limits of the OS in 3.1.
Comment 3 Tod Creasey CLA 2005-05-10 14:54:17 EDT
Marking as closed.