org.ajax4jsf.component
Class AjaxViewRoot

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIViewRoot
              extended by org.ajax4jsf.component.AjaxViewRoot
All Implemented Interfaces:
javax.faces.component.StateHolder, org.ajax4jsf.component.AjaxContainer, org.ajax4jsf.component.AjaxContainerBase, org.ajax4jsf.event.AjaxSource

public class AjaxViewRoot
extends javax.faces.component.UIViewRoot
implements org.ajax4jsf.component.AjaxContainer

Custom ViewRoot for support render parts of tree for Ajax requests. Main difference from default ViewRoot - store events queue and unique id counter in request-scope variables. In common realisation, store request-scope variables in component produce errors in case of concurrent requests to same view.

Version:
$Revision: 1.1.2.4 $ $Date: 2007/02/28 17:01:01 $
Author:
asmirnov@exadel.com (latest modification by $Author: alexsmirnov $)

Field Summary
static java.lang.String ROOT_ID
           
 
Fields inherited from class javax.faces.component.UIViewRoot
COMPONENT_FAMILY, COMPONENT_TYPE, UNIQUE_ID_PREFIX
 
Constructor Summary
AjaxViewRoot()
           
 
Method Summary
 void addAjaxListener(org.ajax4jsf.event.AjaxListener listener)
           
 void broadcast(javax.faces.event.FacesEvent event)
           
 void broadcastAjaxEvents(javax.faces.context.FacesContext context)
           
 void clearEvents(javax.faces.context.FacesContext context)
           
 void encodeAjax(javax.faces.context.FacesContext context)
           
 void encodeChildren(javax.faces.context.FacesContext context)
           
protected  EventsQueue getAjaxEventsQueue(javax.faces.context.FacesContext context)
          Special Fifo Buffer for ajax events to Render Responce phase.
 javax.faces.el.MethodBinding getAjaxListener()
           
 org.ajax4jsf.event.AjaxListener[] getAjaxListeners()
           
protected  AjaxRegionBrige getBrige()
           
protected  EventsQueue[] getEvents(javax.faces.context.FacesContext context)
           
protected  EventsQueue getEventsQueue(javax.faces.context.FacesContext context, javax.faces.event.PhaseId phase)
          Use FIFO buffers for hold Faces Events.
 java.lang.String getRendererType()
           
 boolean getRendersChildren()
           
 java.lang.String getViewId()
           
 boolean isHavePage()
          Check for AjaxContainer component in childreh.
 boolean isImmediate()
           
 boolean isRenderRegionOnly()
           
 boolean isSelfRendered()
           
 boolean isSubmitted()
           
 void processApplication(javax.faces.context.FacesContext context)
           
 void processDecodes(javax.faces.context.FacesContext context)
           
 void processEvents(EventsQueue phaseEventsQueue, boolean havePhaseEvents)
           
 void processUpdates(javax.faces.context.FacesContext context)
           
 void processValidators(javax.faces.context.FacesContext context)
           
 void queueEvent(javax.faces.event.FacesEvent event)
           
 void removeAjaxListener(org.ajax4jsf.event.AjaxListener listener)
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setAjaxListener(javax.faces.el.MethodBinding ajaxListener)
           
 void setImmediate(boolean immediate)
           
 void setRenderRegionOnly(boolean reRenderPage)
           
 void setSelfRendered(boolean selfRendered)
           
 void setSubmitted(boolean submitted)
           
 
Methods inherited from class javax.faces.component.UIViewRoot
createUniqueId, encodeBegin, getFamily, getLocale, getRenderKitId, setLocale, setRenderKitId, setViewId
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, decode, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_ID

public static final java.lang.String ROOT_ID
See Also:
Constant Field Values
Constructor Detail

AjaxViewRoot

public AjaxViewRoot()
Method Detail

getRendererType

public java.lang.String getRendererType()
Overrides:
getRendererType in class javax.faces.component.UIComponentBase

broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException
Overrides:
broadcast in class javax.faces.component.UIComponentBase
Throws:
javax.faces.event.AbortProcessingException

getAjaxListener

public javax.faces.el.MethodBinding getAjaxListener()
Specified by:
getAjaxListener in interface org.ajax4jsf.component.AjaxContainerBase

isImmediate

public boolean isImmediate()
Specified by:
isImmediate in interface org.ajax4jsf.component.AjaxContainerBase

isSubmitted

public boolean isSubmitted()
Specified by:
isSubmitted in interface org.ajax4jsf.component.AjaxContainerBase

