Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Nattable Tree Structure
Nattable Tree Structure [message #1632688] Tue, 24 February 2015 12:22 Go to next message
Nithya Th is currently offline Nithya ThFriend
Messages: 5
Registered: February 2015
Junior Member
I am having an issue in creating the tree structure using rowmodel. I have one class <A> which contains the list of class object <B> as child. when i create the structure the tree is getting displayed as A -> B1 ->B2

But actually i wanted the child B1 and B2 in the same level like A ->B1 B2
Kindly help me in creating the tree structure. Can any body provide an example to display the list of child objects .

Thank you so much.
Re: Nattable Tree Structure [message #1632865 is a reply to message #1632688] Tue, 24 February 2015 14:32 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2809
Registered: July 2012
Senior Member
Have a look at the various tree examples in the NatTable example application.
Re: Nattable Tree Structure [message #1636213 is a reply to message #1632865] Thu, 26 February 2015 04:57 Go to previous messageGo to next message
Nithya Th is currently offline Nithya ThFriend
Messages: 5
Registered: February 2015
Junior Member
Thanks for the reply. I have seen the examples and tried in the same way. But exactly how to display the structure using getpath functionality for the tree structure in the way we wanted. Kindly provide me one sample for that....
Re: Nattable Tree Structure [message #1636594 is a reply to message #1636213] Thu, 26 February 2015 09:13 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2809
Registered: July 2012
Senior Member
If I understand correctly you have a collection of elements A that have children B. And you want them to be shown on the same level. So the first thing to say is, that is not a tree! The path is used to specify the tree structure. So adding elements to the path leads to have nodes and leaves. If you don't want to show a tree structure, maybe you should think about some other technique.

And sorry, I don't have the time to provide samples for every use case out there for free. And I don't even understand your requirement and why you are using a tree if you don't want to show a tree.
Re: Nattable Tree Structure [message #1639149 is a reply to message #1636594] Fri, 27 February 2015 13:36 Go to previous messageGo to next message
Nithya Th is currently offline Nithya ThFriend
Messages: 5
Registered: February 2015
Junior Member
Thank you so much for your patience and reply. Sorry i think i dint explain the structure fully i guess. My requirement is to display a tree. But iam not getting the structure as tree.
Code:
Class A and Class B
public void getPath(List<Object> path, Object element) {
if (element instanceof <Class A>) {
<Class A> sInstance = (<Class A>) element;
path.add(element);
List<Class B> sList = sInstance.getChildrens();

if (sInstance.getChildrens().size() > 0) {
for (int i = 0; i <sInstance.getChildrens().size(); i++) {

path.add(sInstance.getChildrens().get(i));
}

This is the path structure
So i want to display the tree structure like B1 and B2 are the child elements of A1 with same level
A1
->B1
-> B2
A2
->B3
->B4

but with the code whatever i have written in getpath iam getting structure like this. only B1 is the child of A1 and B2 is the child of B1
A1
->B1
----> B2
A2
-> B3
----> B4

i want to display the B instances in the same level. And further within B again i want to display the c Instances.( the tree hierarachy goes like this.).

Thanks for your patience. Waiting for your reply.
Re: Nattable Tree Structure [message #1639195 is a reply to message #1639149] Fri, 27 February 2015 14:06 Go to previous messageGo to next message
Dirk Fauth is currently online Dirk FauthFriend
Messages: 2809
Registered: July 2012
Senior Member
Well the main thing is that with NatTable and the TreeList you are showing a list transformation. But your elements are children of list elements and not list elements themselves.

So with adding elements to the path it is possible to extend the list with parent elements, but I don't know how you could create a tree structure out of a hierarchical object relation.
Re: Nattable Tree Structure [message #1647649 is a reply to message #1639195] Tue, 03 March 2015 14:44 Go to previous message
Amol Salunke is currently offline Amol SalunkeFriend
Messages: 16
Registered: March 2015
Junior Member
Hi Nithya,

Did you find the solution for your above problem?
Previous Topic:Copy the text from Non Editable Cell
Next Topic:Nattable Tree Structure
Goto Forum:
  


Current Time: Fri Apr 16 12:32:00 GMT 2021

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

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

Back to the top