com.ibm.xsp.component
Class FacesEventWrapper

java.lang.Object
  extended by java.util.EventObject
      extended by javax.faces.event.FacesEvent
          extended by com.ibm.xsp.component.FacesEventWrapper
All Implemented Interfaces:
java.io.Serializable

public class FacesEventWrapper
extends javax.faces.event.FacesEvent

Used by controls that publish var(s), to ensure the vars are published during the invokeApplication (action-handling) phase of the lifecycle, when the event originates from some descendant control of the var-publishing control. See DataPublisher for how to publish and revoke vars.

The normal control event behavior is slightly complicated. During the PhaseId.APPLY_REQUEST_VALUES phase, some Renderer.decode(javax.faces.context.FacesContext, UIComponent) method will determine that this button or event handler control has been clicked, and will queue an event, to be processed later in the PhaseId.INVOKE_APPLICATION phase. The default implementation of UIComponent.queueEvent(FacesEvent) will tell the parent control, and hence each ancestor, to queue the event, until the root UIViewRoot control adds the event it is passed to some queue lists. Then in the invokeApplication phase, the viewRoot control will retrieve FacesEvent.getComponent(), and invoke the UIComponent.broadcast(FacesEvent) method on that control. That is, it only broadcasts to the control referenced by the event, not to all controls. For UICommand controls (button and event handler), the broadcast method implementation will delegate to the default XSP actionListener, which invokes the control's simple action or server script.

The FacesEventWrapper mechanism for ensuring data is available during the invokeApplication phase requires every data publishing control to implement code in its queueEvent and broadcast methods. In the queueEvent method, the event that is passed in is wrapped in a FacesEventWrapper referencing this data publishing control, then that wrapped event is passed to the superclass, instead of the original event. That ensures that this publishing control will have its broadcast method invoked. In the broadcast method it will publish its data before unwrapping the event and broadcasting to the original event's control. When implemented in all data publishing controls, the broadcast stage will involve a chain of broadcast methods, each publishing data that may be used in the simple action or server script.

To support advanced developers who may implement a renderer that queues an event with a data publishing control as its target (perhaps because they have a FacesListener listening to that control), the broadcast method should also handle events that are not FacesEventWrappers, by passing them to the superclass broadcast implementation.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
FacesEventWrapper(javax.faces.component.UIComponent component, javax.faces.event.FacesEvent facesEvent)
          Wrapper for a FacesEvent used by components which support DataSources
 
Method Summary
 javax.faces.event.FacesEvent getFacesEvent()
          Return the associated FacesEvent
 javax.faces.event.PhaseId getPhaseId()
           
 boolean isAppropriateListener(javax.faces.event.FacesListener listener)
           
 void processListener(javax.faces.event.FacesListener listener)
           
 void setPhaseId(javax.faces.event.PhaseId phaseId)
           
 
Methods inherited from class javax.faces.event.FacesEvent
getComponent, queue
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FacesEventWrapper

public FacesEventWrapper(javax.faces.component.UIComponent component,
                         javax.faces.event.FacesEvent facesEvent)
Wrapper for a FacesEvent used by components which support DataSources

Method Detail

getFacesEvent

public javax.faces.event.FacesEvent getFacesEvent()
Return the associated FacesEvent


setPhaseId

public void setPhaseId(javax.faces.event.PhaseId phaseId)
Overrides:
setPhaseId in class javax.faces.event.FacesEvent

getPhaseId

public javax.faces.event.PhaseId getPhaseId()
Overrides:
getPhaseId in class javax.faces.event.FacesEvent

isAppropriateListener

public boolean isAppropriateListener(javax.faces.event.FacesListener listener)
Specified by:
isAppropriateListener in class javax.faces.event.FacesEvent

processListener

public void processListener(javax.faces.event.FacesListener listener)
Specified by:
processListener in class javax.faces.event.FacesEvent