Previous | Next
WireHose Developers Guide

The layout dictionary

WHApplicationHelper provides access to the current layout dictionary in its layoutDictionary method. The location of the layout dictionary can be specified via the WHLayoutDict property, or you can call setLayoutDictionary to provide one programmatically in response to the ApplicationHelperWillFinishInitializing notification.

Usually you won't access the layout dictionary directly. Rather, the session helper looks up values in the layout dictionary for you to resolve component bindings and values.

What's specified by the layout dictionary

The layout dictionary is used to control which components are switched in for each area, page and layout. It has a very flexible structure: you can define entries which apply to all areas in a layout, all pages in a layout, an area in all layouts, a page in all layouts, an area in a page in a layout, etc.

Components that inherit from WHComponent often resolve their bindings through the layout dictionary rather than being set directly by a parent component. A component's color binding can resolve to "blue" in one area, and "green" in another, depending on the current area, page and layout.

The current layout

By default, WireHose will use the value of the user's currentLayout property to determine which layout to use. You can override this by calling setCurrentLayout. WHSessionHelper can also automatically determine which layout to use by sniffing HTTP request headers during its constructor. This is useful for temporarily overriding the user's layout preference depending on the device they are currently using to access the application.

Rapid turnaround

During development, you can disable caching the layout dictionary through the WHDisableLayoutDictionaryCaching property. If this property is true, WHApplication will force the layout dictionary to be reloaded before each incoming request is handled. This allows you to make changes in the layout dictionary and see them immediately without re-launching your application.

Refer to these sections

Previous | Next