Creating a Tree row renderer
Table of Contents
You can use a custom row renderer to change the appearance and behavior of a row of data in a Tree control when the standard features do not meet your needs.
A row renderer usually extends the mx.controls.treeclasses.TreeRow class, which extends the mx.controls.listclasses.SelectableRow class. Although the SelectableRow class has a rich API, only two methods must be overridden for a custom row renderer. The row renderer must implement the setValue() method, which is responsible for drawing the row, and the size() method, which is responsible for spacing the items in the row.
If you include the standard disclosure and icon images in the row renderer, it must extend the TreeRow class. The custom row renderer's setValue() method must call super.setValue(), its createChildren() method must call super.createChildren(), and its size() method must call super.size(). The TreeRow class is the default row renderer for a Tree control. The TreeRow class handles the indenting, disclosure (and its state), icon, and text of the row. It is also responsible for handling presses on the disclosure button, instructing the Tree control to open or close the display of the subTree. It is responsible for initiating the edit operations on editable Tree controls.
If the standard TreeRow items are not required, the row renderer can extend the SelectableRow class directly.
The following figure shows an application that contains a Tree control with a custom row renderer that displays CheckBox controls at the left side of each row:



