Exemplo n.º 1
0
 protected void verifyComponents(ComponentLibrary library) throws CdkException {
   // Verify types and classes. Do it first to be sure what all all values are set before second
   // stage.
   for (ComponentModel component : library.getComponents()) {
     try {
       verifyComponentType(component);
     } catch (RuntimeException e) {
       throw new CdkException("Caught error when verifying component " + component, e);
     }
   }
   // Verify component attributes
   HashSet<ComponentModel> verified = Sets.newHashSet();
   for (ComponentModel component : library.getComponents()) {
     try {
       verifyComponentType(component);
       verifyComponentAttributes(library, component, verified);
       // generate component family if missing
       if (null == component.getFamily()) {
         component.setFamily(namingConventions.inferUIComponentFamily(component.getId()));
       }
       // add facelet tag if missing
       if (component.getTags().isEmpty()) {
         TagModel tag = new TagModel();
         component.getTags().add(tag);
         tag.setName(namingConventions.inferTagName(component.getId()));
         tag.setGenerate(false);
         tag.setType(TagType.Facelets);
       }
     } catch (RuntimeException e) {
       throw new CdkException("Caught error when verifying component " + component, e);
     }
   }
 }
Exemplo n.º 2
0
 protected void verifyTag(TagModel tag, FacesId id, ClassName handler) {
   if (Strings.isEmpty(tag.getName())) {
     String defaultTagName = namingConventions.inferTagName(id);
     tag.setName(defaultTagName);
   }
   if (null == tag.getType()) {
     tag.setType(TagType.Facelets);
   }
   if (tag.isGenerate()) {
     if (null == tag.getBaseClass()) {
       // TODO - choose default handler class by tag type.
       tag.setBaseClass(handler);
     }
     if (null == tag.getTargetClass()) {
       namingConventions.inferTagHandlerClass(
           id, tag.getType().toString()); // TODO - get markup somethere.
     }
   }
   // TODO - copy component description to tag, if it has no description.
 }