Esempio n. 1
0
 /** Returns a id unique within the facelet context. */
 public String generateUniqueId() {
   String id;
   TagAttribute idAttr = tagConfig.getTag().getAttributes().get("id");
   if (idAttr != null) {
     id = idAttr.getValue(context);
   } else {
     id = context.getFacesContext().getViewRoot().createUniqueId();
   }
   return generateUniqueId(id);
 }
Esempio n. 2
0
 /**
  * Copies tag attributes with given names from the tag config, using given id as base for the id
  * attribute.
  */
 public TagAttributes copyTagAttributes(String id, String... names) {
   List<TagAttribute> list = new ArrayList<TagAttribute>();
   list.add(createIdAttribute(id));
   for (String name : names) {
     if ("id".equals(name)) {
       // ignore
       continue;
     }
     TagAttribute attr = tagConfig.getTag().getAttributes().get(name);
     if (attr != null) {
       list.add(attr);
     }
   }
   TagAttribute[] attrs = list.toArray(new TagAttribute[list.size()]);
   return new TagAttributes(attrs);
 }
Esempio n. 3
0
 /**
  * Creates an attribute with given name and value.
  *
  * <p>The attribute namespace is assumed to be empty.
  */
 public TagAttribute createAttribute(String name, String value) {
   if (value == null || value instanceof String) {
     return new TagAttribute(tagConfig.getTag().getLocation(), "", name, name, value);
   }
   return null;
 }
Esempio n. 4
0
 /** Creates a unique id and returns corresponding attribute, using given string id as base. */
 public TagAttribute createIdAttribute(String base) {
   String value = generateUniqueId(base);
   return new TagAttribute(tagConfig.getTag().getLocation(), "", "id", "id", value);
 }