PDA

View Full Version : Changing color of nodes in tree panel



arthy
27 Oct 2009, 6:17 AM
Hoi ...

I browsed all kinds of forums to answer the following question - unfortunately without success:

In GXT 2.0.2 I try to render the foreground color of some tree nodes in a different color (reason: in the underlying business model these nodes are not editable). The tree nodes can be both: folders or leaves.

Is there a way without subclassing base widgets?

Thanx!
Arthy

Seven7
29 Oct 2009, 6:40 PM
I asked the same question a while ago. Finally I figured out how it works...

You need create ModelStringProvider as the label provider of the tree. The ModelStringProvider has one method that returns a string. You can return
something like this:

return "<span style='color: #bbb'>" + label + "</span>"

then the text node is in light grey.

arthy
2 Nov 2009, 5:18 AM
Yiiiiiehaaaa ... Thanx - worked perfectly!