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/11/29 17:26:03 UTC

Custom component with facets

Hello,

is there a special way to do components tags accepting facet? My problem
is that, currently, under certain conditions, components inside my
custom component facets gets rendered twice. On time, according to step
by step in eclipse, at each component doEndTag(), moment on which i have
absolutely no control, and one time in the correct flow when my custom
components renders it's facets. I suspect it's not normal the doEndTag()
of tags have their rendering logic called. It does not happen inside
panelGrid facets, so i suspect i did something wrong in my tag

The following hierarchies are failing:
mycomponent -> f:facet -> t:htmlTag -> h:graphicsImage
mycomponent -> f:facet -> t:htmlTag -> h:outputText

Those are succesfull working hierarchies (no double rendering):
mycomponent -> f:facet -> h:panelGroup -> t:htmlTag -> h:graphicsImage
mycomponent -> f:facet -> h:panelGroup -> t:htmlTag -> h:outputText


If i use a panelGrid, i don't get this buggy behaviour at all. So i
suspect i do something wrong in my tag. It's a simple UIComponentTag
based class that has String setters for parameter and implements the
setProperties() method to transfert data to component. It also defines
the family and the component type.

Example code showing problem:
        <f:facet name="content">
                <t:htmlTag value="div" styleClass="TestDiv">
                <h:outputText value="This is the picture..."/>
                <h:graphicImage id="status2"
                   
value="http://www.google.be/intl/en_com/images/logo_plain.png" />
                </t:htmlTag>
        </f:facet>
Example html output i get (the 2 additional overlayDiv are generated by
my component rendering routine):

This is the picture...
				<img id="status2" src="http://www.google.be/intl/en_com/images/logo_plain.png" />

				
				
				
		
	<div class="overlaymenuBox"><div class="overlaymenuContent"><div class="TestDiv">This is the picture...<img id="status2" src="http://www.google.be/intl/en_com/images/logo_plain.png" />

Any idea what the gridpanel does to manage facets that i forgot? My
workaround is to surround with panelGroup, but i fear i get again
problem at some level later if i forgot something.