Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » GridTreeViewer - ad-hoc setting columns and column groups visible/not visible
GridTreeViewer - ad-hoc setting columns and column groups visible/not visible [message #854506] Tue, 24 April 2012 02:24 Go to next message
Sharon Snyder is currently offline Sharon Snyder
Messages: 56
Registered: September 2010
Member

I have a GridTreeViewer and I allow the users to customize the display of the grid - they can use a preferences page to add/remove and reorder the columns.

Note that if a column is inside of a column group - all columns within that group stay under that group - they are moved/added/removed as a whole through the preferences page.

If the grid is being displayed, I reorder the columnns, set the visible state, set the colunn width, and refresh the gridviewer as appropriate.

I am finding a couple of strange things - and I believe it's related to the header renderer, but I'm not sure how to fix this as of yet.

1. When I remove the columns in a column group - I do a setVisible(false) and I set the width to 0 - just to be sure. This seems to remove the group, but it seems that the toggle renderer wants to display on a header somewhere - so it moves to the left - even if this column it isn't a group.

2. When not displaying the grid, if I remove enough columns from the display the header gets really tall the next time I draw the grid - widths are good, just the height is ridiculous!

My snippet of creating the grid is as follows:
Composite composite = new Composite(sashForm, SWT.NONE);
composite.setLayout(new GridLayout(1, false));

GridTreeViewer gtv = new GridTreeViewer(composite);
Grid grid = gtv.getGrid();
grid.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
grid.setHeaderVisible(true);
grid.setFooterVisible(true);
grid.setTreeLinesVisible(true);
grid.setVisible(true);

The sashForm is not being moved, so that is not affecting the resize of the header, it's purely just removing columns and drawing the grid (or re-ordering columns).

I'll be happy to provide more information if needed.

Any thoughts/assistance would be greatly appreciated.

Thanks,
Sharon
Re: GridTreeViewer - ad-hoc setting columns and column groups visible/not visible [message #854864 is a reply to message #854506] Tue, 24 April 2012 09:55 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5415
Registered: July 2009
Senior Member
Could you please provide a runnable test case so that I can debug the
problem.

Tom

Am 24.04.12 04:24, schrieb Sharon Snyder:
> I have a GridTreeViewer and I allow the users to customize the display
> of the grid - they can use a preferences page to add/remove and reorder
> the columns.
> Note that if a column is inside of a column group - all columns within
> that group stay under that group - they are moved/added/removed as a
> whole through the preferences page.
> If the grid is being displayed, I reorder the columnns, set the visible
> state, set the colunn width, and refresh the gridviewer as appropriate.
>
> I am finding a couple of strange things - and I believe it's related to
> the header renderer, but I'm not sure how to fix this as of yet.
>
> 1. When I remove the columns in a column group - I do a
> setVisible(false) and I set the width to 0 - just to be sure. This
> seems to remove the group, but it seems that the toggle renderer wants
> to display on a header somewhere - so it moves to the left - even if
> this column it isn't a group.
> 2. When not displaying the grid, if I remove enough columns from the
> display the header gets really tall the next time I draw the grid -
> widths are good, just the height is ridiculous!
>
> My snippet of creating the grid is as follows:
> Composite composite = new Composite(sashForm, SWT.NONE);
> composite.setLayout(new GridLayout(1, false));
>
> GridTreeViewer gtv = new GridTreeViewer(composite);
> Grid grid = gtv.getGrid();
> grid.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,
> 1, 1));
> grid.setHeaderVisible(true);
> grid.setFooterVisible(true);
> grid.setTreeLinesVisible(true);
> grid.setVisible(true);
> The sashForm is not being moved, so that is not affecting the
> resize of the header, it's purely just removing columns and drawing the
> grid (or re-ordering columns).
>
> I'll be happy to provide more information if needed.
>
> Any thoughts/assistance would be greatly appreciated.
>
> Thanks,
> Sharon
Re: GridTreeViewer - ad-hoc setting columns and column groups visible/not visible [message #855251 is a reply to message #854864] Tue, 24 April 2012 16:39 Go to previous messageGo to next message
Sharon Snyder is currently offline Sharon Snyder
Messages: 56
Registered: September 2010
Member

Hi Tom,

While I was working on getting you a runnable example - I came across the workaround for both of the problems. Just set the column visible (true/false). Don't change the column size. This messes up the header height since it thinks it needs to somehow display the text with 0 width (which is basically ridiculous). This also seemed to affect the drawing of the toggle chevrons. Once I stopped changing the size of the column, in addition to setting the visible flag, it all seems to work properly.

Please consider safeguarding against this. Consider the 0 width as a non-visible column maybe and do not calculate the header size for that column maybe?

Just a thought! Smile

I hope my workaround can help others.

-Sharon
Re: GridTreeViewer - ad-hoc setting columns and column groups visible/not visible [message #855529 is a reply to message #855251] Tue, 24 April 2012 22:38 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5415
Registered: July 2009
Senior Member
Ok - maybe even everything below the size of a char is to small. Can you
please still file a bugzilla - I'm out of office for the next few days
and I'm sure I'll forget about it.

Tom

Am 24.04.12 18:39, schrieb Sharon Snyder:
> Hi Tom,
>
> While I was working on getting you a runnable example - I came across
> the workaround for both of the problems. Just set the column visible
> (true/false). Don't change the column size. This messes up the header
> height since it thinks it needs to somehow display the text with 0 width
> (which is basically ridiculous). This also seemed to affect the drawing
> of the toggle chevrons. Once I stopped changing the size of the column,
> in addition to setting the visible flag, it all seems to work properly.
>
> Please consider safeguarding against this. Consider the 0 width as a
> non-visible column maybe and do not calculate the header size for that
> column maybe?
>
> Just a thought! :)
>
> I hope my workaround can help others.
>
> -Sharon
>
Re: GridTreeViewer - ad-hoc setting columns and column groups visible/not visible [message #856147 is a reply to message #855529] Wed, 25 April 2012 12:10 Go to previous message
Sharon Snyder is currently offline Sharon Snyder
Messages: 56
Registered: September 2010
Member

I'll do it now...thanks Tom!
Previous Topic:GanttChart Zoom Level
Next Topic:Example print Chart
Goto Forum:
  


Current Time: Thu Oct 23 11:57:12 GMT 2014

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

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