This is one of the "most wanted" hacks to do. Long time ago I tried it without success, but now I finally founded and alternative. Following the same principle of
MYFACES-3287, we can use a "find component expression" to locate the composite component later and setup the environment correctly. As with MYFACES-3287 if the component is inside a datatable, the code on the listener will only execute once, and not per row, which is something expected and the affected properties on the component has the same limitations.
The other part of the hack include use a listener to PostAddToViewEvent to subscribe the listener after the tree is built, so we can calculate the "find component expression" correctly.