org.apache.myfaces.orchestra.flow.components
Class FlowCallComponent

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by org.apache.myfaces.orchestra.flow.components.FlowCallComponent
All Implemented Interfaces:
javax.faces.component.StateHolder

public class FlowCallComponent
extends javax.faces.component.UIComponentBase

A component which allows the configuration for a flow-call to be defined in the page rather than in a separate flow.xml file.

A page can contain zero or more of these tags. It is recommended that all flowCall tags be placed at the top of the view definition file (eg immediately after the f:view) so that the flows can clearly be seen at a glance. However placing tags next to the command components that can be used to trigger the associated outcome is also reasonable.

Defining flow-calls via tags is particularly useful when the component that triggers the call is in a "view fragment" that is included into other pages via jsp:include or facelets templating. In that case, defining the flow call configuration in a separate file that is associated with the *including* view is ugly, and an in-page tag is preferable.

This must be a component (rather than just being implemented in a JSP tag) because the flowcall information must be available at the end of the postback phase when navigation occurs. The render phase has not run, so no JSF tags have executed; the view tree consists just of objects recreated from the saved state. Therefore the flowcall info must be held by a component that is recreated during RESTORE_VIEW.

It would not be good to re-parse the nested text on each postback; that would be very inefficient. Therefore we parse it just once and store the (serializable) FlowCall object as a member. This does mean that if the nested text changes then this will be ignored until the view is recreated, but it is not expected that the flow config data will be dynamic. In fact, that would be quite insane.


Field Summary
static String COMPONENT_FAMILY
           
static String COMPONENT_TYPE
           
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
FlowCallComponent()
           
 
Method Summary
 void encodeChildren(javax.faces.context.FacesContext context)
          Suppress rendering of children.
 String getFamily()
           
protected  javax.faces.render.Renderer getRenderer(javax.faces.context.FacesContext context)
           
 boolean getRendersChildren()
          Return true so that method encodeChildren gets called.
 boolean isInitialized()
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
 Object saveState(javax.faces.context.FacesContext context)
           
 void setBody(javax.el.ELContext elContext, String content)
           
 void setOutcome(String outcome)
           
 void setService(String service)
           
 void setViewId(String viewId)
           
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getContainerClientId, getValueExpression, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY
See Also:
Constant Field Values

COMPONENT_TYPE

public static final String COMPONENT_TYPE
See Also:
Constant Field Values
Constructor Detail

FlowCallComponent

public FlowCallComponent()
Method Detail

getFamily

public String getFamily()
Specified by:
getFamily in class javax.faces.component.UIComponent

isInitialized

public boolean isInitialized()

setOutcome

public void setOutcome(String outcome)

setViewId

public void setViewId(String viewId)

setService

public void setService(String service)

setBody

public void setBody(javax.el.ELContext elContext,
                    String content)

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         Object state)
                  throws javax.faces.FacesException
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UIComponentBase
Throws:
javax.faces.FacesException

saveState

public Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.UIComponentBase

getRenderer

protected javax.faces.render.Renderer getRenderer(javax.faces.context.FacesContext context)
Overrides:
getRenderer in class javax.faces.component.UIComponentBase

getRendersChildren

public boolean getRendersChildren()
Return true so that method encodeChildren gets called.

Overrides:
getRendersChildren in class javax.faces.component.UIComponentBase

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context)
                    throws IOException
Suppress rendering of children.

We don't expect there to ever be children here. However it's best to be sure...

Overrides:
encodeChildren in class javax.faces.component.UIComponentBase
Throws:
IOException


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