users@javaserverfaces-spec-public.java.net

[jsr344-experts mirror] [jsr344-experts] Re: Re: [1072, 1079, 1109, 1110] Wrappers

From: Neil Griffin <neil.griffin_at_portletfaces.org>
Date: Tue, 18 Dec 2012 18:27:17 -0500

Hi Leonardo,

The Mojarra 2.2-SNAPSHOT version of RendererWrapper would only work for case#1 (provide a wrapper for a specific known Renderer class).

I think it would be nice to support case#2 (provide a wrapper according to an unknown Renderer class). Does MyFaces Extval already have an implementation that could be contributed?

Neil

On Dec 17, 2012, at 1:30 PM, Leonardo Uribe <lu4242_at_gmail.com> wrote:

> Hi
>
>> NG> @ListenerFor(systemEventClass = PreRenderComponentEvent.class)
>> NG> @ResourceDependency(library = "javax.faces", name = "jsf.js", target = "head")
>> NG> public class MyRenderer extends RendererWrapper implements ComponentSystemEventListener {
>
> If I have a Renderer x that I want to wrap with y, will the annotations
> under x be inherited?
>
> In MyFaces Extval case, it is necessary a wrapper that can be
> generated for all renderers in a renderkit that has that ability, but
> note in this case, the implementation should wrap the Renderer
> without know the renderer class itself.
>
> For example, if a renderer implements ComponentSystemEventListener,
> I want a wrapper that has the ability of wrap both interfaces.
>
> Since you don't really know that beforehand, I think it has sense
> to provide a "factory" method in RenderKit class. It has sense,
> because you could have multiple alternate "contracts" bound to
> a Renderer class but per renderkit.
>
> There are two cases:
>
> 1. Provide a wrapper for a specific known Renderer class.
> 2. Provide a wrapper according to an unknown Renderer class, but
> with known implemented contracts, no matter how those contracts
> are used to.
>
> Maybe something like:
>
> public Renderer createRendererWrapper(Renderer toWrap)
>
> Does that sounds good? The typical use case is when you need to
> wrap a complete RenderKit. Note for Renderer wrapper, it is useful
> to know which wrappers are present, so RendererWrapper should
> provide a way to scan them.
>
> regards,
>
> Leonardo Uribe