Author: baranda
Date: Mon Nov 27 13:24:21 2006
New Revision: 479769

URL: http://svn.apache.org/viewvc?view=rev&rev=479769
Log:
Fixed a couple of issues with the trinidad generator after the merge with the 
branch that contains the myfaces generators. 
I have commented the method to discriminate between trinidad and myfaces, so 
only the trinidad generator is used now due to an existing bug in the 
implementation of Component.isTrinidadComponent, that doesn't return the right 
outcome.

Modified:
    
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
    
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
    
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java

Modified: 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java?view=diff&rev=479769&r1=479768&r2=479769
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
 Mon Nov 27 13:24:21 2006
@@ -116,13 +116,14 @@
 
     String fullClassName = component.getComponentClass();
 
-    if (component.isTrinidadComponent())
-    {
-      generator = new TrinidadComponentGenerator(getLog(), _is12());
-    }
-    else {
-               generator = new MyFacesComponentGenerator(getLog(),_is12() );
-       }
+    // TODO: uncomment when the implementation of 
component.isTrinidadComponent is fixed
+    //if (component.isTrinidadComponent())
+    //{
+        generator = new TrinidadComponentGenerator(getLog(), _is12());
+    //}
+    //else {
+       //      generator = new MyFacesComponentGenerator(getLog(),_is12() );
+       //}
 
     try
     {

Modified: 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java?view=diff&rev=479769&r1=479768&r2=479769
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
 Mon Nov 27 13:24:21 2006
@@ -1504,11 +1504,12 @@
                                StringWriter sw = new StringWriter();
                                PrettyWriter out = new PrettyWriter(sw);
 
-                               if (component.isTrinidadComponent()) {
+                // TODO: uncomment when the implementation of 
component.isTrinidadComponent is fixed
+                //if (component.isTrinidadComponent()) {
                                        generator = new 
TrinidadComponentTagGenerator(_is12());
-                               } else {
-                                       generator = new 
MyFacesComponentTagGenerator(_is12());
-                               }
+                               //} else {
+                               //      generator = new 
MyFacesComponentTagGenerator(_is12());
+                               //}
 
                                String className = 
Util.getClassFromFullClass(fullClassName);
                                String packageName = 
Util.getPackageFromFullClass(fullClassName);

Modified: 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java?view=diff&rev=479769&r1=479768&r2=479769
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java
 Mon Nov 27 13:24:21 2006
@@ -57,6 +57,11 @@
         Iterator properties = component.properties();
         properties = new FilteredIterator(properties, new 
TagAttributeFilter());
 
+        if (properties.hasNext())
+        {
+            imports.add(component.getComponentClass());
+        }
+
         while (properties.hasNext())
         {
             PropertyBean property = (PropertyBean) properties.next();
@@ -134,7 +139,7 @@
                                             PropertyBean property) throws 
IOException
     {
         String propName = property.getPropertyName();
-        String fieldPropName = property.getFieldPropertyName();
+        String fieldPropName = "_" + Util.getVariableFromName(propName);
         String propertyFullClass = property.getPropertyClass();
         String propertyClass = Util.getClassFromFullClass(propertyFullClass);
         String jspPropType = GeneratorHelper.getJspPropertyType(property, 
_is12);
@@ -147,7 +152,7 @@
                                        PropertyBean property) throws 
IOException
     {
         String propName = property.getPropertyName();
-        String fieldPropName = property.getFieldPropertyName();
+        String fieldPropName = "_" + Util.getVariableFromName(propName);
         String jspPropName = property.getJspPropertyName();
         String propVar = Util.getVariableFromName(propName);
         String setMethod = Util.getPrefixedPropertyName("set", jspPropName);
@@ -186,21 +191,21 @@
                Iterator properties = all.iterator();
         properties = new FilteredIterator(properties, new 
TagAttributeFilter());
         // TODO: only write out setProperties when properties exist
-        //    if (properties.hasNext())
-        //    {
-        out.println();
-        out.println("@Override");
-        out.println("protected void setProperties(");
-        out.indent();
-        out.println("FacesBean bean)");
-        out.unindent();
-        out.println("{");
-        out.indent();
-
-        writeSetPropertyMethodBody(out, componentClass, properties);
-        out.unindent();
-        out.println("}");
-        //    }
+        if (properties.hasNext())
+        {
+            out.println();
+            out.println("@Override");
+            out.println("protected void setProperties(");
+            out.indent();
+            out.println("FacesBean bean)");
+            out.unindent();
+            out.println("{");
+            out.indent();
+
+            writeSetPropertyMethodBody(out, componentClass, properties);
+            out.unindent();
+            out.println("}");
+        }
        }
 
        protected void writeSetPropertyMethodBody(PrettyWriter out,


Reply via email to