I am watching this wiki info concerning the composite components; Here is the snippet :
package com.example;
import javax.faces.component.FacesComponent;
import javax.faces.component.UINamingContainer;
@FacesComponent("ratingComponent")
public class RatingComponent extends UINamingContainer {
public Object[] getItems() {
Object totalStars = getAttributes().get("totalStars");
int size = Integer.valueOf(String.valueOf(totalStars));
return new Object[size];
}
}
And then it's usage :
<h:dataTable value="#{bean.products}" var="product">
<h:column>#{product.name}</h:column>
<h:column><my:rating score="#{product.rating}" /></h:column>
</h:dataTable>
the taglib.xml (I am testing with) ...
<tag>
<tag-name>rating</tag-name>
<component>
<component-type>ratingComponent</component-type>
</component>
</tag>
...
I am just wondering how to make my:rating tag be able to contain <ui:insert/>
which should make possible to use my:rating in this way :
<my:rating score="#{product.rating}" >
<h:panelGrid border="1" columns="1" layout="block">
<h:panelGroup><label value="Lovely stars"/></h:panelGroup>
etc...
</h:panelGrid>
</my:rating>
So my question is... if component is the composite one how to make it insert-able?
Thanks