Efficiently Filling a grid [message #1066185] |
Mon, 01 July 2013 13:04 |
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 |
Thomas Schindl Messages: 6651 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.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04679 seconds