Another approach would be to try and intercept stuff as each component
is rendered; for your purposes that's fine, yes? So how about this:
* Override the default RenderKit with a wrapper of your own.
* On each call to addRenderer(...), call:
super.addRenderer(new MyRendererWrapper(r));
so all the standard renderer objects have a custom wrapper around them
* Your custom wrapper then intercepts encodeBegin(), and potentially
updates the component's "rendered" state before delegating on to the
real renderer.
I can't think of anything else at the moment.
I hope some of this helps.
Thanks for your extensive answer! I will consider the solution above but I think I will get by in the beginning by hooking the components rendered-attribute into a map containing booleans for the hiding-of-components-part. I will also look into the Facelets to see if its safe to use in production stuff. Fortunately the application I'm designing is small enough to handle refactoring as I go along and learn more.
I tried to be clever(?) and add a backing-bean-bound dummy control at the very end of the JSP page and then manipulate the components that had been added to the tree earlier but It seems to be like you said that the components are rendered as they go and not when the tree is complete :-/

