Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » [SOLVED] Problem with ColumGroupHeaderLayer and SortHeaderLayer(Sort icon gets also painted on GroupHeader)
[SOLVED] Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062217] Thu, 06 June 2013 14:28 Go to next message
Tom Hausi is currently offline Tom Hausi
Messages: 4
Registered: June 2013
Junior Member
Hi,

I just migrated from NatTable SF-2.3.1 to the new Nebula 1.0.0 release.

Now, when sorting the first column in a ColumnGroup, the sort icon gets painted on the GroupHeader as well (see screenshot - unfortunately i can't include the image in the post directly).
ht tp://s12.postimg.org/b2ngthbul/screen.png

The problem seems to be SortHeaderLayer#getConfigLabelsByPosition which also adds the "SORT_UP"-Label to the GroupHeader.

My configuration is:
columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, selectionLayer, false);
columnHeaderLayer.addConfiguration(new MyColumnHeaderLayerConfiguration());
columnGroupHeaderLayer = new ColumnGroupHeaderLayer(columnHeaderLayer, selectionLayer, columnGroupModel,false);
columnGroupHeaderLayer.addConfiguration(new MyColumnGroupHeaderLayerConfiguration(columnGroupModel));
sortableColumnHeaderLayer = new SortHeaderLayer<T>(columnGroupHeaderLayer, sortModel, false);

I tried a different ordering of ther layers, but with any different order the ColumnGroupHeader dissapears. Anyone has an idea what i am doing wrong?

[Updated on: Wed, 12 June 2013 09:22]

Report message to a moderator

Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062318 is a reply to message #1062217] Fri, 07 June 2013 07:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1349
Registered: July 2012
Senior Member
Hi,

have you tried the following layer composition?

ColumnHeaderLayer
SortHeaderLayer
ColumnGroupHeaderLayer

This way the label should be only applied to the cells in the ColumnHeaderLayer as the SortHeaderLayer is not aware of the ColumnGroupHeaderLayer.

Greez,
Dirk
Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062894 is a reply to message #1062318] Tue, 11 June 2013 09:32 Go to previous messageGo to next message
Tom Hausi is currently offline Tom Hausi
Messages: 4
Registered: June 2013
Junior Member
Hi,

thank you for your quick reply. Unfortunately, I tried this composition already. Then the ColumnGroup is not painted anymore. The ColumnGroupHeaderLayer constructor expects a ColumnHeaderLayer so I suspect that inserting a SortHeaderLayer in between isn't supported. I also tried composing both the SortHeaderLayer and the ColumnGroupHeaderLayer on top of the ColumnHeaderLayer (i.e parallel), but that does not work either.

Tom
Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062896 is a reply to message #1062894] Tue, 11 June 2013 09:45 Go to previous messageGo to next message
Tom Hausi is currently offline Tom Hausi
Messages: 4
Registered: June 2013
Junior Member
For the time being I just subclassed the SortHeaderLayer overriding getConfigLabelsByPosition:
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {

LabelStack underlyingLabelStack = getUnderlyingLayer().getConfigLabelsByPosition(columnPosition, rowPosition);

if (underlyingLabelStack.hasLabel(GridRegion.COLUMN_GROUP_HEADER)) {
	return underlyingLabelStack;
}

return super.getConfigLabelsByPosition(columnPosition, rowPosition);
}
Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062917 is a reply to message #1062896] Tue, 11 June 2013 11:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1349
Registered: July 2012
Senior Member
Quote:
The ColumnGroupHeaderLayer constructor expects a ColumnHeaderLayer so I suspect that inserting a SortHeaderLayer in between isn't supported


That's wrong! The ColumnGroupHeaderLayer constructor expects an ILayer as underlying layer. The parameter is named columnHeaderLayer which leads to missinterpretion!

Quote:
I also tried composing both the SortHeaderLayer and the ColumnGroupHeaderLayer on top of the ColumnHeaderLayer (i.e parallel)


Of course this isn't working because the layers are stacked!

When I'm building my layer stack up like following, everything works as expected:
DefaultColumnHeaderDataLayer dataLayer = new DefaultColumnHeaderDataLayer(dataProvider);
ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(dataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());

SortHeaderLayer<T> sortHeaderLayer = new SortHeaderLayer<T>(
	columnHeaderLayer, 
	new GlazedListsSortModel<T>(
		bodyLayerStack.sortedList, 
		columnPropertyAccessor,
		configRegistry, 
		dataLayer), 
	false);

ColumnGroupHeaderLayer columnGroupHeaderLayer = new ColumnGroupHeaderLayer(
		sortHeaderLayer, bodyLayerStack.selectionLayer, model);




Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062919 is a reply to message #1062917] Tue, 11 June 2013 11:52 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1349
Registered: July 2012
Senior Member
Of course in the code above I register the SingleClickSortConfiguration() aswell:

natTable.addConfiguration(new SingleClickSortConfiguration());
Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1063093 is a reply to message #1062919] Wed, 12 June 2013 09:22 Go to previous message
Tom Hausi is currently offline Tom Hausi
Messages: 4
Registered: June 2013
Junior Member
I just inspected my code some more and found that the FilterRowHeaderComposite registered on top of the SortHeaderLayer. So even when I tried your suggested composition, the FilterRowHeaderComposite would register on top of the SortHeaderLayer an thus disabling the ColumnGroupHeaderLayer. Thanks for your patience and pointing me in the right direction.
Previous Topic:Nattable creation in IWorkbenchSiteProgressService
Next Topic:Font changes when editing a cell with an Inline Text Control
Goto Forum:
  


Current Time: Fri Oct 31 04:18:42 GMT 2014

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

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