Exemplo n.º 1
0
 /**
  * @param library
  * @param component
  * @param verified
  */
 protected void verifyComponentAttributes(
     ComponentLibrary library,
     final ComponentModel component,
     Collection<ComponentModel> verified) {
   // There is potential StackOverflow, so we process only components which have not been
   // verified before.
   if (!verified.contains(component)) {
     // Propagate attributes from parent component, if any.
     verified.add(component);
     if (null != component.getBaseClass()) {
       try {
         // Step one, lookup for parent.
         ComponentModel parentComponent = findParent(library.getComponents(), component);
         component.setParent(parentComponent);
         if (null == component.getFamily()) {
           component.setFamily(parentComponent.getFamily());
         }
         // To be sure what all properties for parent component were propagated.
         verifyComponentAttributes(library, parentComponent, verified);
         for (PropertyBase parentAttribute : parentComponent.getAttributes()) {
           PropertyBase attribute = component.getOrCreateAttribute(parentAttribute.getName());
           attribute.merge(parentAttribute);
           // already exists in parent component.
           attribute.setGenerate(false);
         }
       } catch (NoSuchElementException e) {
         // No parent component in the library
       }
     } // Check attributes.
     for (PropertyBase attribute : component.getAttributes()) {
       verifyAttribute(attribute, component);
     }
     // compact(component.getAttributes());
     // Check renderers.
     // Check Tag
     for (TagModel tag : component.getTags()) {
       verifyTag(tag, component.getId(), DEFAULT_COMPONENT_HANDLER);
     }
     verifyDescription(component);
     for (FacetModel facet : component.getFacets()) {
       verifyDescription(facet);
     }
   }
 }