Hi Leonardo,

Ok, I've finally figured out where some of the confusion between us is
coming from re parent/superClass etc (and classSource, which had me very
puzzled today). The issue is about what exactly a ComponentMeta instance
models. It can:
 (a) model the classes that were annotated.
 (b) model the classes that will exist after code generation.
I was expecting (a) but (b) is what has been implemented. Hence the
confusion.

I've added a unit test to make it easy to see exactly what does happen
(see recent commit) [1].

For the simple cases (base classes or interfaces that are not
components, or hand-written components) these two things are of course
the same. However they are different once code-generation is considered.

Without "template mode" component generation, I think (a) is better. But
approach (a) doesn't allow other projects to extend components generated
using "template mode" component generation (because the actual class
might not be public). So (b) is needed.

Or we could use approach (c) and model both. I actually like this idea
quite a lot. A class that is annotated in a way that triggers
code-generation would create TWO ComponentMeta objects: one for itself,
and one for the class to be generated. I think that would make things
much clearer...

[1] This unit test seems to have also found a bug in the creation of the
"parent" field, which currently looks like ".Foo" rather than
"packagename.Foo".

Regards,
Simon


>         
>         
>         In Tomahawk, class AbstractHtmlDataScroller has these
>         annotations:
>          * @JSFJspProperty name = "onkeydown" tagExcluded = "true"
>          * @JSFJspProperty name = "onkeypress" tagExcluded = "true"
>          * @JSFJspProperty name = "onkeyup" tagExcluded = "true"
>          * @JSFJspProperty name = "onmousedown" tagExcluded = "true"
>          * @JSFJspProperty name = "onmousemove" tagExcluded = "true"
>          * @JSFJspProperty name = "onmouseout" tagExcluded = "true"
>          * @JSFJspProperty name = "onmouseover" tagExcluded = "true"
>          * @JSFJspProperty name = "onmouseup" tagExcluded = "true"
>         
>         I can't currently figure out what these are for. These
>         properties are in
>         the Attributes map, so they don't need to be referenced in
>         saveState/restoreState. And because tagExcluded is true, they
>         are not
>         written into the tld.
>         
>         So what do these annotations do?
>         
> 
> This annotations remove from the tld this properties, because there
> are not provided by the renderer, but inherited from
> org.apache.myfaces.component.html.ext.HtmlPanelGroup. 

Ah. I didn't see those annotations because I followed the "extends" link
in my IDE, which took me to the generated class not the template class.
And only the template class has the annotations on it.

I've updated componentClass11.vm to output the original sourceCource as
a comment on generated classes so it's easy to find the template class.

> Solutions?
> 
> 1. Use the same pattern as rendered property for UISelectItem
> 2. Implement this properties on the renderer.

I think that this is just another case of broken OO hierarchy. I see no
reason why a DataScroller should subclass HtmlPanelGroup. If it used a
more appropriate parent class there would be no problem.

For the moment, I guess we can leave things as they are. Later we can
try to fix the OO hierarchy appropriately.

>  
>         
>         >
>         >         == tagExcluded
>         >
>         >         I'm also trying to figure out exactly what
>         "tagExcluded=true"
>         >         means on
>         >         JSFJspProperty, and whether we can get rid of it.
>         
>         >
>         
>         > Really, id, binding and renderer are the only properties
>         that
>         > sometimes uses extensively
>         > @JSFJspProperty tagExcluded=true, because override it could
>         cause
>         > problems or be imposible (binding)
>         
>         
>         As you've probably seen, I've defined getter/setter methods
>         for id and
>         rendered on the relevant classes, and used
>          @JSFProperty tagExcluded=true
>         on them.
> 
> Yeap, I see the changes on myfaces api 1.1 and 1.2 yesterday. There is
> a probem with some tomahawk component that extends from UISelectItem
> and use rendered property (obviously throw Unsupported....., but the
> solution is very easy.

Is this just a theoretical problem, or is there really a component that
does this?

Regards,
Simon
> 

Reply via email to