@HandlerInput(name="parent", type=UIComponent.class, required=false)},
output={
@HandlerOutput(name="result", type=UIComponent.class)}
)
public static void buildUIComponentTree(HandlerContext context) {
LayoutElement desc = (LayoutElement) context.getInputValue("layoutElement");
UIComponent parent = (UIComponent) context.getInputValue("parent");
// If they didn't give us a parent, make one one up...
if (parent == null) {
parent = new UIViewRoot();
((UIViewRoot) parent).setViewId("fake");
}
// Build it...
FacesContext facesCtx = context.getFacesContext();
if (desc instanceof LayoutComponent) {
// Special case if LayoutComponent is the root node element
// The LayoutViewHandler assumes that the root node is not used
// because it was written assuming that the LayoutDefinition was
// always going to be passed in. The result is that it ignores
// the LayoutElement that is passed in and goes striaight to the
// children. This isn't what we want. Process the child here,
// then continue as normal.
UIComponent tmpParent =
((LayoutComponent) desc).getChild(facesCtx, parent);
LayoutViewHandler.buildUIComponentTree(facesCtx, tmpParent, desc);
} else {
// Process normally (which in this path is probably not normal)
LayoutViewHandler.buildUIComponentTree(facesCtx, parent, desc);
}
// Get the result to return...
String id = desc.getId(facesCtx, parent);
UIComponent result = parent.findComponent(id);
if (result == null) {
// First see if we can find it in the facet Map
if (desc instanceof LayoutComponent) {
result = parent.getFacets().get(id);