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.