All,

I am having a problem in achieving the behaviour I desire for rendering 
responses.  I would like to, at PhaseId.RENDER_RESPONSE, iterate the component 
tree, and based on clientId setRendered(true | false).  The problem is that I 
never get the component tree.  It seems that the tree is created AFTER the  
PhaseId.RENDER_RESPONSE.

I have the folowing code:
public void beforePhase(PhaseEvent pe)
  {
        UIViewRoot root=pe.getFacesContext().getViewRoot();
        log.debug( "root name = " + root.getViewId());
        log.debug( "child count = " + root.getChildCount());
        log.debug( "child count2= " +root.getChildren().size());
        log.debug( "facet count = " +root.getFacets().size());
        iterateComponentTree(root.getFacetsAndChildren(), pe.getFacesContext(), 
0);
  }
where iterateComponentTree() is a recursive method unpacking the tree and 
looking at the permissions for a component vs. logged in user and setting the 
components setRendered(true | false).  The problem is that there is no 
component tree.  The call root.getChildCount() returns 0.  I do not want to 
write rendered="#{someBean.wasteOfCode}" on every component.  

I have tried the same code in afterPhase(PhaseEvent) and am able to retreive 
the tree but cannot effect its rendering behaviour.

Perhaps someone knows of a hook that I can use?????

If not then:
What I would like to see is a configurable option to inject a RenderManager 
type bean that subscribes to some interface with one method taking the clientId 
as the param.  I could then take the clientId passed to the RenderManager and 
map my security concerns to it. UIComponentBase could use a simple class like 
this in its isRendered method.  
  
It seems that my only option at this point ( that I am aware of ) is to use AOP.

Hope to hear from someone,
Rhys

Reply via email to