UIData accesses its grandchild components directly
--------------------------------------------------

         Key: MYFACES-781
         URL: http://issues.apache.org/jira/browse/MYFACES-781
     Project: MyFaces
        Type: Bug
  Components: Implementation  
    Reporter: Simon Kitching


For an HTML table, much of the decoding process is controlled by the components 
rather than the renderer.
In the class javax.faces.component.UIData, method "processColumnChildren" 
(which is called by processDecodes) does this:

  for (Iterator it = getChildren().iterator(); it.hasNext();)
  {
      UIComponent child = (UIComponent) it.next();
      if (child instanceof UIColumn)
      {
          if (!child.isRendered())
          {
              //Column is not visible
              continue;
          }
          for (Iterator columnChildIter = child.getChildren()
              .iterator(); columnChildIter.hasNext();)
          {
             UIComponent columnChild = (UIComponent) columnChildIter
                  .next();
             process(context, columnChild, processAction);
          }
      }
  }

And that last call to process them calls component.processDecodes, which 
delegates to the renderer as needed.

However this code means UIData is accessing its *grandchildren* directly, 
rather than just its children. I don't believe this is very nice OO design; 
UIData's children should be responsible for managing their own children, ie the 
UIColumn class should be told to process the children rather than calling 
getChildren on it and manipulating those directly. 

It also makes it impossible for a custom UIColumn class to receive decode 
calls; they go direct to the custom column's children.

See this email thread for more info, esp. responses by Mike Kienenberger 
(thanks, Mike):
  http://www.mail-archive.com/users%40myfaces.apache.org/msg11363.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to