tags:

views:

530

answers:

1

There are a couple of "advanced" table/spreadsheet SWT widgets out there (Nattable, Nebula Grid), but none of them support really large datasets. Nattable is the one which comes closest, but it still has limitations in the datatypes it uses causing the number of rows in the table to become far to limited.

I need to be able to represent at least 2^32 rows, preferrably 2^64.

A: 

What's wrong with SWT.VIRTUAL with a reguar table? You can then use a LazyContentProvider, which gives you a callback for loading what's needed in the view.

Something like this...

TableViewertableViewer = new TableViewer(parent, SWT.VIRTUAL|SWT.BORDER|SWT.V_SCROLL);
// skipping the noise
tableViewer.setItemCount(100000);
tableViewer.setContentProvider(new LazyContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
tableViewer.setUseHashlookup(true);
tableViewer.setInput(null);
arcticpenguin
Try setItemCount(Integer.MAX_VALUE). The SWT Table widget has a backing array for all items. The only "virtual" about it is that the actual **value** isn't fetched until it is needed. This works well if the retrieval is expensive, but doesn't scale beyond a couple of million rows.
JesperE
If you need exactly 2^32 rows, use a table with SWT.VIRTUAL style with Integer.MAX_VALUE items, and when you have to show for example item 500(out of 2^31), you will print item no. 1000 (of 2^32).
True Soft
Unfortunately, setItemCount(Integer.MAX_VALUE) causes a OutOfMemory error, presumable because the Table control tries to create an array of that size.
JesperE