[ 
http://issues.apache.org/jira/browse/MYFACES-707?page=comments#action_12356465 
] 

Simon Kitching commented on MYFACES-707:
----------------------------------------

Is there any chance someone could check & commit the attached patches soon?

I've got a custom table renderer that outputs the table columns in an order 
chosen by the user. My current code implements this by *sorting* the child 
elements of the component so that the inherited rendering stuff sees the order 
I want. Yes, this sorting is very hacky but the alternative is to copy/paste 
much of the standard table renderer into my custom renderer. 

However recent commits to _ComponentChildrenList, HtmlDataTableHack and similar 
classes effectively and thoroughly breaks my hacky approach.

The provided patches should allow me (and others) to implement this sort of 
functionality in a far cleaner way, by presenting a "filtered" view of the 
child objects to the parent renderer. It's also a pretty low-risk patch.

Thanks.

> Define renderer method getChildren(UIComponent) instead of calling 
> component.getChildren directly
> -------------------------------------------------------------------------------------------------
>
>          Key: MYFACES-707
>          URL: http://issues.apache.org/jira/browse/MYFACES-707
>      Project: MyFaces
>         Type: New Feature
>   Components: Implementation
>     Reporter: Simon Kitching
>     Assignee: Martin Marinschek
>     Priority: Minor
>  Attachments: HtmlGridRendererBase.java.patch, 
> HtmlLinkRendererBase.java.patch, HtmlRenderer.java.patch, 
> HtmlTableRendererBase.java.patch
>
> Currently, org.apache.myfaces.renderkit.html.HtmlTableRenderer calls 
> "component.getChildren" directly from a number of methods.
> I would like to see a new method "getChildren(UIComponent component)" defined 
> whose default behaviour is just to return "component.getChildren", and calls 
> to component.getChildren changed to call this new method.
> This would allow me to override this new getChildren method in a subclass in 
> order to be able to control the order in which child components are rendered 
> by this component. In particular, I'm trying to extend the table renderer to 
> allow user-customisable column ordering. Currently I have to implement this 
> by having my custom renderer sort the elements in the child list of the 
> component directly which isn't elegant and (I'm afraid) may not beportable or 
> robust across releases of the library. Well it's that or duplicate every 
> method that makes this call (which is most of them).
> Perhaps this new method could even be defined in class 
> org.apache.myfaces.renderkit.html so it's available for all renderers? 
> Probably method getChildCount(Component) would need to be defined at the same 
> time, just in case someone wants to write a renderer that actually hides some 
> child components from a parent renderer.

-- 
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