Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Efficiently Filling a grid
Efficiently Filling a grid [message #1066185] Mon, 01 July 2013 13:04 Go to next message
Scott Seidl is currently offline Scott Seidl
Messages: 7
Registered: November 2012
Junior Member
I'm using the Nebula grid component in a standalone java app I'm working on (not an Eclipse Plugin). I am running into a case where it is sometimes taking 3 minutes to populate the grid component with GridItems. I'm thinking that is can't be avoided due to the large number of rows I have... but want to make sure. Below is a short snippet of how I am creating the grid items. Is there a more efficient way to populate a Grid Component that I am not aware of?

		_grid.setLayoutDeferred(true);
		GridItem delimiters = new GridItem(_grid, SWT.NONE);
		SegmentAnalysis delimiterDetails = analyzeResult.getContextDelimiters();
		delimiters.setText(delimiterDetails.getSegmentId());
		delimiters.setText(1, delimiterDetails.getSegmentName());
		delimiters.setText(2, "Segment-" + delimiterDetails.getSegmentId());
		delimiters.setText(5, Integer.toString(delimiterDetails.getUseCount()));
		for (ElementAnalysis e : delimiterDetails.getElementList()) {
			GridItem element = new GridItem(delimiters, SWT.NONE);
			element.setText(e.getElementName());
			element.setText(5, Integer.toString(e.getUseCount()));
			for (Entry<String, Integer> em : e.getElementMap().entrySet()) {
				GridItem value = new GridItem(element, SWT.NONE);
				value.setText(4, "'" + em.getKey() + "'");
				value.setText(5, Integer.toString(em.getValue()));
			}
		}


Thanks in advance for any ideas/ advice.
Re: Efficiently Filling a grid [message #1066195 is a reply to message #1066185] Mon, 01 July 2013 13:49 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5407
Registered: July 2009
Senior Member
Have you tried call _grid.setRedraw(false) before you are filling the
grid and turn it back on after you filled it?

And IMHO 3 Minutes *are* unacceptable IMHO - how many items are we
talking about? Have you tried doing this in a flat (=none tree layout?)?

See my blog entry about GridViewer where the time to fill a Grid with
200.000 rows takes roughly 1.4 seconds!

Tom

On 01.07.13 15:04, Scott Seidl wrote:
> I'm using the Nebula grid component in a standalone java app I'm working
> on (not an Eclipse Plugin). I am running into a case where it is
> sometimes taking 3 minutes to populate the grid component with
> GridItems. I'm thinking that is can't be avoided due to the large
> number of rows I have... but want to make sure. Below is a short
> snippet of how I am creating the grid items. Is there a more efficient
> way to populate a Grid Component that I am not aware of?
>
> _grid.setLayoutDeferred(true);
> GridItem delimiters = new GridItem(_grid, SWT.NONE);
> SegmentAnalysis delimiterDetails =
> analyzeResult.getContextDelimiters();
> delimiters.setText(delimiterDetails.getSegmentId());
> delimiters.setText(1, delimiterDetails.getSegmentName());
> delimiters.setText(2, "Segment-" +
> delimiterDetails.getSegmentId());
> delimiters.setText(5,
> Integer.toString(delimiterDetails.getUseCount()));
> for (ElementAnalysis e : delimiterDetails.getElementList()) {
> GridItem element = new GridItem(delimiters, SWT.NONE);
> element.setText(e.getElementName());
> element.setText(5, Integer.toString(e.getUseCount()));
> for (Entry<String, Integer> em :
> e.getElementMap().entrySet()) {
> GridItem value = new GridItem(element, SWT.NONE);
> value.setText(4, "'" + em.getKey() + "'");
> value.setText(5, Integer.toString(em.getValue()));
> }
> }
>
>
> Thanks in advance for any ideas/ advice.
Re: Efficiently Filling a grid [message #1066230 is a reply to message #1066195] Mon, 01 July 2013 15:38 Go to previous messageGo to next message
Scott Seidl is currently offline Scott Seidl
Messages: 7
Registered: November 2012
Junior Member
_grid.setRedraw(false) seem to have made it worse. It's now taking about 5 minutes (although that could just be increased load on my desktop).

As far as the number of rows, I'm creating about 250,000. I haven't tried not using the tree layout, as that is the main reason I went with the Nebula Grid.

Can you give me the URL to your blog (or specific post)?
Re: Efficiently Filling a grid [message #1066289 is a reply to message #1066230] Mon, 01 July 2013 22:46 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5407
Registered: July 2009
Senior Member
http://tomsondev.bestsolution.at/2011/10/07/jface-viewer-and-eclipse-databinding-with-10-000-objects/
please create a self-contained sample one can run locally, then we can
take a look where time is spent.

Tom

On 01.07.13 17:38, Scott Seidl wrote:
> _grid.setRedraw(false) seem to have made it worse. It's now taking
> about 5 minutes (although that could just be increased load on my desktop).
>
> As far as the number of rows, I'm creating about 250,000. I haven't
> tried not using the tree layout, as that is the main reason I went with
> the Nebula Grid.
>
> Can you give me the URL to your blog (or specific post)?
Previous Topic:Installation through Update?
Next Topic:Copy and Paste in Nebula Grid
Goto Forum:
  


Current Time: Wed Oct 22 22:41:36 GMT 2014

Powered by FUDForum. Page generated in 0.01701 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software