The following snippet kind of does what I want.
[code]
UIComponent viewPanel = getContext()
.getViewRoot()
.findComponent("form:viewPanel");
viewPanel.getChildren().clear();
Resource componentResource = getApplication()
.getResourceHandler()
.createResource("custom.xhtml","components/custom");
FacesContext context = getContext();
UIComponent composite = context.getApplication().createComponent(context, componentResource);
UIComponent compositeRoot = getApplication().createComponent(UIPanel.COMPONENT_TYPE);
composite.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);
compositeRoot.setRendererType("javax.faces.Group");
try {
FaceletFactory factory = (FaceletFactory)
RequestStateManager.get(context, RequestStateManager.FACELET_FACTORY);
Facelet f = factory.getFacelet(componentResource.getURL());
f.apply(context, compositeRoot);
}
catch (Exception e) {
// ...
}
viewPanel.getChildren().add(compositeRoot);
[/code]
Now I I just need to figure out how to populate the <insertChildren> and <insertFacets> elements in the facelet.
[Message sent by forum member 'janderssn' (janderssn)]
http://forums.java.net/jive/thread.jspa?messageID=354210