8 Apr 2010 9:39 AM #1
Tree Panel Icon Overlays
I am trying to figure out how to add overlay icons to existing icons in a tree panel.
I currently have a tree panel and have set an icon provider that will change the icon of each tree node based on the model data that supports each tree node.
I would like to be able to overlay another icon (a transparent gif with an exclamation mark) if the tree node model data has a property that identifies the node as important.
I know that I could duplicate all of my icons and provide an important version of all of them however this seems like a 'hack' especially as I have hundreds of different icons that can be displayed in my tree and it would seem far more sensible to have a single transparent 'important' icon and just overlay this on top.
Has anyone done anything like this before or could anyone offer and suggestions where I should start trying to do this?
9 Apr 2010 12:32 AM #2
Hi, you can change the icon element like this:
BaseTreeModel model = myTree.getSelectionModel().getSelectedItem()
//findNode is protected so write ur own class with a method which calls findNode, in my case findNodeForModel
Element iconElement = myTree.getTree().getView().getIconElement(myTree.findNodeForModel(selectedItem));
19 May 2010 8:32 AM #3
Did anyone figure out a way to do this? Contextual icons are something I would quite like to have, but if possible I would like to avoid generating the full set of each icon combined with each individual overlay.