Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Create TreeView In Nat Table(need an help in creating the tree viewer in the nat table)
Create TreeView In Nat Table [message #1694589] Wed, 06 May 2015 13:23 Go to next message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 47
Registered: August 2011
Member
I have an emf model and i want to represent the model data in the nat table as a tree view, to achieve this i do not know how to create the parent and child relation ship in natTable. I know about the tree viewer where i can achieve this by using the Content and label provider but, In nat how to create the content and label provider for the table input.

Thank you
Re: Create TreeView In Nat Table [message #1694624 is a reply to message #1694589] Wed, 06 May 2015 17:42 Go to previous messageGo to next message
Arye Shemesh is currently offline Arye ShemeshFriend
Messages: 37
Registered: November 2012
Member
Hi,

NatTable works in a completely different way. There are no content or label providers. You need data providers and display converters.
Try the examples at https://eclipse.org/nattable/. They include the source code and can give you a better idea of what is needed.

Hope it helps.

Re: Create TreeView In Nat Table [message #1694699 is a reply to message #1694624] Thu, 07 May 2015 08:55 Go to previous messageGo to next message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 47
Registered: August 2011
Member
Hi Shemesh,

Thank you for your help,

Yes i too agree that nat table works based on data providers and display converters. And i have already tried some examples with the help from the nat table wiki.
But my problem is that i want to display the data like a tree in nat table, for this i wrote the code same like TreeGridExample downloaded from the wiki nat example, and modify the code as per my requirement.

My requirement is that I have a List of objects and each object in the list have again a list of some objects.

for ex:
TreeList treeList = list of objects of type 'A'
And each object of type 'A' have a list of objects of type 'B'

in this case i want to create a tree with root node of object type 'A' and always 'B' type object should be the child elements of 'A' . here i do not know how to make a parent child relationship between the objects A and B
because my Tree list contains only of object type A.

Thanks in Advance


Re: Create TreeView In Nat Table [message #1694700 is a reply to message #1694699] Thu, 07 May 2015 09:15 Go to previous messageGo to next message
Arye Shemesh is currently offline Arye ShemeshFriend
Messages: 37
Registered: November 2012
Member
Hi,

From my experience, you should do the following:
1. The TreeList should contain all your objects (from types A and B), ordered by DFS. This may require you to define a common interface for them, or just work with type Object.
2. The Format implementation you pass to the TreeList should know for each object what is the path to the root object.

Hope it helps.
Re: Create TreeView In Nat Table [message #1694702 is a reply to message #1694700] Thu, 07 May 2015 09:19 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2803
Registered: July 2012
Senior Member
In NatTable the tree representation is build from a list, not a tree structure. So either you need to have a flat list as suggested above, or create a list of childs (B) and add the parents (A) dynamically on creating the tree path. The other way from parent to child might not work because the creation of the tree is done by iterating over the existing collection and building up the tree structure from there. Therefore not knowing the children will not create the tree here.

At least that is my understanding of the GlazedLists TreeList.
Re: Create TreeView In Nat Table [message #1694969 is a reply to message #1694702] Mon, 11 May 2015 05:25 Go to previous message
Shashi Mising name is currently offline Shashi Mising nameFriend
Messages: 47
Registered: August 2011
Member
Thank you Dirk and Shemesh for your kind help.
Previous Topic:Draw selection before handling selection events
Next Topic:CheckBoxCellEditor issue when editing large amount of cells
Goto Forum:
  


Current Time: Sat Mar 06 18:04:18 GMT 2021

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

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

Back to the top