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, AjaxContainer, AjaxContainerBase, AjaxSource

public class AjaxViewRoot
extends javax.faces.component.UIViewRoot
implements 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
 
Fields inherited from class javax.faces.component.UIComponent
bindings
 
Constructor Summary
AjaxViewRoot()
           
 
Method Summary
 void addAjaxListener(AjaxListener listener)
           
 void addPhaseListener(javax.faces.event.PhaseListener newPhaseListener)
           
 void broadcast(javax.faces.event.FacesEvent event)
           
 void broadcastAjaxEvents(javax.faces.context.FacesContext context)
           
 void clearEvents()
           
protected  javax.faces.event.PhaseEvent createPhaseEvent(javax.faces.context.FacesContext context, javax.faces.event.PhaseId phaseId)
           
 void encodeAjax(javax.faces.context.FacesContext context)
           
 void encodeBegin(javax.faces.context.FacesContext context)
           
 void encodeChildren(javax.faces.context.FacesContext context)
           
 void encodeEnd(javax.faces.context.FacesContext context)
           
protected  java.lang.Object getAdditionalState(javax.faces.context.FacesContext context)
           
protected  EventsQueue getAjaxEventsQueue()
          Special Fifo Buffer for ajax events to Render Responce phase.
 javax.el.MethodExpression getAjaxListener()
           
 AjaxListener[] getAjaxListeners()
           
protected  AjaxRegionBrige getBrige()
           
protected  EventsQueue[] getEvents()
           
protected  EventsQueue getEventsQueue(javax.faces.event.PhaseId phase)
          Use FIFO buffers for hold Faces Events.
 java.lang.String getRendererType()
           
 boolean getRendersChildren()
           
 java.lang.String getViewId()
           
 boolean isImmediate()
           
 boolean isRenderRegionOnly()
           
 boolean isSelfRendered()
           
 boolean isSubmitted()
           
 void processApplication(javax.faces.context.FacesContext context)
           
 void processDecodes(javax.faces.context.FacesContext context)
           
 void processEvents(javax.faces.context.FacesContext context, EventsQueue phaseEventsQueue, boolean havePhaseEvents)
           
protected  void processPhase(javax.faces.context.FacesContext context, javax.faces.event.PhaseId phase, InvokerCallback callback)
           
protected  void processPhaseListeners(javax.faces.context.FacesContext context, javax.faces.event.PhaseId phase, boolean before)
          Send notification to a view-scope phase listeners.
 void processRestoreState(javax.faces.context.FacesContext context, java.lang.Object stateObject)
           
 java.lang.Object processSaveState(javax.faces.context.FacesContext context)
           
 void processUpdates(javax.faces.context.FacesContext context)
           
 void processValidators(javax.faces.context.FacesContext context)
           
 void queueEvent(javax.faces.event.FacesEvent event)
           
 void removeAjaxListener(AjaxListener listener)
           
 void removePhaseListener(javax.faces.event.PhaseListener toRemove)
           
protected  void restoreAdditionalState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setAjaxListener(javax.el.MethodExpression 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, getAfterPhaseListener, getBeforePhaseListener, getFamily, getLocale, getRenderKitId, setAfterPhaseListener, setBeforePhaseListener, setLocale, setRenderKitId, setViewId
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, decode, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getValueBinding, invokeOnComponent, isRendered, isTransient, 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

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.el.MethodExpression getAjaxListener()
Specified by:
getAjaxListener in interface AjaxContainerBase

isImmediate

public boolean isImmediate()
Specified by:
isImmediate in interface AjaxContainerBase

isSubmitted

public boolean isSubmitted()
Specified by:
isSubmitted in interface AjaxContainerBase

removePhaseListener

public void removePhaseListener(javax.faces.event.PhaseListener toRemove)
Overrides:
removePhaseListener in class javax.faces.component.UIViewRoot

addPhaseListener

public void addPhaseListener(javax.faces.event.PhaseListener newPhaseListener)
Overrides:
addPhaseListener in class javax.faces.component.UIViewRoot

processPhaseListeners

protected void processPhaseListeners(javax.faces.context.FacesContext context,
                                     javax.faces.event.PhaseId phase,
                                     boolean before)
Send notification to a view-scope phase listeners.

Parameters:
context -
phase -
before -

createPhaseEvent

protected javax.faces.event.PhaseEvent createPhaseEvent(javax.faces.context.FacesContext context,
                                                        javax.faces.event.PhaseId phaseId)
                                                 throws javax.faces.FacesException
Throws:
javax.faces.FacesException

processPhase

protected void processPhase(javax.faces.context.FacesContext context,
                            javax.faces.event.PhaseId phase,
                            InvokerCallback callback)

queueEvent

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

processEvents

public void processEvents(javax.faces.context.FacesContext context,
                          EventsQueue phaseEventsQueue,
                          boolean havePhaseEvents)
Parameters:
context - TODO
phaseEventsQueue -
havePhaseEvents -

broadcastAjaxEvents

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

getEventsQueue

protected EventsQueue getEventsQueue(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:
phase -
Returns:

getEvents

protected EventsQueue[] getEvents()
Returns:

getAjaxEventsQueue

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

Returns:

clearEvents

public void clearEvents()

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

encodeBegin

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

encodeEnd

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

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.el.MethodExpression ajaxListener)
Specified by:
setAjaxListener in interface AjaxContainerBase

setImmediate

public void setImmediate(boolean immediate)
Specified by:
setImmediate in interface AjaxContainerBase

setSubmitted

public void setSubmitted(boolean submitted)
Specified by:
setSubmitted in interface AjaxContainerBase

addAjaxListener

public void addAjaxListener(AjaxListener listener)
Specified by:
addAjaxListener in interface AjaxSource

getAjaxListeners

public AjaxListener[] getAjaxListeners()
Specified by:
getAjaxListeners in interface AjaxSource

removeAjaxListener

public void removeAjaxListener(AjaxListener listener)
Specified by:
removeAjaxListener in interface AjaxSource

isSelfRendered

public boolean isSelfRendered()
Specified by:
isSelfRendered in interface AjaxContainerBase

setSelfRendered

public void setSelfRendered(boolean selfRendered)
Specified by:
setSelfRendered in interface AjaxContainerBase

getRendersChildren

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

isRenderRegionOnly

public boolean isRenderRegionOnly()
Specified by:
isRenderRegionOnly in interface AjaxContainer

setRenderRegionOnly

public void setRenderRegionOnly(boolean reRenderPage)
Specified by:
setRenderRegionOnly in interface AjaxContainer

encodeAjax

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

getBrige

protected AjaxRegionBrige getBrige()
Returns:
the brige

getAdditionalState

protected java.lang.Object getAdditionalState(javax.faces.context.FacesContext context)

restoreAdditionalState

protected void restoreAdditionalState(javax.faces.context.FacesContext context,
                                      java.lang.Object state)

processSaveState

public java.lang.Object processSaveState(javax.faces.context.FacesContext context)
Overrides:
processSaveState in class javax.faces.component.UIComponentBase

processRestoreState

public void processRestoreState(javax.faces.context.FacesContext context,
                                java.lang.Object stateObject)
Overrides:
processRestoreState in class javax.faces.component.UIComponentBase


Copyright © 2010. All Rights Reserved.