Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to use ColumnHideShowLayer with ColumnGroupHeaderLayer
How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1182709] Tue, 12 November 2013 11:10 Go to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
I would like to show/hide some columns in my table. So I decided to use the ColumnHideShowLayer for that purpose. My question is how can I use it together with the ColumnGroupHeaderLayer?

Here is my code for creating columnHeader region:
ILayer bodyLayer = ... 
SelectionLayer selectionLayer = ...
IDataProvider columnHeaderDataProvider = ...

DataLayer columnDataLayer = new DataLayer(columnHeaderDataProvider);
ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnDataLayer);
ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
	columnHideShowLayer,
	bodyLayer, 
	selectionLayer
);
		
ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
	columnHideShowLayer, 
	selectionLayer, 
	new ColumnGroupModel(),
	false
);
columnGroupHeaderLayer.addColumnsIndexesToGroup("Column Group", 8, 9, 10);	

But the group is not drawn. When i don't use the ColumnHideShowLayer it works perfectly.
Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1182761 is a reply to message #1182709] Tue, 12 November 2013 11:52 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
The ColumnHideShowLayer needs to be part of the body layer stack, not the column header layer stack.
Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1183049 is a reply to message #1182761] Tue, 12 November 2013 15:51 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Yes, thanks Dirk.

I have another issue with column hiding. When I call
int columnCount = dataProvider.getColumnCount();
columnHideShowLayer.hideColumnPositions(Arrays.asList(columnCount - 1, columnCount - 2));

The columns really disappear but the table doesn't grab the free space. I use percentage column sizing.
Do you have any idea what is going wrong here? Some kind of caching?
to hide the
Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1183055 is a reply to message #1183049] Tue, 12 November 2013 16:00 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
How did you specify the percentage sizes and what do you expect on hiding?

If you configure two column that use 40% and one column for 20%, hiding the column with 20% will result in just using 80% of the available space (40% + 40%)

But there is also an open issue I want to solve for the next release. So please tell me how you configured the percentage sizing and what you would expect.
Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1183068 is a reply to message #1183055] Tue, 12 November 2013 16:06 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
My configuration is like this:
dataLayer.setColumnPercentageSizing(true);
		
dataLayer.setColumnPercentageSizing(0, false);
dataLayer.setColumnWidthByPosition(0, 150);
		
dataLayer.setColumnPercentageSizing(2, false);
dataLayer.setColumnWidthByPosition(2, 80);
		
...a few more columns with fixed width				

So I have all columns fixed width except the second one which uses percent sizing.
My expectation is that the second column should occupy all available width space. Which works fine until I hide a column.

I have tried to use just
dataLayer.setColumnPercentageSizing(true);

without any specific column width setting, but the result was the same.

[Updated on: Tue, 12 November 2013 16:12]

Report message to a moderator

Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1184161 is a reply to message #1183068] Wed, 13 November 2013 09:05 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
I think I know why it happens. The size calculation is done below the DataLayer. This is because before there were only fixed sizes and so the size calculations on transitions were fine.

With percentage sizing this approach is not fitting well. This is because the ColumnHideShowLayer performs the transition to not rendering hidden columns. But the SizeConfig (connected to the DataLayer) is not aware of that because of the encapsulation and isolation of that feature.

So far what the reason is, but I have no clue how to fix. There is still one issue on my list regarding percentage sizing and resizing, that I want to fix prior finishing the upcoming release. I will take a look at the hide stuff there too. Maybe I find a solution for the current architecture.
Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1184648 is a reply to message #1184161] Wed, 13 November 2013 15:50 Go to previous messageGo to next message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Is it possible to set minimum width for percent sized column?
Re: How to use ColumnHideShowLayer with ColumnGroupHeaderLayer [message #1184866 is a reply to message #1184648] Wed, 13 November 2013 18:58 Go to previous message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2704
Registered: July 2012
Senior Member
No
Previous Topic:CellPainterDecorator
Next Topic:Problem with loader:
Goto Forum:
  


Current Time: Fri Aug 23 14:09:46 GMT 2019

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

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

Back to the top