next up previous contents
Next: Supported widgets Up: Adapters Previous: Class StaticContainerAdapter   Contents

Support for adapter instantiation

As already seen, since version 1.2 class Controller offers two new methods to support instantiation of adapters.

register_adapters()
This method is called by the framework when it is the best time to create all adapters. All that users are required to do is to override this method into their controllers derived from Controller.

adapt(...)
This method can be used within register_adapters to adapt properties and widgets. Arguments can be one of the following:

  1. Property name as a string. A corresponding widget is searched among view's widgets and if only one match is found, a default adapter is created. The type of the created adapter depends both on the property and the widget type. Widget name matching is performed by searching the property name into widget names, case insensitive.

  2. Property name and widget name. Like previous but widget name is explicitly declared.

  3. An instance of an Adapter. The adapter must be already connected to a widget.

The first two flavors of method adapt allows for an easy construction of a default adapter, but only the third allows for a full control.


next up previous contents
Next: Supported widgets Up: Adapters Previous: Class StaticContainerAdapter   Contents
Roberto Cavada 2008-08-26