• Post Reply Bookmark Topic Watch Topic
  • New Topic

SWT and Renderers?

 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there!

I have a question about the representation of SWT-Widgets. I need a table and one column of the table should be represented as a tree.

In Swing, this is absolutely no problem. In the table model, I could return (maybe for column 3) nested data (instead of a string). Then, I implement a TableCellRenderer and return a filled tree as renderer component for column 3.

Is there any way to realize this in SWT?

Thanks for your help!
Florian
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should look like this:

 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't anybody know a solution?
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, I just couldn't solve the problem...
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't anybody know a solution?
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, I just couldn't solve the problem...
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't anybody know a solution?
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be that there is no easy or straightforward solution. In some areas SWT doesn't provide the same and/or as much functionality as Swing does. Since the original post is over two months old I think this is something you are probably going to have to develop yourself. If you do end up doing that please post the results here and/or submit it to the eclipse SWT group. Repeated postings to bring the topic back to the top of the forum usually doesn't get you anywhere.
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, thank you :-) just wanted to hear that there really isn't an easy solution that can be done like with Swing.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this what you want?
http://www.java2s.com/ExampleCode/SWT-JFace-Eclipse/DemonstratesTableTreeTableTree.htm
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, that certain looks similar. I wonder why I didn't find it when I was Googling around?
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dunno...
I swear by this one and koders.com. BTW, whoever said somewhere that it's hard to find information on SWT, doesn't know where to look. First of all these two sites are great for code reference, second when you can't find exectly what you are looking for take existing application and disect it. While learning SWT, I took rssowl application and looked at how these guys did it, and used it in my application. Here is the screenshot of what I've got in two days of work: screeshot
This is a database client sql runner application. I mean with SWT GUI building almost comes naturally, and array of components and libraries that can be used in your application is unbelivable.
Anyway, this might be wrong place to start this topic, it's just that for the past week I've been reading on and off about how SWT sucks compared to Swing and how Swing is much better...I had to put my two...

thanks,
Alex
[ January 12, 2006: Message edited by: Alex Kravets ]
 
Isaac Jones
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alex Kravets:
Is this what you want?
http://www.java2s.com/ExampleCode/SWT-JFace-Eclipse/DemonstratesTableTreeTableTree.htm


well I think that's not exactly what he meant. as it is shown in his example he wants to have the expand / collapse boxes in the 2nd column.

does anyone know how that could be done?
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surely it's possible looking at the code to figure out how to render second column with a tree. Take a look here

[ January 13, 2006: Message edited by: Alex Kravets ]
[ January 13, 2006: Message edited by: Alex Kravets ]
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"S Gl",

Please review the JavaRanch naming policy and change your display name.
 
Meyer Florian
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alex Kravets:
Surely it's possible looking at the code to figure out how to render second column with a tree. Take a look here

[ January 13, 2006: Message edited by: Alex Kravets ]

[ January 13, 2006: Message edited by: Alex Kravets ]


It doesn't seem to be possible in TableTree to set a column as the starting column for the tree branching other than column 1. If I'm wrong in this point, please help me out.
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course it's possible, otherwise why would this [TableTree] be created with such precise positioning.
In this code:


Notice that for loop goes from 0 to NUM, where NUM=3 (number of columns). If you change start index in the loops from 0 to 1 and before these loops start building columns create column 1, then you tree will be in column 2. May be you need to change some code a little bit, but 0 and NUM are magic numbers here.

Alex
[ January 16, 2006: Message edited by: Alex Kravets ]
 
Isaac Jones
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
well I've tried it too and I can't get it to work. I always get the tree in first column. if it's that easy to do can you give me an example?
that would be great.

thanks in advance, isaac
 
Isaac Jones
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Alex

can you please help me out here. I'm not sure what you have meant earlier. What should I find in the API? You would help me a lot if you could post some sample code. That would be really great.

Thanks in advance.

with kind regards...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!