Bug 224692 - Support SWT.VIRTUAL style in GalleryTreeViewer
Summary: Support SWT.VIRTUAL style in GalleryTreeViewer
Status: CLOSED INVALID
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P1 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nicolas Richeton CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on: 273188 212071
Blocks:
  Show dependency tree
 
Reported: 2008-03-28 13:49 EDT by Peter Centgraf CLA
Modified: 2021-07-05 11:40 EDT (History)
3 users (show)

See Also:


Attachments
Virtual content support for GalleryTreeViewer (29.21 KB, text/plain)
2008-07-30 04:56 EDT, Peter Centgraf CLA
no flags Details
Decorator for eager -> lazy tree content provider (3.07 KB, text/plain)
2008-07-30 17:50 EDT, Peter Centgraf CLA
no flags Details
Same as the last one, as a patch file (3.64 KB, text/plain)
2008-07-30 17:52 EDT, Peter Centgraf CLA
no flags Details
Bug fixes for last patch (4.12 KB, text/plain)
2008-08-01 11:09 EDT, Peter Centgraf CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Centgraf CLA 2008-03-28 13:49:17 EDT
The initial implementation of GalleryTreeViewer (bug 212071) does not attempt to handle a virtual style Gallery.  To simplify debugging of the fully-eager case, I removed or disabled a lot of code related to virtual style Trees.  This logic should be restored to enable the full functionality of Gallery via the JFace Viewer APIs.
Comment 1 Peter Centgraf CLA 2008-07-30 02:34:53 EDT
I've done a night's work on this, using TreeViewer as a base and blindly copying all of the code related to virtual table support.  Sadly, this requires about 700 lines of completely duplicated code, which more than doubles the length of GalleryTreeViewer from 550 to 1243 LOC.  After going through this exercise, I just realized that I copied the code from 3.3 instead of from 3.4, so I have to do it all over again.

Tom, do you have any ideas to help us reuse more of this TreeViewer logic for virtual trees?  Why did you leave it in TreeViewer instead of pushing it up to AbstractTreeViewer?
Comment 2 Peter Centgraf CLA 2008-07-30 04:56:45 EDT
Created attachment 108725 [details]
Virtual content support for GalleryTreeViewer

This is my initial version, based on the TreeViewer code from Eclipse 3.3.2.  This needs to be updated to include fixes from 3.4.0, but it is basically usable like this.
Comment 3 Nicolas Richeton CLA 2008-07-30 13:14:53 EDT
Peter, thanks for your hard work on the Gallery viewer. I'll commit the patch ASAP.
Comment 4 Peter Centgraf CLA 2008-07-30 17:48:10 EDT
I've thought about this a bit more, and there's a subtle difference between the way TreeViewer and TableViewer handle SWT.VIRTUAL widgets that has a big impact.  For the Gallery, the most resource-intensive part of the process is usually in the LabelProvider, not the ContentProvider.  In theory, it would be possible to use an eager ITreeContentProvider but still fetch and render the Images in virtual style.  TableViewer supports this use case by caching the array of contents and satisfying SWT.SetData requests from the cache.  TreeViewer and GalleryTreeViewer should be able to do something similar.  That way, client code that uses an eager content provider can still gain the performance advantages of loading the images on demand.

Tom, should I request this from JFace, or keep it here?

In the short term, I've written a decorator object that converts an eager ITreeContentProvider into an ILazyTreeContentProvider.  Something similar should be possible for ITreePathContentProvider, but I haven't done this yet.  I will post the patch shortly.  Because there is no AbstractTreeViewer.replace(), this new class will only work with GalleryTreeViewer for now.

For the code duplication problem, I suggest a new class AbstractLazyTreeViewer that would fit between AbstractTreeViewer and TreeViewer.  From a quick inspection of the code, the base type Item can be used instead of TreeItem or GalleryItem in all cases except for three method calls:

clear()
clearAll(boolean)
clear(int,boolean)

All other cases where the specific subtype is used can be converted to use one of the abstract methods on AbstractTreeViewer, such as getItemCount(Item).
Comment 5 Peter Centgraf CLA 2008-07-30 17:50:36 EDT
Created attachment 108796 [details]
Decorator for eager -> lazy tree content provider
Comment 6 Peter Centgraf CLA 2008-07-30 17:52:19 EDT
Created attachment 108797 [details]
Same as the last one, as a patch file
Comment 7 Peter Centgraf CLA 2008-08-01 11:09:42 EDT
Created attachment 108958 [details]
Bug fixes for last patch

Apparently the viewer's IElementComparer is null by default, so I have to check for that case.  Also, I fixed a silly but important typo.
Comment 8 Thomas Schindl CLA 2008-08-04 05:04:55 EDT
Because in time of 3.3 our only customer (Nebula-Grid) had no virtual support and because we had no test case we stayed away from it. Since this situation has changed since then (Gallery adopted us => it really strikes me that you guys adopted our API and Grid also "supports" virtual tables/trees) I think we could start work on this in 3.5.

Could you file a bug against JFace where you ask that we move the logic up and CC Boris and me? I can't promise anything because of me work load but I willing to help you guys to maintain as few lines of code as possible.
Comment 9 edutilos aghayev CLA 2015-06-22 11:45:27 EDT
hello guys, where i am?
Comment 10 Wim Jongman CLA 2019-12-12 15:57:56 EST
This bug does not have a target milestone assigned and is automatically closed as part of the 2.3.0 release cleanup.

It could be that this bug is accidentally closed for which we apologize.

If this bug is still relevant, please re-open and set a target milestone.