Arbit - project tracking

Arbit - project tracking

API documentation :: Docs For Class arbitViewModelDecorationDependencyInjectionManager

Core::View::arbitViewModelDecorationDependencyInjectionManager

Class arbitViewModelDecorationDependencyInjectionManager

View decoration manager.

View decoration manager. The view decoration manager knows about a list of decorators for view models, which are stored dependant on the view handler, which allows different decorators for different output types. The decorators for view models are specified through callbacks to the decorators methods. If the callback is a string, which would normally just call some global function, it is interpreted as a non-static call on the view handler object. Each call to a callback may either return the same object again, a different view model object, or a string.

  • If a string (or another scala, array or an object not inheriting from arbitDecorateable) has been returned, the view generation is considered finished for this substructure and may just be displayed.
  • If a different model has been returned the process restarts for the new model type.
  • If the same object, or a object of the same class, has been returned the next decorator in the callback stack will be called for this object.
If there is no callback defined for a view model, the callbacks for the parent classes of the view model will be used in descending depth. There should always be a callback for the root class (arbitDecorateable), so that everything will be displayed somehow.

Author(s):
Version:   $Revision: 1692 $
License:   GPL

Member Variables

protected static array $decorators
Array containing the decorator callbacks.

Array containing the decorator callbacks. Each callback is specified for the used view handler to allow view handler specific callbacks, like a diffferent decoration for JSON and XML output. A callback is specified for a specific view model struct. If there are no callbacks found for one struct, the callbacks defined for its parent classes are used. There may be multiple callbacks registered for one struct, which are called subsequently. The array has the following structure:

  1.   array(
  2.       'arbitViewHandler' => array(
  3.           'arbitViewModel' => array(
  4.               Callback,
  5.               Callback,
  6.               ...
  7.           ),
  8.           ...
  9.       ),
  10.       ...
  11.   )

protected static arbitViewHandler $viewHandler
Currently used view handler instance.

Currently used view handler instance.

Method Summary

public static void addDecorator( $handler , $model , $callback )
Add a decorator Add a new or additional decorator for a view model.
public static mixed decorate( $model )
Decorate a view model Applies available decorators to the given vew model until somthing displayable has been generated. in the class level documentation.
public static void setViewHandler( $handler )
Set current view handler Set the view handler to look up decorators for, and which will be used to call non-static decorator callbacks on. details).

Methods

addDecorator

static void addDecorator( string $handler , string $model , callback $callback )

Add a decorator Add a new or additional decorator for a view model.

Add a decorator Add a new or additional decorator for a view model.

Parameters:
Name Type Description
$handler string
$model string
$callback callback

decorate

static mixed decorate( arbitDecorateable $model )

Decorate a view model Applies available decorators to the given vew model until somthing displayable has been generated. in the class level documentation.

Decorate a view model Applies available decorators to the given vew model until somthing displayable has been generated. The algorithm used for this is described in the class level documentation. The method will return the decorator result, which will never be a arbitDecorateable again, but may depend on the used decorator implementations. In most implementations a string will be returned.

Parameters:
Name Type Description
$model arbitDecorateable

setViewHandler

static void setViewHandler( arbitViewHandler $handler )

Set current view handler Set the view handler to look up decorators for, and which will be used to call non-static decorator callbacks on. details).

Set current view handler Set the view handler to look up decorators for, and which will be used to call non-static decorator callbacks on. (See class description for details).

Parameters:
Name Type Description
$handler arbitViewHandler
Documentation generated on Mon, 05 Apr 2010 14:01:47 +0200 by phpDocumentor 1.4.3