Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Problem with Tree and Hide Row(The tree structure is broken by hiding rows)
Problem with Tree and Hide Row [message #1800518] Mon, 31 December 2018 23:14 Go to next message
Yves Prelot is currently offline Yves PrelotFriend
Messages: 13
Registered: September 2016
Junior Member
I have written a tree using NatTable, that almost mimicks the TreeGridExample.

It shows as expected.

However, the HideRow command breaks the tree which doesn't render properly.

I have searched the forum for a similar problem, but failed to identify one.

I have uploaded my code for investigation by whomever wants.

Just hide the 'suisse' row and see that 'germany' loses its children and that the tree generally becomes mangled.

I have played around with the comparator method (which would seem the likely culprit) to no avail.


Yves
Re: Problem with Tree and Hide Row [message #1800663 is a reply to message #1800518] Fri, 04 January 2019 18:05 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
You are using the RowHideShowLayer and even I don't know what "doesn't render properly" and "generally becomes mangled" means, I suppose the behavior is correct with that layer. The RowHideShowLayer simply hides a row. It does not take care of the data structure and does not modify the data structure itself. It simply avoids rendering a row. Therefore modifying the comparator or anything else related to data will never work as the hide operation is performed on a higher level.

You should have a look at the GlazedListsRowHideShowLayer which hides the row by actually filtering the item in the underlying FilterList. This should solve your issues.
Re: Problem with Tree and Hide Row [message #1800669 is a reply to message #1800663] Fri, 04 January 2019 19:57 Go to previous messageGo to next message
Yves Prelot is currently offline Yves PrelotFriend
Messages: 13
Registered: September 2016
Junior Member
I did not use the GlazedListsRowHideShowLayer because the comments explicitely states that This might not work correctly in combination with other filters like e.g. the filterrow which I require more than the Hide Row function.

As for "doesn't render properly" and "generally becomes mangled", here is a screenshot, before and after: The RowHide command just doesn't hide one row: It also hides that Row children (so it is somehow aware about the tree structure), but the rendering process doesn't care about the tree structure anymore after that, which causes the tree to be rendered uncorrectly.

I just used the context menu command Hide Row on Row 9.

Possibly the HideRowLayer should be marked as not compatible with the TreeLayer ? I also suggest you modify or retire the TreeGridExample because I mostly tried to copy that example.

Thanks
Yves

  • Attachment: after.png
    (Size: 43.44KB, Downloaded 150 times)
  • Attachment: before.png
    (Size: 46.96KB, Downloaded 134 times)

[Updated on: Fri, 04 January 2019 19:58]

Report message to a moderator

Re: Problem with Tree and Hide Row [message #1800670 is a reply to message #1800669] Fri, 04 January 2019 20:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I think the TreeLayer handles the HideRowCommand and adds the child rows for a multi hide row command.
I don't recognize the rendering error you are talking about. Simply four rows are hidden. But maybe I miss some detail. But on sort or filter it might look incorrect.

Why should I mark something incompatible? It actually works as far as I can see.
And why should I retire an example that basically works?
Re: Problem with Tree and Hide Row [message #1800684 is a reply to message #1800670] Sat, 05 January 2019 09:27 Go to previous messageGo to next message
Yves Prelot is currently offline Yves PrelotFriend
Messages: 13
Registered: September 2016
Junior Member
See Row 17 & 18 in the "after" image, and compare with the same items in the "before" image: they are shown with children they don't have. Conversely, Row 14 in the "before" image has lost its own children.

Furthermore, and logically, when you click on the +/- signs in the "after" tree, nothing happens.

The 4 inital files are all that you need to have the example actually run.

Your example looks like it works, but I believe it doesn't : it is too simple as far as trees are involved (depth too low) for the problems to materialize ; in addition, you use a non standard compare function for the tree, which I believe few users would use; I tried it on my own exemple, and it renders the tree in a quite different, not very natural, way.

[Updated on: Sat, 05 January 2019 09:41]

Report message to a moderator

Re: Problem with Tree and Hide Row [message #1800689 is a reply to message #1800684] Sat, 05 January 2019 15:09 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Implementing a tree with GlazedLists TreeList is not very natural. And you should understand that it transforms a list into a tree structure. Having an object tree does not work well.

I am currently quite busy and therefore don't have time to investigate your issues in detail. Typically the issue is hidden in the TreeFormat.

If you think my example is incorrect and doesn't work, don't look at it. If you think NatTable does not work with trees, don't use it for that.

For me it works well in several scenarios and the GroupBy feature also shows that trees work with NatTable. But I agree that it is not very intuitive.
Re: Problem with Tree and Hide Row [message #1800690 is a reply to message #1800689] Sat, 05 January 2019 15:58 Go to previous messageGo to next message
Yves Prelot is currently offline Yves PrelotFriend
Messages: 13
Registered: September 2016
Junior Member
I understand all of this and one of the reasons I am using NatTable is because it supports trees so well.

I also fully understand TreeList and I even directly use it to implement my own TreeRenderer (I need configurable lines between parent and child).

Unfortunately, I don't have the time to investigate that issue with the hide row function which is for me of marginal use. I still believe you should open a ticket, but of course you do as you wish.

Regards
Yves

[Updated on: Sat, 05 January 2019 15:59]

Report message to a moderator

Re: Problem with Tree and Hide Row [message #1800943 is a reply to message #1800690] Thu, 10 January 2019 07:32 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
I still believe you should open a ticket, but of course you do as you wish.


If you think there is a bug and someone should keep track of it, feel free to create a ticket here: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=NatTable

I don't see it as my responsibility to create a ticket for each question raised in the forum. It is an open source project and the bug tracker can be used by everyone.
Previous Topic:Dynamically set column span for a cell
Next Topic:Font color for a substring in a cell
Goto Forum:
  


Current Time: Fri Apr 26 11:28:17 GMT 2024

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

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

Back to the top