10

TL;DR

Based on Thomas Schindl's article JFace-Viewer and Eclipse Databinding with > 10.000 Objects (which suggests a very good idea), I'd like to convert a regular TreeViewer + multiple ITreeContentProvider implementations to Nebula's GridTreeViewer which uses ObservableListTreeContentProvider, a VisibleRangeChangedListener and Eclipse Data Binding to make it "lazy" (lazier) and load data on-demand.

How should I rewrite my existing regular ITreeContentProvider implementations to use the same hierarchies with an ObservableListTreeContentProvider? Can I maybe make a "bridge" between the old and the new solution? Using DelegatingListProperty somehow like this? Any other ideas?
I found some too simple examples, but I don't really get the concept of using Data Binding in such a complex hierarchical tree format.

Example trees & content providers:

Content provider 1.:

|- A1
   |-- B1
       |-- MyMessage1
|- A2
   |-- B2
       |-- MyMessage2

Content provider 2.:

|- C1
   |-- D1
       |-- MyMessage1
|- C2
   |-- D2
       |-- MyMessage2

Longer explanation

I have a view where I display huge amount of objects in a hierarchical tree format using a custom TreeViewer with classic ITreeContentProvider and LabelProvider+ITableLabelProvider implementations. There is also a menu where the user can choose in which format they want to see this hierarchy displayed. When the user chooses another display format, the only thing that happens is that another ITreeContentProvider implementation gets set to the viewer and I refresh the viewer programmatically.
It works, but due to the huge number of elements (in some cases, 100-200k rows, please don't ask the reasons, it just has to work), displaying the items can be slow, the UI sometimes freezes, because there are so many listeners on the TreeItems, the view refresh takes a lot of time, etc...

So I'd like to use some kind of a lazy solution while having the model elements already loaded in memory.
I've already tried SWT.VIRTUAL and ILazyTreeContentProvider, but it performed badly (even if using viewer.setUseHashlookup(true)) and was problematic (when scrolling, it took a lot of time for the TreeItems to load, had its bugs, problems with sorting, filtering, etc.).

Now I read Thomas Schindl's blog article: JFace-Viewer and Eclipse Databinding with > 10.000 Objects. I'd like to try this using Eclipse Nebula Grid's GridTreeViewer and + ObservableListTreeContentProvider (which is also an ITreeContentProvider implementation) and a VisibleRangeChangedListener and "lazy" label provider (like in the article). Can I somehow use my existing ITreeContentProvider implementations and build up a "bridge" between this and a new ObservableListTreeContentProvider?


BTW I checked Nebula NatTable, but I found it VERY hard to migrate the existing content providers to this new solution, its API and its approach is totally different (hierarchy going from child to parent, not the opposite way), and the documentation related to Trees is still empty.

Sk8erPeter
  • 6,899
  • 9
  • 48
  • 67

1 Answers1

0

Nebula has made the Grid virtual a while ago. Here are the snippets for the viewer which contains some examples for a lazy content provider.

http://git.eclipse.org/c/nebula/org.eclipse.nebula.git/tree/examples/org.eclipse.nebula.snippets/src/org/eclipse/nebula/snippets/grid/viewer

Yaza
  • 543
  • 3
  • 9