Previous | Next
WireHose Developers Guide

Editors and renderers

Earlier in this tutorial, you built custom renderers for RSS items and feeds. You added a couple lines to the layout dictionary so WireHose would know to use your renderer instead of the default WHShowResource component. This section describes a few more details about that mechanism.

A common action when rendering a WireHose page is to iterate over a list of objects, and select the appropriate renderer for that object. for example, WHTagDrillerPage iterates over a list of resources which have been tagged with the current tag. For each resource, it uses a WHSwitchRenderer to determine which component to use to render it.

Switchers keep the session helper updated as to which object is currently being rendered or edited. The currentRenderer() and currentEditor() methods look up an area-level dictionary called "renderers" or "editors" to determine which component to use. Here's a sample:

pages = {
    MyPage = {
        someArea = {
            renderers = {
                MyPicture = ShowMyPicture;
                Customer = ShowCustomer;
            editors = {
                MyPicture = EditMyPicture;
                Customer = WHBlank; // don't allow editing

If it doesn't find an entry for a particular entity, the session helper will look for an entry for each of the current entity's parent entities until it finds a match, so you can have entity-specific renderers as shown in the example.

Note: You can provide your own custom WHSwitchRenderer subclass to enable special behavior or appearance. See the reference documentation for details.

Previous | Next