Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Freezing several rows --> Collapse/Expand Root Node --> duplicate rows
Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470665] Wed, 12 November 2014 14:21 Go to next message
David Schowalter is currently offline David SchowalterFriend
Messages: 11
Registered: November 2014
Junior Member
My NatTable has the following configuration:

TreeList<CETNode<?>> treeList = new TreeList<CETNode<?>>(tableElements, new TreeNodeFormat(sortModel),expansionModel);
GlazedListTreeData<CETNode<?>> treeData = new TreeNodeTreeData(treeList);
GlazedListsDataProvider<CETNode> bodyDataProvider = new GlazedListsDataProvider(treeList, columnAccessor);
DataLayer	bodyDataLayer = new DataLayer(bodyDataProvider);

CalculationColumnPropertyResolver.getInstance().configureColumnWidths(bodyDataLayer);

// Body layer

// layer which handles update events in the model
 GlazedListsEventLayer<CETNode<?>> glazedListsEventLayer = new GlazedListsEventLayer<CETNode<?>>(bodyDataLayer, treeNodes);

ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(glazedListsEventLayer);
SelectionLayer selectionLayer = new SelectionLayer(columnHideShowLayer, null, true, false);
selectionLayer.addConfiguration(new CustomSelectionStyleConfiguration());
// TODO: this is only a workaround because of a bug in the selection layer when a structural change event
// occurs. If the default Event Handler Implementation is used, the selection layer looses the current selection
// "too often", see http://www.eclipse.org/forums/index.php/t/457074/
selectionLayer.registerEventHandler(new PreserveSelectionStructuralChangeEventHandler(selectionLayer));

TreeLayer treeLayer = new TreeLayer(selectionLayer, new GlazedListTreeRowModel(treeData), new IndentedTreeImagePainter(), true);
ViewportLayer viewportLayer = new ViewportLayer(treeLayer);
FreezeLayer freezeLayer = new FreezeLayer(treeLayer);
CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer,selectionLayer);


As explanation:
There is a Tree implemented in the NatTable as Data Structure. This Tree can be collapsed and expanded just like in the example "TreeStructureGridExample". Now we added a FreezeLayer.

The Problem occurs, when several rows are freezed and the (for example) root node is collapsed. Then, the number of shown rows is smaller than the freezed region and the tree disappears. So the problem seems to be that the viewportLayer can't handle the state, if there are less shown rows than the size of the freezed region.

By debugging in the ViewportEventHandler of the NatTable I could preserve the disappearing by setting the startY variable to 0 before collapsing. This prevents the disappearing of the whole tree.

I implemented a function to expand the whole tree via a button. And after the described scenario (of collapsing the root node with several freezed rows) some rows are duplicated as long as the Freeze is present.

So now there are two question:
How to prevent the Tree to disappear when the rowCount is smaller than the freezed Region size of rows?
How to prevent the Tree to duplicate the elements of the freezed region?

Thanks for your help.
Re: Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470702 is a reply to message #1470665] Wed, 12 November 2014 15:02 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2809
Registered: July 2012
Senior Member
Which version of NatTable do you use? Sounds like an issue I already solved. But of course I'm not sure. Looking at _810_SortableGroupByFilterColumnGroupAndFreezeExample it looks correct.
Re: Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470777 is a reply to message #1470702] Wed, 12 November 2014 16:24 Go to previous messageGo to next message
David Schowalter is currently offline David SchowalterFriend
Messages: 11
Registered: November 2014
Junior Member
I am using NatTable Version 1.1.0
Re: Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470783 is a reply to message #1470702] Wed, 12 November 2014 16:27 Go to previous messageGo to next message
David Schowalter is currently offline David SchowalterFriend
Messages: 11
Registered: November 2014
Junior Member
Yes I also thought this should be fixed considering Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=430618, but this should be already implemented in 1.1.0 , right?
Re: Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470788 is a reply to message #1470783] Wed, 12 November 2014 16:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2809
Registered: July 2012
Senior Member
Thought there was a follow up that is fixed with 1.1.1
Re: Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470799 is a reply to message #1470788] Wed, 12 November 2014 16:45 Go to previous messageGo to next message
David Schowalter is currently offline David SchowalterFriend
Messages: 11
Registered: November 2014
Junior Member
The _810_SortableGroupByFilterColumnGroupAndFreezeExample is implemented for grouping the columns and for Freezing. This works in my implementation with a Tree.

Is Freezing in _809_GroupBySummarySummaryRowExample possible and working ok? For example, what happens, when the freeze is "below" the currently shown elements?
Re: Freezing several rows --> Collapse/Expand Root Node --> duplicate rows [message #1470833 is a reply to message #1470799] Wed, 12 November 2014 17:17 Go to previous message
David Schowalter is currently offline David SchowalterFriend
Messages: 11
Registered: November 2014
Junior Member
So I could reproduce the bug in the examples:

With _809_GroupBySummarySummaryRowExample as the basis I added a Freeze Layer like this:

FreezeLayer freezeLayer = new FreezeLayer(treeLayer);
CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer, selectionLayer);
			
setUnderlyingLayer(compositeFreezeLayer);


When the freezed region is greater than the number of rows which are displayed in the ViewportLayer, all elements dissapear. When hitting Unfreeze-Command the Table reappears.

This was tested with the NatTableExamples-1.1.1.jar.

I added a bug report here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=451217
Previous Topic:Using Combo as CellEditor - deselect value
Next Topic:Image not exported to Excel sheet
Goto Forum:
  


Current Time: Tue Apr 20 11:04:26 GMT 2021

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

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

Back to the top