You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by David Delbecq <de...@oma.be> on 2006/07/20 12:06:56 UTC

Component tag with variable componenttype, howto?

Hello,

I am in a situation where i need to write such a tab:

<custom:parameter value="parameterBean"/>

The jsf component is to be created using parameterBean.createComponent 
(....).

My first thought was to create an empty Component whose sole role was to 
ass the result of parameterBean.createComponent() as it's only child. 
However, i begin to think it might be better of the tag itself would 
call createComponent() on my bean, this would prevent creation of 
useless intermediate Components. But i am not sure how to do this, 
according to my knowledged, i need to extend UIComponentTag and this 
requires to return a componentType, which in my case is a non sense as 
the component is to be generated by createComponent(....) How can i do 
this. Am i forced to create a custom component that would only serve as 
an container to another correctly fitted component?

I hope i was clear in my request :)

Thanks for consideration,
David Delbecq

Re: Component tag with variable componenttype, howto?

Posted by David Delbecq <de...@oma.be>.
No, i try  to remove the need of an empty container.
For now i am in such situation

Tag A create component X which itself has only one child, the result of 
bean.createComponent() (let's name it Y)
X does not render anything, it has only one child, it is there only 
because i need a UI class to encapsulate bean.createComponent().
I would like to remove the need for this useless component X by having
Tag A create Y by invoking bean method.
However, am not sure this is possible to have a tag create a component 
by using such a delegation (it seems the component are created by jsf 
itself by using getComponentType on the tag, but not sure)

Julian Ray wrote:
> Is is a container such as a gridPanel that you need? If so, you could
> probably subclass the gridpanel and use a backing bean to add other
> components on demand. We do this for our tab menus.
>  
>
> -----Original Message-----
> From: David Delbecq [mailto:delbd@oma.be] 
> Sent: Thursday, July 20, 2006 6:07 AM
> To: MyFaces Discussion
> Subject: Component tag with variable componenttype, howto?
>
> Hello,
>
> I am in a situation where i need to write such a tab:
>
> <custom:parameter value="parameterBean"/>
>
> The jsf component is to be created using parameterBean.createComponent
> (....).
>
> My first thought was to create an empty Component whose sole role was to ass
> the result of parameterBean.createComponent() as it's only child. 
> However, i begin to think it might be better of the tag itself would call
> createComponent() on my bean, this would prevent creation of useless
> intermediate Components. But i am not sure how to do this, according to my
> knowledged, i need to extend UIComponentTag and this requires to return a
> componentType, which in my case is a non sense as the component is to be
> generated by createComponent(....) How can i do this. Am i forced to create
> a custom component that would only serve as an container to another
> correctly fitted component?
>
> I hope i was clear in my request :)
>
> Thanks for consideration,
> David Delbecq
>
>   


RE: Component tag with variable componenttype, howto?

Posted by Julian Ray <ju...@yahoo.com>.
Is is a container such as a gridPanel that you need? If so, you could
probably subclass the gridpanel and use a backing bean to add other
components on demand. We do this for our tab menus.
 

-----Original Message-----
From: David Delbecq [mailto:delbd@oma.be] 
Sent: Thursday, July 20, 2006 6:07 AM
To: MyFaces Discussion
Subject: Component tag with variable componenttype, howto?

Hello,

I am in a situation where i need to write such a tab:

<custom:parameter value="parameterBean"/>

The jsf component is to be created using parameterBean.createComponent
(....).

My first thought was to create an empty Component whose sole role was to ass
the result of parameterBean.createComponent() as it's only child. 
However, i begin to think it might be better of the tag itself would call
createComponent() on my bean, this would prevent creation of useless
intermediate Components. But i am not sure how to do this, according to my
knowledged, i need to extend UIComponentTag and this requires to return a
componentType, which in my case is a non sense as the component is to be
generated by createComponent(....) How can i do this. Am i forced to create
a custom component that would only serve as an container to another
correctly fitted component?

I hope i was clear in my request :)

Thanks for consideration,
David Delbecq