com.liferay.faces.bridge.renderkit.html_basic
Class ResourceRendererBridgeImpl

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by com.liferay.faces.util.render.RendererWrapper
          extended by com.liferay.faces.bridge.renderkit.html_basic.ResourceRendererBridgeImpl
All Implemented Interfaces:
EventListener, javax.faces.component.StateHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.FacesWrapper<javax.faces.render.Renderer>

public class ResourceRendererBridgeImpl
extends RendererWrapper
implements javax.faces.event.ComponentSystemEventListener, javax.faces.component.StateHolder

This class serves as a wrapper around the renderer provided by the JSF runtime (Mojarra, MyFaces) for either the h:outputScript or h:outputStylesheet components. The main purpose of wrapping the renderer is to provide a way for the bridge to keep track of which resources are being added to the <head>...</head> section of the portal page.

Author:
Neil Griffin

Constructor Summary
ResourceRendererBridgeImpl()
          This zero-arg constructor is required by the StateHolderSaver class during the RESTORE_VIEW phase of the JSF lifecycle.
ResourceRendererBridgeImpl(javax.faces.render.Renderer renderer)
           
 
Method Summary
 void encodeEnd(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent)
           
 javax.faces.render.Renderer getWrapped()
           
 boolean isTransient()
           
 void processEvent(javax.faces.event.ComponentSystemEvent event)
          Since the Mojarra com.sun.faces.renderkit.html_basic.ScriptStyleBaseRenderer class implements ComponentSystemEventListener, this class must implement that interface too, since this is a wrapper type of class.
 void restoreState(javax.faces.context.FacesContext facesContext, Object state)
           
 Object saveState(javax.faces.context.FacesContext facesContext)
           
 void setTransient(boolean newTransientValue)
           
 
Methods inherited from class com.liferay.faces.util.render.RendererWrapper
convertClientId, decode, encodeBegin, encodeChildren, getConvertedValue, getRendersChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceRendererBridgeImpl

public ResourceRendererBridgeImpl()
This zero-arg constructor is required by the StateHolderSaver class during the RESTORE_VIEW phase of the JSF lifecycle. The reason why this class is involved in restoring state is because the UIComponent.ComponentSystemEventListenerAdapter implements StateHolder and will attempt to restore the state of any class in the restored view that implements ComponentSystemEventListener. It does this first by instantiating the class with a zero-arg constructor, and then calls the restoreState(FacesContext, Object) method.


ResourceRendererBridgeImpl

public ResourceRendererBridgeImpl(javax.faces.render.Renderer renderer)
Method Detail

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext facesContext,
                      javax.faces.component.UIComponent uiComponent)
               throws IOException
Overrides:
encodeEnd in class RendererWrapper
Throws:
IOException

processEvent

public void processEvent(javax.faces.event.ComponentSystemEvent event)
                  throws javax.faces.event.AbortProcessingException
Since the Mojarra com.sun.faces.renderkit.html_basic.ScriptStyleBaseRenderer class implements ComponentSystemEventListener, this class must implement that interface too, since this is a wrapper type of class. Mojarra uses this method to intercept PostAddToViewEvent in order to add script and link resources to the head (if the target attribute has a value of "head").

Specified by:
processEvent in interface javax.faces.event.ComponentSystemEventListener
Throws:
javax.faces.event.AbortProcessingException

restoreState

public void restoreState(javax.faces.context.FacesContext facesContext,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

saveState

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

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

getWrapped

public javax.faces.render.Renderer getWrapped()
Specified by:
getWrapped in interface javax.faces.FacesWrapper<javax.faces.render.Renderer>
Overrides:
getWrapped in class RendererWrapper


Copyright © 2014 Liferay, Inc.. All Rights Reserved.