// The only solution that will generate real unique ids is use the parent id and the
// facet name and derive an unique id that cannot be generated by SectionUniqueIdCounter,
// doing the same trick as with metadata: use a double __ and add a prefix (f).
// Note this id will never be printed into the response, because this is just a container.
FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx);
UniqueIdVendor uniqueIdVendor = mctx.getUniqueIdVendorFromStack();
if (uniqueIdVendor == null)
{
uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
}
if (uniqueIdVendor != null)
{
// UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
// and call createUniqueId(). See ComponentTagHandlerDelegate
int index = facetName.indexOf('.');
String cleanFacetName = facetName;
if (index >= 0)
{
cleanFacetName = facetName.replace('.', '_');
}
panel.setId(uniqueIdVendor.createUniqueId(facesContext,
mctx.getSharedStringBuilder()
.append(parent.getId())
.append("__f_")
.append(cleanFacetName).toString()));
}