Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » ColumnOverrideAccumulator to ColumnGroupHeaderLayer or ColumnGroupGroupHeaderLayer (Can we use ColumnOverrideAccumulator to ColumnGroupHeaderLayer or ColumnGroupGroupHeaderLayer in Nattable)
ColumnOverrideAccumulator to ColumnGroupHeaderLayer or ColumnGroupGroupHeaderLayer [message #1705542] Mon, 17 August 2015 12:46 Go to next message
Yeshaswini HS is currently offline Yeshaswini HSFriend
Messages: 7
Registered: October 2014
Junior Member
I am using 2 level Column Grouping using ColumnGroupGroupHeaderLayer and ColumnGroupHeaderLayer

In colummnGroupHeaderLayer.addColumnIndexesTo Group("groupName1", 1,2,3);
In the above line instead of hardcoding given some unique identifier for groupName1 and overriden the method getDataValueByPosition()in columnGroupHeaderLayer to iterate the list based on columnPosition and return value.(this is the value of the actual groupName1).

What is happening is

Since over ViewPort layer our columnGroupLayer is used, everytime i scroll columnPosition changes so everytime columnGroupHeaderLayer . getDataValueByPosition() is called , so as i scroll column group Header layer cell value is changing.

To Solve this, i used

i) i override the method getConfigLabelsByPositionin ColumnGroupHeaderLayer
LabelStack result = super.getConfigLabelsByPosition(columnPosition, rowPosition);
int columnIndex = getColumnIndexByPosition(columnPosition);
int rowIndex = getRowIndexByPosition(rowPosition);

if (rowIndex == 0 && this.isColumnInGroup(columnIndex)) {
result.add("LABEL");
}

Also i did

IConfigLabelAccumulator cellLabelAccumulator = new IConfigLabelAccumulator() {

@Override
public void accumulateConfigLabels(LabelStack configLabels,int columnPosition, int rowPosition) {
int columnIndex = columnGroupHeaderLayer.getColumnIndexByPosition(columnPosition);
int rowIndex = columnGroupHeaderLayer.getRowIndexByPosition(rowPosition);

if (rowPosition==0) {

configLabels.addLabel("COLUMN_GROUP_HEADER");
}

}


}
};


Both dint work


How to solve this issue?
Re: ColumnOverrideAccumulator to ColumnGroupHeaderLayer or ColumnGroupGroupHeaderLayer [message #1705561 is a reply to message #1705542] Mon, 17 August 2015 13:46 Go to previous messageGo to next message
André Forberg is currently offline André ForbergFriend
Messages: 8
Registered: July 2015
Junior Member
Hi,

I don't understand what you want to achieve.

You got a 2 level column grouping, and you have problems with the viewport layer if you scroll from left to right or vice versa, right?

As often pointed out in this forum, such problems mostly come from overriding methods instead of creating a special configuration to get the behaviour you want.

Please provide more infomation, so we can help you. Try to tell us your goal, what you want to achieve. Maybe there is a more simple way to do this.
Re: ColumnOverrideAccumulator to ColumnGroupHeaderLayer or ColumnGroupGroupHeaderLayer [message #1706141 is a reply to message #1705561] Mon, 24 August 2015 07:23 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
It seems you don't understand the basic mechanics of NatTable. And I don't understand why people are overriding internal methods when they haven't understood whats happening internally.

First, from what I can see from your post I assume you don't know about the index-position transformation. Therefore the values are changing on scrolling.
Second, why should setting a label help regarding the cell content. One of the main concepts is to separate content and rendering. Therefore your solution to solve your self-produced issue is simply wrong.
Previous Topic:How to make GroupBy and Summary layer work together
Next Topic:How to Use Wild-card Filter Support in NatTable
Goto Forum:
  


Current Time: Sat Mar 06 11:53:00 GMT 2021

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

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

Back to the top