org.apache.myfaces.trinidad.component
Interface ComponentProcessor<T>


public interface ComponentProcessor<T>

Interface implemented to apply the visitor pattern to a set of components where the components are not necessarily siblings of each other. When processComponent is called, the component instance is guaranteed to be in the correct context.

Instances of this interface are parameterized by the type of the callbackContext the implementor expects. The typical usage is that the implementor creates and instance of the desired context and calls a helper method on a different object (for example UIXComponent.processComponent with the desired ComponentProcessor and context instances to actually perform the iteration.

Because the ComponentProcessor can't look ahead, more complex iteration tasks, such as laying out and rendering components based on the number of components to render may require multiple-passes--one to collect the layout information into the callbackContext using one ComponentProcessor implementation and a second pass using a different ComponentProcessor to actually perform the layout using the information calculated in the first pass.

See Also:
FlattenedComponent, UIXComponent.processFlattenedChildren(FacesContext, ComponentProcessor, UIComponent, Object), UIXComponent.processFlattenedChildren(FacesContext, ComponentProcessor, Iterable, Object), UIXComponent.processFlattenedChildren(FacesContext, ComponentProcessingContext, ComponentProcessor, UIComponent, Object), UIXComponent.processFlattenedChildren(FacesContext, ComponentProcessingContext, ComponentProcessor, Iterable, Object)

Method Summary
 void processComponent(javax.faces.context.FacesContext context, ComponentProcessingContext cpContext, javax.faces.component.UIComponent component, T callbackContext)
          Processes a component
 

Method Detail

processComponent

void processComponent(javax.faces.context.FacesContext context,
                      ComponentProcessingContext cpContext,
                      javax.faces.component.UIComponent component,
                      T callbackContext)
                      throws IOException
Processes a component

Parameters:
context - The current FacesContext
cpContext - context represtinging the current component iteration state
component - Component to process on this iteration
callbackContext - ComponentProcessor-specific context
Throws:
IOException - if processing resulted in an IOException


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.