Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.myfaces.orchestra.viewController
Interface ViewControllerManager

All Known Implementing Classes:
  AbstractAnnotationsViewControllerManager, AbstractViewControllerManager, AnnotationsViewControllerManager, DefaultViewControllerManager, PlainAnnotationsViewControllerManager

    public interface ViewControllerManager

Route per-view lifecycle events to the correct user methods.

The name "view" is used for the resource that the user has accessed. For example with JSF either one or two views are accessed per user request; possibly a "postback" and always a "render" view. Orchestra adaptors for other UI frameworks select an interpretation of the name "view" appropriate for that framework.

Orchestra retrieves a concrete implementation of this interface and invokes it at the appropriate processing phases. Exactly what those phases are depend upon the underlying UI framework. The concrete ViewControllerManager is then responsible for determining which beans should receive callbacks (based upon the resource that the user has accessed)

Orchestra provides a default implementation of this interface; see `DefaultViewControllerManager`.

## Defining your own ViewControllerManager

If you would like to customise the way beans are located for a view, or which methods are invoked on them then either

- Implement this interface directly, or
- Subclass `AbstractViewControllerManager` (the recommended way).

To activate your custom manager, configure it as a managed bean (preferably in application or singleton scope), using the bean-name `org.apache.myfaces.orchestra.viewController.ViewControllerManager` (see constant `VIEW_CONTROLLER_MANAGER_NAME`).

## How the ViewControllerManager is invoked

Each UI framework needs to ensure that the ViewControllerManager is retrieved via the special name shown above, and invoked at appropriate times. For example, for JSF see class @{org.apache.myfaces.orchestra.viewController.jsf.ViewControllerPhaseListener}; this is automatically configured for JSF applications when the orchestra jarfile is placed in the classpath.

Field Summary
`static java.lang.String` | `VIEW_CONTROLLER_MANAGER_NAME`

Method Summary
`void` | `assertConversationState(java.lang.String viewId)` Check whether any conversations required for the specified view currently exist.
`void` | `executeInitView(java.lang.String viewId)` This method is guaranteed to be called before any other lifecycle method (ie any of the other execute* methods on this interface.
`void` | `executePreProcess(java.lang.String viewId)` This method is called at most once per request for each view.
`void` | `executePreRenderView(java.lang.String viewId)` This method is called just before a view is required to render its representation back to the user.
`java.lang.Object` | `getViewController(java.lang.String viewId)`
`java.lang.String` | `getViewControllerName(java.lang.String viewId)`

Field Detail

### VIEW_CONTROLLER_MANAGER_NAME

    static final java.lang.String VIEW_CONTROLLER_MANAGER_NAME

Method Detail

### getViewController

    java.lang.Object getViewController(java.lang.String viewId)

### getViewControllerName

    java.lang.String getViewControllerName(java.lang.String viewId)

### assertConversationState

    void assertConversationState(java.lang.String viewId)

  Check whether any conversations required for the specified view currently exist.

  TODO: Consider renaming this method. It is very Orchestra-specific, although this ViewController framework is supposed to be generic. In fact this method is really just a "validate view" hook, and one of the validations that can be hooked in here is a conversation-check.

### executeInitView

    void executeInitView(java.lang.String viewId)

  This method is guaranteed to be called before any other lifecycle method (ie any of the other execute* methods on this interface. It is also guaranteed to be called before any expression in a page is evaluated.

  For component-based frameworks, the component tree may not yet exist.

### executePreProcess

    void executePreProcess(java.lang.String viewId)

  This method is called at most once per request for each view.

  For component-based frameworks, this method gets called after all components have transferred their state into associated backing beans. If validation errors have occurred within the view, then this method is not invoked.

### executePreRenderView

    void executePreRenderView(java.lang.String viewId)

  This method is called just before a view is required to render its representation back to the user.

  If a view X handles a "postback" event, and then navigates to a different view Y then this callback does not occur for the controller bean for view X, but does get invoked for the controller bean for view Y.

  For component-based frameworks, the component tree may not yet exist at the time this method is invoked.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation. All Rights Reserved.