com.liferay.faces.bridge.renderkit.primefaces.internal
Class ResourceCapturingUIViewRoot

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIViewRoot
              extended by com.liferay.faces.bridge.renderkit.primefaces.internal.ResourceCapturingUIViewRoot
All Implemented Interfaces:
EventListener, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.TransientStateHolder, javax.faces.component.UniqueIdVendor, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder

public class ResourceCapturingUIViewRoot
extends javax.faces.component.UIViewRoot

This class is used by HeadRendererPrimeFacesImpl in order to workaround FACES-2061. It does this by tricking the org.primefaces.renderkit.HeadRenderer class into thinking that there are no component resources in the ViewRoot. This is necessary because the com.sun.faces.renderkit.html_basic.ScriptRenderer#encodeEnd(FacesContext,UIComponent) and com.sun.faces.renderkit.html_basic.StylesheetRenderer#encodeEnd(FacesContext,UIComponent) methods keep track of resources that have been rendered in a FacesContext attribute, which prevents the bridge's head renderer from subsequently being able to render the component resources.

In addition, this class captures (remembers) the component resources that were added by the PrimeFaces HeadRenderer.

Author:
Neil Griffin

Field Summary
 
Fields inherited from class javax.faces.component.UIViewRoot
COMPONENT_FAMILY, COMPONENT_TYPE, METADATA_FACET_NAME, UNIQUE_ID_PREFIX, VIEW_PARAMETERS_KEY
 
Fields inherited from class javax.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
 
Constructor Summary
ResourceCapturingUIViewRoot()
           
 
Method Summary
 void addComponentResource(javax.faces.context.FacesContext context, javax.faces.component.UIComponent componentResource, String target)
           
 List<javax.faces.component.UIComponent> getCapturedComponentResources(String target)
           
 List<javax.faces.component.UIComponent> getComponentResources(javax.faces.context.FacesContext context, String target)
           
 
Methods inherited from class javax.faces.component.UIViewRoot
addComponentResource, addPhaseListener, broadcastEvents, createUniqueId, createUniqueId, encodeBegin, encodeChildren, encodeEnd, getAfterPhaseListener, getBeforePhaseListener, getFamily, getLocale, getPhaseListeners, getRenderKitId, getRendersChildren, getViewId, getViewListenersForEventClass, getViewMap, getViewMap, isInView, processApplication, processDecodes, processRestoreState, processUpdates, processValidators, queueEvent, removeComponentResource, removeComponentResource, removePhaseListener, restoreState, saveState, setAfterPhaseListener, setBeforePhaseListener, setInView, setLocale, setRenderKitId, setViewId, subscribeToViewEvent, unsubscribeFromViewEvent
 
Methods inherited from class javax.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getRenderer, getRendererType, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setValueExpression, visitTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceCapturingUIViewRoot

public ResourceCapturingUIViewRoot()
Method Detail

addComponentResource

public void addComponentResource(javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent componentResource,
                                 String target)
Overrides:
addComponentResource in class javax.faces.component.UIViewRoot

getCapturedComponentResources

public List<javax.faces.component.UIComponent> getCapturedComponentResources(String target)

getComponentResources

public List<javax.faces.component.UIComponent> getComponentResources(javax.faces.context.FacesContext context,
                                                                     String target)
Overrides:
getComponentResources in class javax.faces.component.UIViewRoot


Copyright © 2015 Liferay, Inc.. All rights reserved.