2

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.

Andy Thomas
  • 84,978
  • 11
  • 107
  • 151
JesperE
  • 63,317
  • 21
  • 138
  • 197
  • 1
    what user in their right mind want's to see 2^32? I suggest you revist your requirements. – andyczerwonka Oct 28 '09 at 22:53
  • 2
    Nobody is talking about **seeing** 2^32 rows. It is all a matter of **addressing**. The model I have is a 32 bit memory space. If I can't set the number of rows to 2^32, I will have to implement my own paging scheme, which I was hoping to avoid. – JesperE Oct 29 '09 at 08:04

2 Answers2

6

SWT Matrix breaks the capacity bariers allowing any BigInteger amount of rows or columns. It is closed source, but free for private and non-commercial use. Early alpha release though at this point.

  • SWT Matrix actually seems promising. Thanks, I will try it out. – JesperE May 15 '11 at 06:53
  • I'd appreciate to know your impressions after trying it. Any important features missing or uncovered areas in documentation? – Jacek Kołodziejczyk May 20 '11 at 06:56
  • Will do. I'll just have to find some spare time to do it in. :) – JesperE May 20 '11 at 16:12
  • I'm playing around a little with it now. Looks nice so far. Are there any plans for a JFace viewer? – JesperE Oct 27 '11 at 09:46
  • Yes, there is. SWT-Table-like wrapper for Matrix is already half way completed. Transition from existing SWT Table code base will be a matter of couple class names replacements. That means JFace viewer could be achieved the same way, by modifying TableViewer (it would work out of the box if Table was an interface). The things will complicate for a Long or BigInteger indexing though. – Jacek Kołodziejczyk Oct 27 '11 at 21:16
  • Cool. I don't need a drop-in replacement; just as long as I have a JFace viewer. – JesperE Oct 29 '11 at 07:14
3

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);
andyczerwonka
  • 4,230
  • 5
  • 34
  • 57
  • 1
    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 Oct 29 '09 at 08:00
  • 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 Nov 03 '09 at 18:44
  • 1
    Unfortunately, setItemCount(Integer.MAX_VALUE) causes a OutOfMemory error, presumable because the Table control tries to create an array of that size. – JesperE Nov 04 '09 at 12:36