You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/06/05 08:56:57 UTC

svn commit: r663478 - in /myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder: model/ComponentMeta.java qdox/QdoxModelBuilder.java

Author: lu4242
Date: Wed Jun  4 23:56:56 2008
New Revision: 663478

URL: http://svn.apache.org/viewvc?rev=663478&view=rev
Log:
set abstract generation model as default and add template=true

Modified:
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java
    myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java?rev=663478&r1=663477&r2=663478&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/model/ComponentMeta.java Wed Jun  4 23:56:56 2008
@@ -61,6 +61,8 @@
     private Boolean _generatedComponentClass;
     private Boolean _generatedTagClass;
     
+    private Boolean _template;
+    
     protected Map _properties;
     protected Map _facets;
 
@@ -88,6 +90,7 @@
         out.writeElement("implements", cm._implements);
         out.writeElement("generatedComponentClass", cm._generatedComponentClass);
         out.writeElement("generatedTagClass", cm._generatedTagClass);
+        out.writeElement("template", cm._template);
         
         for (Iterator i = cm._properties.values().iterator(); i.hasNext();)
         {
@@ -132,6 +135,7 @@
         digester.addBeanPropertySetter(newPrefix + "/implements");
         digester.addBeanPropertySetter(newPrefix + "/generatedComponentClass");
         digester.addBeanPropertySetter(newPrefix + "/generatedTagClass");
+        digester.addBeanPropertySetter(newPrefix + "/template");
         
         PropertyMeta.addXmlRules(digester, newPrefix);
         FacetMeta.addXmlRules(digester, prefix);
@@ -409,6 +413,18 @@
     {
         return ModelUtils.defaultOf(_generatedTagClass,false);
     }
+    
+    public void setTemplate(Boolean template)
+    {
+        _template = template;
+    }
+
+    public Boolean isTemplate()
+    {
+        return ModelUtils.defaultOf(_template,false);
+    }
+
+    
 
     /**
      * Specifies if the component supports child components.

Modified: myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java?rev=663478&r1=663477&r2=663478&view=diff
==============================================================================
--- myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java (original)
+++ myfaces/myfaces-build-tools/trunk/maven2-plugins/myfaces-builder-plugin/src/main/java/org/apache/myfaces/buildtools/maven2/plugin/builder/qdox/QdoxModelBuilder.java Wed Jun  4 23:56:56 2008
@@ -677,14 +677,14 @@
                 .getFullyQualifiedName());
         componentClass = getString(clazz,"clazz",props,componentClass);
         
+        //The parent class is always what is indicated or the
+        //superclass of the class that has the @JSFComponent class
         String componentParentClass = getString(clazz, "parent", props, 
                 clazz.getSuperJavaClass()!= null?
                         clazz.getSuperJavaClass().getFullyQualifiedName():null);
         
         String superClassName = getString(clazz,"superClass",props,null);
         
-        
-        
         if (componentParentClass != null && componentParentClass.startsWith("java.lang"))
         {
             componentParentClass = null;
@@ -697,6 +697,20 @@
                 componentParentClass = null;
             }
         }
+ 
+        Boolean template = getBoolean(clazz,"template",props, null);
+        
+        // If the componentClass is not the same as the class with
+        // @JSFComponent annotation, the component class is generated 
+        if (!clazz.getFullyQualifiedName().equals(componentClass)){
+            if (!(template != null && template.booleanValue()))
+            {
+                //If template is false or null, the superClass of the generated
+                //class is the same class, otherwise is the same as the parent
+                //class.
+                superClassName = getString(clazz,"superClass",props,clazz.getFullyQualifiedName());
+            }
+        }
                 
         String longDescription = clazz.getComment();
         String descDflt = getFirstSentence(longDescription);
@@ -741,6 +755,7 @@
         component.setChildren(canHaveChildren);
         component.setSerialuid(serialuid);
         component.setImplements(implementsValue);
+        component.setTemplate(template);
         
         JavaClass[] interfaces = clazz.getImplementedInterfaces();
         for (int i = 0; i < interfaces.length; ++i)