Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Large Tables

Take a look at the way Swing approaches the problem with the
Model-Viewer-Controller approach. Basically you would create
an access interface to the data (possibly a good idea to reuse/copy
the swing TableModel interface) and then update the table so
that it only displays the visible rows. Rereading your text
this looks like the approach suggested for approach '1'. BTW
the code to swing is available, so you can always look at it
for inspiration.

I haven't used the Table / TableItem classes, so I can't give
you anything on the implementation.

Andre


Matthew Golby-Kirk wrote:

Hi All,

I am writing a standalone SWT app on Windows, and require a table that holds a
large number of rows (possibly as many as one million) with 10 columns.

Now using the Table / TableItem classes, the time taken to initialize the table
with all the data in one go takes too long, when the number of rows exceeds
about 15,000 on my machine (1.8Ghz P4, 1GB RAM WinXP), and when I exceed 160,000
entries it took over 2.5 hours to draw the table.

I have had two ideas as to ways to combat this, but both have problems, and I would
like opinions on how others may have solved this problem.


Idea 1: Write a viewport class that only shows the first 100 rows, then hook the vertical scroll bar with a listener , reset the maximum entries in the scroll bar and redraw the
data in the table on each scroll event.

Now I have written the class ok, but cannot seem to hook all the events correctly, as the table appears to reset the scroll bar's size and selection without sending an event,
so my viewport scrollbar's thumb seems to go from being small to large
without my being able to control it properly.

Idea 2: Subclass Table (which I know is not a good idea but I wanted to see if I could at least make things better) with a new LargeTable class and try to improve the speed
at which things occur in the parent table by overriding methods.

Doing this I have improved the speed of showing 160,000 entries from 2.5 hours to 15 minutes simply by adding a setNumberItems(int size) method that resized the items vector in one go, rather that incrementing the items vector by 4 each time as the standard Table code does.
However this is still too slow really.

Has anyone got any better ideas, and which is the best way to go forward from here?

I have sample code I can post if it would help explain what I an trying to do in each idea...


Kind Regards,


MGK

-
Matthew Golby-Kirk   MQSeries Integrator Development
Hursley Park MP 211  IBM UK Internal 24-6700
Internet:: mgk@xxxxxxxxxx, Notes: Matthew Golby-Kirk/UK/IBM
Phone: +44-(0)-1962-816700 Fax: +44-(0)-1962-816898
http://muppet.hursey.ibm.com
"Skating away, on the thin ice of a new day..."


--
André-John Mas
Software Developer / Développeur Informatique
Newtrade Technologies Inc.
63 de Brésoles, Suite 100
Montreal, Quebec, Canada H2Y 1V7
ajmas@xxxxxxxxxxxxxxxx
tel +1 514 286 8180 x322
fax +1 514 286 8184

----------------------------------------------------------------------
If you have received this message in error, please notify the sender
immediately and delete the original without making a copy, disclosing
its contents or taking any action based thereon.

Si vous avez reçu ce message par erreur, veuillez en aviser
immédiatement le signataire et effacer l'original, sans en tirer de
copie, en dévoiler le contenu ni prendre quelque mesure fondée sur
celui-ci.




Back to the top