示例#1
0
 /**
  * Add a sub component to a UI component.
  *
  * <p>Since 6.0, does not the set the component as rendered anymore.
  *
  * @param context
  * @param parent
  * @param child
  * @param defaultChildId
  * @return child comp
  */
 public static UIComponent hookSubComponent(
     FacesContext context, UIComponent parent, UIComponent child, String defaultChildId) {
   // build a valid id using the parent id so that it's found everytime.
   String childId = child.getId();
   if (defaultChildId != null) {
     // override with default
     childId = defaultChildId;
   }
   // make sure it's set
   if (childId == null) {
     childId = context.getViewRoot().createUniqueId();
   }
   // reset client id
   child.setId(childId);
   child.setParent(parent);
   return child;
 }