You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/09/17 23:47:35 UTC

svn commit: r576596 - in /myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator: ./ taglib/

Author: awiner
Date: Mon Sep 17 14:47:35 2007
New Revision: 576596

URL: http://svn.apache.org/viewvc?rev=576596&view=rev
Log:
TRINIDAD-706: JSF 1.2: Non-EL attributes of tags are always generated as Strings
- Really, only fully fixed this for boolean attributes, as that's all that's coming up here

Modified:
    myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java
    myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
    myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/MyFacesComponentTagGenerator.java
    myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java

Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java?rev=576596&r1=576595&r2=576596&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java Mon Sep 17 14:47:35 2007
@@ -141,8 +141,14 @@
     if (is12 && property.isMethodBinding())
       return "MethodExpression";
 
-    if (is12 && !property.isLiteralOnly())
-      return "ValueExpression";
+    if (is12)
+    {
+      if (!property.isLiteralOnly())
+        return "ValueExpression";
+      else
+        return property.getPropertyClass();
+    }
+
     return "String";
   }
 }

Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java?rev=576596&r1=576595&r2=576596&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java Mon Sep 17 14:47:35 2007
@@ -224,7 +224,8 @@
   }
 
 
-  public void writeReleaseMethod(PrettyWriter out, Collection components) throws IOException
+  public void writeReleaseMethod(
+    PrettyWriter out, Collection components) throws IOException
   {
     Collection all = new HashSet();
     boolean special = false;
@@ -255,7 +256,14 @@
         PropertyBean property = (PropertyBean) properties.next();
         String propName = property.getPropertyName();
         String propVar = "_" + propName;
-        out.println(propVar + " = null;");
+        out.print(propVar + " = ");
+        String type = GeneratorHelper.getJspPropertyType(property, is12());
+        // FIXME: support all primitive types.  In practice, the only types
+        // that have come up are ValueExpression, String, and boolean
+        if ("boolean".equals(type))
+          out.println("false;");
+        else
+          out.println("null;");
       }
       out.unindent();
       out.println("}");
@@ -268,6 +276,11 @@
   {
     // nothing by default
   }
+
+  /**
+   * Returns true if the method is being used for generating JSF 1.2 code.
+   */
+  protected abstract boolean is12();
 
   protected abstract void writePropertyDeclaration(PrettyWriter out,
                                                    PropertyBean property) throws IOException;

Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/MyFacesComponentTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/MyFacesComponentTagGenerator.java?rev=576596&r1=576595&r2=576596&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/MyFacesComponentTagGenerator.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/MyFacesComponentTagGenerator.java Mon Sep 17 14:47:35 2007
@@ -46,6 +46,11 @@
   {
     _is12 = is12;
   }
+  
+  protected boolean is12()
+  {
+    return _is12;
+  }
 
   protected void addSpecificImports(Set imports,
                                     ComponentBean component)

Modified: myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java?rev=576596&r1=576595&r2=576596&view=diff
==============================================================================
--- myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java (original)
+++ myfaces/trinidad-maven/trunk/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java Mon Sep 17 14:47:35 2007
@@ -47,6 +47,11 @@
     _is12 = is12;
   }
 
+  protected boolean is12()
+  {
+    return _is12;
+  }
+
   protected void addSpecificImports(Set imports,
                                     ComponentBean component)
   {