queueEvent

public void queueEvent(javax.faces.event.FacesEvent event)
Overrides:
queueEvent in class javax.faces.component.UIViewRoot

processEvents

public void processEvents(EventsQueue phaseEventsQueue,
                          boolean havePhaseEvents)
Parameters:
phaseEventsQueue -
havePhaseEvents -

broadcastAjaxEvents

public void broadcastAjaxEvents(javax.faces.context.FacesContext context)

getEventsQueue

protected EventsQueue getEventsQueue(javax.faces.context.FacesContext context,
                                     javax.faces.event.PhaseId phase)
Use FIFO buffers for hold Faces Events. Hold this buffers in Request scope parameters for support any concurrent requests for same component tree ( since RI hold component tree in session ).

Parameters:
context -
phase -
Returns:

getEvents

protected EventsQueue[] getEvents(javax.faces.context.FacesContext context)
Returns:

getAjaxEventsQueue

protected EventsQueue getAjaxEventsQueue(javax.faces.context.FacesContext context)
Special Fifo Buffer for ajax events to Render Responce phase.

Parameters:
context -
Returns:

clearEvents

public void clearEvents(javax.faces.context.FacesContext context)

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)
Overrides:
processDecodes in class javax.faces.component.UIViewRoot

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)
Overrides:
processUpdates in class javax.faces.component.UIViewRoot

processValidators

public void processValidators(javax.faces.context.FacesContext context)
Overrides:
processValidators in class javax.faces.component.UIViewRoot

processApplication

public void processApplication(javax.faces.context.FacesContext context)
Overrides:
processApplication in class javax.faces.component.UIViewRoot

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context)
                    throws java.io.IOException
Overrides:
encodeChildren in class javax.faces.component.UIComponentBase
Throws:
java.io.IOException

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.UIViewRoot

saveState

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

getViewId

public java.lang.String getViewId()
Overrides:
getViewId in class javax.faces.component.UIViewRoot

setAjaxListener

public void setAjaxListener(javax.faces.el.MethodBinding ajaxListener)
Specified by:
setAjaxListener in interface org.ajax4jsf.component.AjaxContainerBase

setImmediate

public void setImmediate(boolean immediate)
Specified by:
setImmediate in interface org.ajax4jsf.component.AjaxContainerBase

setSubmitted

public void setSubmitted(boolean submitted)
Specified by:
setSubmitted in interface org.ajax4jsf.component.AjaxContainerBase

addAjaxListener

public void addAjaxListener(org.ajax4jsf.event.AjaxListener listener)
Specified by:
addAjaxListener in interface org.ajax4jsf.event.AjaxSource

getAjaxListeners

public org.ajax4jsf.event.AjaxListener[] getAjaxListeners()
Specified by:
getAjaxListeners in interface org.ajax4jsf.event.AjaxSource

removeAjaxListener

public void removeAjaxListener(org.ajax4jsf.event.AjaxListener listener)
Specified by:
removeAjaxListener in interface org.ajax4jsf.event.AjaxSource

isSelfRendered

public boolean isSelfRendered()
Specified by:
isSelfRendered in interface org.ajax4jsf.component.AjaxContainerBase

setSelfRendered

public void setSelfRendered(boolean selfRendered)
Specified by:
setSelfRendered in interface org.ajax4jsf.component.AjaxContainerBase

isHavePage

public boolean isHavePage()
Check for AjaxContainer component in childreh. This is workaround for MyFaces JSP tag implementation, not called any encode... methods in tag. If only one AjaxContainer present as children for viewRoot, decoding methods delegated to them.

Returns:
Returns the havePage.

getRendersChildren

public boolean getRendersChildren()
Overrides:
getRendersChildren in class javax.faces.component.UIComponentBase

isRenderRegionOnly

public boolean isRenderRegionOnly()
Specified by:
isRenderRegionOnly in interface org.ajax4jsf.component.AjaxContainer

setRenderRegionOnly

public void setRenderRegionOnly(boolean reRenderPage)
Specified by:
setRenderRegionOnly in interface org.ajax4jsf.component.AjaxContainer

encodeAjax

public void encodeAjax(javax.faces.context.FacesContext context)
                throws java.io.IOException
Specified by:
encodeAjax in interface org.ajax4jsf.component.AjaxContainer
Throws:
java.io.IOException

getBrige

protected AjaxRegionBrige getBrige()
Returns:
the brige


Copyright © 2008. All Rights Reserved.