Skip to main content



      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 10:28 Go to next message
Eclipse UserFriend
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 05:22] by Moderator

Re: Problem with ColumGroupHeaderLayer and SortHeaderLayer [message #1062318 is a reply to message #1062217] Fri, 07 June 2013 03:50 Go to previous messageGo to next message
Eclipse UserFriend
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 05:32 Go to previous messageGo to next message
Eclipse UserFriend
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 05:45 Go to previous messageGo to next message
Eclipse UserFriend
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 07:50 Go to previous messageGo to next message
Eclipse UserFriend
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 07:52 Go to previous messageGo to next message
Eclipse UserFriend
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 05:22 Go to previous message
Eclipse UserFriend
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:Problem with filter on 1.0.0
Next Topic:Data Validation
Goto Forum:
  


Current Time: Fri Jul 04 10:30:46 EDT 2025

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

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

Back to the top