O'Reilly logo

ExtGWT Rich Internet Application Cookbook by Odili Charles Opute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Decorating trees with icons

The default TreePanel implementation only renders icons (arrow and folder) on parent nodes and can use a single icon on all child nodes, with a call to its getStyle().setLeafIcon() method, which takes icons as AbstractImagePrototype objects.

However, we can use a ModelIconProvider implementation to set any AbstractImagePrototype object (icon) on any node or type/group of nodes within a TreePanel instance, and we can do this with information around or within the model object of that particular node.

Consider a TreePanel instance of files, such that we have an icon for each mime-type the node represents, be it .gif, .png, .jpg, .pdf, .txt, .class, and so on.

How to do it...

Create a ModelIconProvider implementation and pass ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required