public class ExtendedPartialViewContext
extends javax.faces.context.PartialViewContextWrapper
The RichFaces custom version of PartialViewContext
Important differences of RichFaces implementation:
JavaScriptServiceOn following diagram, you can see which classes contributes to RichFaces specific partial view processing (find an explanation bellow):
+-------------------------+ RF: ExtendedPartialViewContextFactory
|PartialViewContextFactory|
+------------+------------+ +------------------------+
| | PartialViewContext | Mojarra: PartialViewContextImpl
+--------------->| | RF: ExtendedPartialViewContext
creates |#processPartial(PhaseId)|
+--+-------------+-------+
| |
RF: ExtendedVisitContextFactory | |
+-------------------+ | |
|VisitContextFactory| | |
+--------------+----+ uses | |creates/uses
| | |
creates | | |
v v v
+----------------------------+ +---------------------------+
| VisitContext | | VisitCallback |
| | | |
| #invokeVisitContext | | #visit |
|(UIComponent, VisitCallback)| |(VisitContext, UIComponent)|
+----------------------------+ +---------------------------+
Mojarra: PhaseAwareVisitCallback
RF: ExtendedExecuteVisitContext RF: MetaComponentProcessingVisitCallback
RF: ExtendedRenderVisitContext RF: MetaComponentEncodingVisitCallback
+-----------------------------+
| UIViewRoot |
| |
| #visitTree |
|(VisitContext, VisitCallback)|
+-----------------------------+
ExtendedPartialViewContext does (except other things) tracking of the mode (ExtendedVisitContextMode). This mode determines whether we are not inside a partial processing phase (inside processPartial(PhaseId)) or not (determined by mode equal to null).
The knowledge of current mode is leveraged by ExtendedVisitContextFactory that either use visit context created by parent factory (in a wrapper chain) in case the mode is equal to null or it creates ExtendedExecuteVisitContext (resp. ExtendedRenderVisitContext).
(Note: the null mode is necessary because the tree visiting can be leveraged outside of partial tree processing/rendering, e.g. in partial state saving)
These VisitContext wrappers makes sure that when VisitContext.invokeVisitCallback(UIComponent, VisitCallback) method is called, the actual VisitCallback created by JSF implementation is wrapped in wrappers that allows to execute (resp. render) meta-components MetaComponentProcessingVisitCallback (resp. MetaComponentEncodingVisitCallback).
While extended VisitContext implementations (ExtendedRenderVisitContext and ExtendedExecuteVisitContext) allows to visit subtrees that are not normally visited (meta-components and implicitly renderer areas, aka AjaxOutputs),
extended implementations of VisitCallback (MetaComponentProcessingVisitCallback and MetaComponentEncodingVisitCallback) do the extended processing and rendering logic for meta-components.
UIViewRoot is a place where the tree processing starts to dive into subtrees, it is called by JSF implementation of PartialViewContext.processPartial(PhaseId).
This context returns wrapped PartialResponseWriter in order to intercept its PartialResponseWriter.endDocument() method and write extensions before the document is actually ended. For more details see ExtensionWritingPartialResponseWriter.
| Constructor and Description |
|---|
ExtendedPartialViewContext(javax.faces.context.PartialViewContext wrappedViewContext,
javax.faces.context.FacesContext facesContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addImplicitExecuteIds(Collection<String> executeIds)
Adding implicitly executed areas to the list of component that should be executed.
|
protected void |
addImplicitRenderIds(Collection<String> renderIds)
Adding implicitly renderer areas to the list of component that should be rendered.
|
protected void |
addJavaScriptServicePageScripts(javax.faces.context.FacesContext context)
Add scripts collected by
JavaScriptService as a partial response extension. |
void |
appendOnbeforedomupdate(Object handler)
Append a script to onbeforedomupdate handler
|
void |
appendOncomplete(Object handler)
Append a script to oncomplete handler
|
protected org.richfaces.context.ExtendedPartialViewContext.ContextMode |
detectContextMode()
Detects in what context mode should be this partial view request processed
|
Collection<String> |
getExecuteIds() |
protected javax.faces.context.FacesContext |
getFacesContext()
Returns
FacesContext for current partial view processing context |
static ExtendedPartialViewContext |
getInstance(javax.faces.context.FacesContext facesContext)
Return current
ExtendedPartialViewContext instance for given FacesContext |
Object |
getOnbeforedomupdate()
Return onbeforedomupdate handler as an extension for partial-response
|
Object |
getOncomplete()
Return oncomplete handler as an extension for partial-response
|
javax.faces.context.PartialResponseWriter |
getPartialResponseWriter()
We are wrapping
PartialResponseWriter obtained from wrapped implementation into ExtensionWritingPartialResponseWriter. |
Collection<String> |
getRenderIds() |
Map<String,Object> |
getResponseComponentDataMap()
Returns data provided by components as an extension for partial-response response element
|
Object |
getResponseData()
Returns user-provided data as an extension for partial-response response element
|
ExtendedVisitContextMode |
getVisitMode()
Returns in which visit mode we currently operate in
|
javax.faces.context.PartialViewContext |
getWrapped() |
protected void |
initializeContext()
Initializes context:
|
boolean |
isExecuteAll() |
boolean |
isLimitRender()
Returns true if rendering in current context is limited to components listed in activator's component render attribute.
|
boolean |
isRenderAll() |
void |
prependOnbeforedomupdate(Object handler)
Prepend an onbeforedomupdate handler with given script
|
void |
prependOncomplete(Object handler)
Prepend an oncomplete handler with given script
|
void |
processPartial(javax.faces.event.PhaseId phaseId)
This method detects in which phase we are and setups
ExtendedVisitContextMode attribute. |
void |
release() |
protected void |
renderExtensions(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Render RichFaces specific extensions for partial-update such as:
beforedumpdate
complete
render
data
componentData
|
void |
setPartialRequest(boolean isPartialRequest)
This method is present in the JSF 2.2 PartialViewContextWrapper, but not in the JSF 2.1.
|
void |
setRenderAll(boolean renderAll) |
void |
setResponseData(Object responseData)
Sets user-provided data as an extension for partial-response
|
public ExtendedPartialViewContext(javax.faces.context.PartialViewContext wrappedViewContext,
javax.faces.context.FacesContext facesContext)
public javax.faces.context.PartialViewContext getWrapped()
getWrapped in interface javax.faces.FacesWrapper<javax.faces.context.PartialViewContext>getWrapped in class javax.faces.context.PartialViewContextWrapperpublic void setPartialRequest(boolean isPartialRequest)
setPartialRequest in class javax.faces.context.PartialViewContextprotected javax.faces.context.FacesContext getFacesContext()
FacesContext for current partial view processing contextpublic static ExtendedPartialViewContext getInstance(javax.faces.context.FacesContext facesContext)
ExtendedPartialViewContext instance for given FacesContextpublic void processPartial(javax.faces.event.PhaseId phaseId)
This method detects in which phase we are and setups ExtendedVisitContextMode attribute.
Then it delegates to wrapped implementation of PartialViewContext.processPartial(PhaseId).
The ExtendedVisitContextMode attribute is used by ExtendedVisitContextFactory to create either
ExtendedExecuteVisitContext or ExtendedRenderVisitContext.
processPartial in class javax.faces.context.PartialViewContextWrapperpublic Collection<String> getExecuteIds()
getExecuteIds in class javax.faces.context.PartialViewContextWrapperpublic Collection<String> getRenderIds()
getRenderIds in class javax.faces.context.PartialViewContextWrapperpublic boolean isExecuteAll()
isExecuteAll in class javax.faces.context.PartialViewContextWrapperpublic boolean isRenderAll()
isRenderAll in class javax.faces.context.PartialViewContextWrapperpublic void setRenderAll(boolean renderAll)
setRenderAll in class javax.faces.context.PartialViewContextWrapperpublic Object getResponseData()
public Map<String,Object> getResponseComponentDataMap()
public void setResponseData(Object responseData)
public void appendOncomplete(Object handler)
public void prependOncomplete(Object handler)
public Object getOncomplete()
public void appendOnbeforedomupdate(Object handler)
public void prependOnbeforedomupdate(Object handler)
public Object getOnbeforedomupdate()
public boolean isLimitRender()
public ExtendedVisitContextMode getVisitMode()
public javax.faces.context.PartialResponseWriter getPartialResponseWriter()
PartialResponseWriter obtained from wrapped implementation into ExtensionWritingPartialResponseWriter.
The wrapper makes sure the RichFaces-specific extensions are written into partial-response before the document is ended.getPartialResponseWriter in class javax.faces.context.PartialViewContextWrapperpublic void release()
release in class javax.faces.context.PartialViewContextWrapperprotected void addImplicitExecuteIds(Collection<String> executeIds)
UIViewRoot.METADATA_FACET_NAME execution.protected void addImplicitRenderIds(Collection<String> renderIds)
protected void addJavaScriptServicePageScripts(javax.faces.context.FacesContext context)
JavaScriptService as a partial response extension.protected void renderExtensions(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws IOException
IOExceptionprotected org.richfaces.context.ExtendedPartialViewContext.ContextMode detectContextMode()
protected void initializeContext()
Initializes context:
Copyright © 2016 JBoss by Red Hat. All Rights Reserved.