示例#1
2
  protected void assignUniqueId(FaceletContext ctx, UIComponent parent, String id, UIComponent c) {

    // If the id is specified as a literal, and the component is being
    // repeated (by c:forEach, for example), use generated unique ids
    // after the first instance
    if (this.id != null && !(this.id.isLiteral() && ComponentSupport.getNeedUniqueIds(ctx))) {
      c.setId(this.id.getValue(ctx));
    } else {
      UIViewRoot root = ComponentSupport.getViewRoot(ctx, parent);
      if (root != null) {
        String uid;
        IdMapper mapper = IdMapper.getMapper(ctx.getFacesContext());
        String mid = ((mapper != null) ? mapper.getAliasedId(id) : id);
        UIComponent ancestorNamingContainer = parent.getNamingContainer();
        if (null != ancestorNamingContainer && ancestorNamingContainer instanceof UniqueIdVendor) {
          uid =
              ((UniqueIdVendor) ancestorNamingContainer).createUniqueId(ctx.getFacesContext(), mid);
        } else {
          uid = root.createUniqueId(ctx.getFacesContext(), mid);
        }
        c.setId(uid);
      }
    }

    if (this.rendererType != null) {
      c.setRendererType(this.rendererType);
    }
  }
示例#2
0
  protected void setProperties(UIComponent component) {
    if (_binding != null) component.setValueExpression("binding", _binding);

    if (_rendered != null) component.setValueExpression("rendered", _rendered);

    String type = getRendererType();
    if (type != null) component.setRendererType(type);
  }
 // Create a pristine component of the type to be used in state holder tests
 protected UIComponent createComponent() {
   UIComponent component = new UISelectItem();
   component.setRendererType(null);
   return (component);
 }
 // Create a pristine component of the type to be used in state holder tests
 protected UIComponent createComponent() {
   UIComponent component = new UIViewRoot();
   component.setRendererType(null);
   return (component);
 }