/**
  * Checks for an id attribute if a brix:tile then a wicket:id
  *
  * @param tag
  * @return
  */
 private String getTagId(Tag tag) {
   Map<String, String> attributes = tag.getAttributeMap();
   String id = null;
   if (attributes != null) {
     // look for brix:tile first "id" first then "wicket:id"
     if (tag instanceof TileTag) {
       id = attributes.get(AbstractContainer.MARKUP_TILE_ID);
     }
     if (id == null) {
       id = attributes.get(getWicketIdAttributeName(tag));
     }
     return id;
   }
   return null;
 }
 /**
  * Gets the value of the "child" attribute and splits the path into a list
  *
  * @param enclosure
  * @return ids
  */
 private List<String> getChildren(Tag enclosure) {
   Map<String, String> attributes = enclosure.getAttributeMap();
   if (attributes != null) {
     if (attributes.containsKey(EnclosureHandler.CHILD_ATTRIBUTE)) {
       // split for nested components
       String[] children =
           attributes.get(EnclosureHandler.CHILD_ATTRIBUTE).split("" + Component.PATH_SEPARATOR);
       ArrayList<String> list = new ArrayList<String>();
       for (String child : children) {
         list.add(child);
       }
       return list;
     }
   }
   return null;
 }
 /**
  * Replaces the supplied enclosure child tag with the actual resolved comma separated component
  * path
  *
  * @param enclosure
  * @param children
  * @param enclosureChildTags
  */
 private void updateEnclosureChildId(
     Tag enclosure, List<String> children, List<Tag> enclosureChildTags) {
   Map<String, String> attributes = enclosure.getAttributeMap();
   if (attributes != null) {
     String child = "";
     for (int i = 0; i < children.size(); i++) {
       String childid = children.get(i);
       if (childid != null) {
         child += (child.length() > 0 ? Component.PATH_SEPARATOR : "") + childid;
       } else {
         Tag tag = enclosureChildTags.get(i);
         String id = getGeneratedTagId(tag);
         if (id != null) {
           // nested children are delimited by commas
           child += (child.length() > 0 ? Component.PATH_SEPARATOR : "") + id;
         }
       }
     }
     attributes.put(EnclosureHandler.CHILD_ATTRIBUTE, child);
   }
 }