You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ba...@apache.org on 2006/11/01 22:31:14 UTC

svn commit: r470122 [1/2] - in /incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces: ./ generator/ generator/component/ generator/taglib/ util/

Author: baranda
Date: Wed Nov  1 14:31:13 2006
New Revision: 470122

URL: http://svn.apache.org/viewvc?view=rev&rev=470122
Log:
Created interface ComponentTagGenerator to generate the component tag classes. Implemented the TrinidadComponentTagGenerator. 
GenerateJspTaglibsMojo now using the new/refactored TrinidadComponentTagGenerator

Added:
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java   (with props)
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java   (with props)
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java   (contents, props changed)
      - copied, changed from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/AbstractComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java   (contents, props changed)
      - copied, changed from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java   (contents, props changed)
      - copied, changed from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/MyFacesComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java   (contents, props changed)
      - copied, changed from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/TrinidadComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java   (with props)
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java   (with props)
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java   (with props)
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TrinidadComponentTagGenerator.java   (with props)
Removed:
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/AbstractComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/MyFacesComponentGenerator.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/TrinidadComponentGenerator.java
Modified:
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
    incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/util/Util.java

Modified: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java?view=diff&rev=470122&r1=470121&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java Wed Nov  1 14:31:13 2006
@@ -15,63 +15,52 @@
 */
 package org.apache.myfaces.trinidadbuild.plugin.faces;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.FileReader;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.GregorianCalendar;
-import java.util.Calendar;
-import java.sql.Date;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-
+import org.apache.commons.digester.AbstractObjectCreationFactory;
+import org.apache.commons.digester.Digester;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.GeneratorHelper;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.AttributeBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ConverterBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigParser;
-import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ValidatorBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.AttributeFilter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.ComponentFilter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.ConverterFilter;
-import org.apache.myfaces.trinidadbuild.plugin.faces.util.Filter;
-import org.apache.myfaces.trinidadbuild.plugin.faces.util.FilteredIterator;
-import org.apache.myfaces.trinidadbuild.plugin.faces.util.PropertyFilter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.Util;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.ValidatorFilter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.XIncludeFilter;
-import org.apache.commons.digester.AbstractObjectCreationFactory;
-import org.apache.commons.digester.Digester;
-
-import org.apache.maven.artifact.DependencyResolutionRequiredException;
-import org.apache.maven.model.Resource;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
 import org.codehaus.plexus.util.FileUtils;
-
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
 abstract public class AbstractFacesMojo extends AbstractMojo
 {
   protected List getCompileDependencyResources(
@@ -347,7 +336,7 @@
     String       packageName,
     Set          imports)
   {
-    Util.writeImports(out,packageName,imports);
+    GeneratorHelper.writeImports(out,packageName,imports);
   }
 
   private ClassLoader createCompileClassLoader(
@@ -496,14 +485,7 @@
     private final String _packageContains;
   }
 
-  static final protected class TagAttributeFilter extends PropertyFilter
-  {
-    protected boolean accept(
-      PropertyBean property)
-    {
-      return (!property.isTagAttributeExcluded());
-    }
-  }
+  
 
   static final protected class ComponentTagFilter extends ComponentFilter
   {

Modified: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java?view=diff&rev=470122&r1=470121&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java Wed Nov  1 14:31:13 2006
@@ -17,9 +17,9 @@
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
-import org.apache.myfaces.trinidadbuild.plugin.faces.generator.ComponentGenerator;
-import org.apache.myfaces.trinidadbuild.plugin.faces.generator.MyFacesComponentGenerator;
-import org.apache.myfaces.trinidadbuild.plugin.faces.generator.TrinidadComponentGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.component.ComponentGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.component.MyFacesComponentGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.component.TrinidadComponentGenerator;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.FacesConfigBean;

Modified: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java?view=diff&rev=470122&r1=470121&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java Wed Nov  1 14:31:13 2006
@@ -15,40 +15,11 @@
 */
 package org.apache.myfaces.trinidadbuild.plugin.faces;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringWriter;
-
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamResult;
-
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.ComponentTagGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.TagAttributeFilter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib.TrinidadComponentTagGenerator;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ConverterBean;
@@ -62,17 +33,44 @@
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.Util;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.ValidatorFilter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.util.XIncludeFilter;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-
 import org.codehaus.plexus.util.FileUtils;
-
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
 /**
  * @version $Id$
  * @requiresDependencyResolution compile
@@ -626,7 +624,7 @@
       }
       else
       {
-        ComponentTagGenerator componentGen = new ComponentTagGenerator();
+        ComponentTagHandlerGenerator componentGen = new ComponentTagHandlerGenerator();
         ConverterTagGenerator converterGen = new ConverterTagGenerator();
         ValidatorTagGenerator validatorGen = new ValidatorTagGenerator();
         int count = 0;
@@ -1469,13 +1467,25 @@
     }
   }
 
-  class ComponentTagGenerator
+  class ComponentTagHandlerGenerator
   {
     public void generateTagHandler(
       ComponentBean component)
     {
       String fullClassName = component.getTagClass();
 
+        ComponentTagGenerator generator;
+
+        if (component.isTrinidadComponent())
+        {
+            generator = new TrinidadComponentTagGenerator(_is12());
+        }
+        else
+        {
+            // TODO change this when the myfaces tag generator is created
+            generator = new TrinidadComponentTagGenerator(_is12());
+        }
+
       try
       {
         getLog().debug("Generating " + fullClassName);
@@ -1504,40 +1514,28 @@
         // package
         out.println("package " + packageName + ";");
 
-        // TODO: eliminate <mfp:tag-class-modifier> metadata
-        int modifiers = component.getTagClassModifiers();
-        String classStart = Modifier.toString(modifiers);
-
         out.println();
-        _writeImports(out, fullSuperclassName, superclassName,
-                      componentFullClass, component);
 
-        out.println("/**");
-        // TODO: remove this blank line.
-        out.println();
-        out.println(" * Auto-generated tag class.");
-        out.println(" */");
 
-        // TODO: use canonical ordering
-        classStart = classStart.replaceAll("public abstract", "abstract public");
-        out.println(classStart + " class " + className +
-                                 " extends " + superclassName);
-        out.println("{");
-        out.indent();
+        generator.writeImports(out, null, packageName, fullSuperclassName, superclassName,
+                       component);
+
+        generator.writeClassBegin(out, className, superclassName, component, null);
+
+        int modifiers = component.getTagClassModifiers();
+        generator.writeConstructor(out, component, modifiers);
 
-        _writeConstructor(out, component);
 
         if (!Modifier.isAbstract(modifiers))
         {
-          _writeGetComponentType(out, component);
-          _writeGetRendererType(out, component);
+          generator.writeGetComponentType(out, component);
+          generator.writeGetRendererType(out, component);
         }
-        _writePropertyMethods(out, component);
-        _writeSetProperties(out, componentClass, component);
-        _writeRelease(out, component);
+        generator.writePropertyMembers(out, component);
+        generator.writeSetPropertiesMethod(out, componentClass, component);
+        generator.writeReleaseMethod(out, component);
 
-        out.unindent();
-        out.println("}");
+        generator.writeClassEnd(out);
         out.close();
 
         // delay write in case of error
@@ -1556,910 +1554,7 @@
       }
     }
 
-    private void _writeImports(
-      PrettyWriter   out,
-      String         fullSuperclassName,
-      String         superclassName,
-      String         componentFullClass,
-      ComponentBean  component)
-    {
-      Set imports = new TreeSet();
-
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      if (properties.hasNext())
-      {
-        imports.add(componentFullClass);
-      }
-
-      imports.add("org.apache.myfaces.trinidad.bean.FacesBean");
-
-      // TODO: remove these imports
-      // FIXME: Actually last 2 can be kept when not abstract
-      //imports.add("javax.faces.component.UIComponent");
-
-      // superclassName is fully qualified if it collides
-      // with the generated class name and should not be
-      // imported when such a collision would occur
-      if (!superclassName.equals(fullSuperclassName))
-        imports.add(fullSuperclassName);
-
-      while (properties.hasNext())
-      {
-        PropertyBean property = (PropertyBean)properties.next();
-
-        String   propertyClass = property.getPropertyClass();
-        String[] propertyClassParams = property.getPropertyClassParameters();
-
-        if (propertyClass != null && property.isLiteralOnly())
-        {
-          // Import the property class only if only litterals are supported
-          // otherwise the class will be a String inside the tag to support 
-          // ValueBinding
-          imports.add(propertyClass);
-        }
-
-        imports.add("javax.el.ValueExpression");
-
-        if (_isKeyStroke(propertyClass))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("javax.swing.KeyStroke");
-        }
-        else if (_isAWTKeyStroke(propertyClass))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("java.awt.AWTKeyStroke");
-        }
-        else if (_isConverter(propertyClass))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("javax.faces.convert.Converter");
-        }
-        else if (property.isVirtual())
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("org.apache.myfaces.trinidadinternal.taglib.util.VirtualAttributeUtils");
-        }
-        else if (_isColorList(propertyClass, propertyClassParams))
-        {
-          if (_is12())
-            imports.add("javax.el.ValueExpression");
-          else
-            imports.add("javax.faces.el.ValueBinding");
-          imports.add("java.text.ParseException");
-          imports.add("org.apache.myfaces.trinidadinternal.taglib.util.TagUtils");
-        }
-        else if (property.isMethodBinding())
-        {
-          if (_is12())
-          {
-            imports.add("javax.el.MethodExpression");
-            imports.add("org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding");
-          }
-          else
-          {
-            imports.add("javax.faces.el.MethodBinding");
-          }
-        }
-        else if (property.isMethodExpression())
-        {
-          imports.add("javax.el.MethodExpression");
-        }
-
-        // TODO: restore import and make reference to
-        //       ConstantMethodBinding relative rather
-        //       than absolute
-        //if (property.isMethodBinding() &&
-        //    isStringMethodBindingReturnType(property))
-        //{
-        //  imports.add("org.apache.myfaces.trinidadinternal.taglib.ConstantMethodBinding");
-        //}
-      }
-
-      // do not import implicit!
-      imports.removeAll(Util.PRIMITIVE_TYPES);
-
-      String tagClass = component.getTagClass();
-      String packageName = Util.getPackageFromFullClass(tagClass);
-      writeImports(out, packageName, imports);
-    }
-
-    private void _writeConstructor(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      String fullClassName = component.getTagClass();
-      String className = Util.getClassFromFullClass(fullClassName);
-      out.println();
-      out.println("/**");
-      // TODO: restore this correctly phrased comment (tense vs. command)
-      //out.println(" * Constructs an instance of " + className + ".");
-      out.println(" * Construct an instance of the " + className + ".");
-      out.println(" */");
-      out.println("public " + className + "()");
-      out.println("{");
-      out.println("}");
-    }
-
-    private void _writeGetComponentType(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      String componentType = component.getComponentType();
-      out.println();
-      out.println("@Override");
-      out.println("public String getComponentType()");
-      out.println("{");
-      out.indent();
-      out.println("return \"" + componentType + "\";");
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeGetRendererType(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      String rendererType = component.getRendererType();
-      out.println();
-      out.println("@Override");
-      out.println("public String getRendererType()");
-      out.println("{");
-      out.indent();
-      out.println("return " + convertStringToLiteral(rendererType) + ";");
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeRelease(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      // TODO: remove special case for UIXFormTag
-      if (properties.hasNext() ||
-          "org.apache.myfaces.trinidadinternal.taglib.UIXFormTag".equals(component.getTagClass()))
-      {
-        out.println();
-        out.println("@Override");
-        out.println("public void release()");
-        out.println("{");
-        out.indent();
-        out.println("super.release();");
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          String propName = property.getPropertyName();
-          String propVar = "_" + Util.getVariableFromName(propName);
-          out.println(propVar + " = null;");
-        }
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-    private void _writePropertyMethods(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      while (properties.hasNext())
-      {
-        PropertyBean property = (PropertyBean)properties.next();
-        out.println();
-        _writePropertyMember(out, property);
-        _writePropertySet(out, property);
-      }
-    }
-
-    private void _writePropertyMembers(
-      PrettyWriter  out,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      properties = new FilteredIterator(properties, new TagAttributeFilter());
-      if (properties.hasNext())
-      {
-        out.println();
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          _writePropertyMember(out, property);
-        }
-      }
-    }
-
-    private void _writePropertyMember(
-     PrettyWriter  out,
-     PropertyBean  property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propVar = "_" + Util.getVariableFromName(propName);
-      String jspPropType = _getJspPropertyType(property);
-      
-      out.println("private " + jspPropType + " " + propVar + ";");
-    }
-
-    private String _getJspPropertyType(PropertyBean property)
-    {
-      if (property.isMethodExpression())
-        return "MethodExpression";
-
-      if (_is12() && property.isMethodBinding())
-        return "MethodExpression";
-
-      if (_is12() && !property.isLiteralOnly())
-        return "ValueExpression";
-      return "String";
-    }
-
-    private void _writePropertySet(
-     PrettyWriter  out,
-     PropertyBean  property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String jspPropName = property.getJspPropertyName();
-      String propVar = Util.getVariableFromName(propName);
-      String setMethod = Util.getPrefixedPropertyName("set", jspPropName);
-      String jspPropType = _getJspPropertyType(property);
-
-      // TODO: restore coding standards, and make final
-      out.println("public void " + setMethod + "(" + jspPropType + " " + propVar + ")");
-      out.println("{");
-      out.indent();
-      out.println("_" + propVar + " = " + propVar + ";");
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeSetProperties(
-      PrettyWriter  out,
-      String        componentClass,
-      ComponentBean component) throws IOException
-    {
-      Iterator properties = component.properties();
-      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();
-        out.println("super.setProperties(bean);");
-
-        while (properties.hasNext())
-        {
-          PropertyBean property = (PropertyBean)properties.next();
-          _writeSetPropertiesCase(out, componentClass, property);
-        }
-        out.unindent();
-        out.println("}");
-  //    }
-    }
-
-    private void _writeSetPropertiesCase(
-      PrettyWriter  out,
-      String             componentClass,
-      PropertyBean        property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propClass = property.getPropertyClass();
-      String propVar = "_" + Util.getVariableFromName(propName);
-
-      if (property.isVirtual())
-      {
-        _writeVirtualSetMethod(out, componentClass, propName);
-      }
-      else if (property.isMethodBinding())
-      {
-        _writeSetMethodBinding(out, componentClass, property);
-      }
-      else if (property.isMethodExpression())
-      {
-        _writeSetMethodExpression(out, componentClass, property);
-      }
-      else if (_isKeyStroke(propClass))
-      {
-        _writeSetKeyStroke(out, componentClass, propName);
-      }
-      else if (_isAWTKeyStroke(propClass))
-      {
-        _writeSetAWTKeyStroke(out, componentClass, propName);
-      }
-      else if (_isColorList(propClass, property.getPropertyClassParameters()))
-      {
-        _writeSetColorList(out, componentClass, propName);
-      }
-      else if (_isConverter(propClass))
-      {
-        _writeSetConverter(out, componentClass, propName);
-      }
-      else if (property.isLiteralOnly())
-      {
-        _writeSetLiteral(out, componentClass, propName, propClass, propVar);
-      }
-      else //if (_hasPropertySetter(property))
-      {
-        _writeSetProperty(out, componentClass, propName, propClass, propVar);
-      }
-  //    else
-  //    {
-  //      _writeSetValueBinding(out, componentClass, propName, propVar);
-  //    }
-    }
-
-    /**
-     * Returns true if this property is a complex Object.
-     *
-     * @return true  if this property is a complex Object,
-     *         otherwise false
-     */
-    private boolean _hasPropertySetter(
-      PropertyBean property)
-    {
-      String propertyClass = property.getPropertyClass();
-      return (Util.PRIMITIVE_TYPES.contains(propertyClass) ||
-              "java.lang.Object".equals(propertyClass) ||
-              "java.lang.String".equals(propertyClass) ||
-              "java.lang.String[]".equals(propertyClass));
-    }
-
-    private boolean _isConverter(
-      String propClass)
-    {
-      return ("javax.faces.convert.Converter".equals(propClass));
-    }
-
-    private String[] _getAccessKeyPropertyKeys(
-      String componentClass,
-      String propName)
-    {
-      String[] propKeys = new String[2];
-
-      int offset = propName.indexOf("AndAccessKey");
-      if (offset != -1)
-      {
-        String mainProp = propName.substring(0, offset);
-        propKeys[0] = componentClass + "." +
-                      Util.getConstantNameFromProperty(mainProp, "_KEY");
-        propKeys[1] = componentClass + "." +
-                      Util.getConstantNameFromProperty("accessKey", "_KEY");
-      }
-
-      return propKeys;
-    }
-
-    private boolean _isKeyStroke(
-      String propClass)
-    {
-      return ("javax.swing.KeyStroke".equals(propClass));
-    }
-
-    private boolean _isAWTKeyStroke(
-      String propClass)
-    {
-      return ("java.awt.AWTKeyStroke".equals(propClass));
-    }
-
-    private boolean _isColorList(
-      String   propClass,
-      String[] propClassParams)
-    {
-      return ("java.util.List".equals(propClass) &&
-              propClassParams.length == 1 &&
-              "java.awt.Color".equals(propClassParams[0]));
-    }
-
-    private void _writeSetLiteral(
-      PrettyWriter out,
-      String       componentClass,
-      String       propName,
-      String       propFullClass,
-      String       propVar)
-    {
-      String propClass = Util.getClassFromFullClass(propFullClass);
-      String boxedClass = Util.getBoxedClass(propClass);
-      if ((!_is12() && !boxedClass.equals(propClass)) ||
-           "java.util.Date".equals(propFullClass) ||
-          (boxedClass.indexOf("[]") != -1))
-      {
-        // TODO: reject value binding expressions for literal-only
-        _writeSetProperty(out, componentClass, propName, propFullClass, propVar);
-      }
-      else
-      {
-        String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-        out.println("bean.setProperty(" +
-                    componentClass + "." + propKey + ", " +
-                    propVar + ");" );
-       }
-    }
-
-    private void _writeSetProperty(
-      PrettyWriter out,
-      String       componentClass,
-      String       propName,
-      String       propFullClass,
-      String       propVar)
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propClass = Util.getClassFromFullClass(propFullClass);
-      String boxedClass = Util.getBoxedClass(propClass);
-      String setProperty = "setProperty";
-      if ((!_is12() && !boxedClass.equals(propClass)) ||
-           "java.util.Date".equals(propFullClass) ||
-          (boxedClass.indexOf("[]") != -1))
-      {
-        String propType = boxedClass.replaceAll("\\[\\]", "Array");
-        setProperty = Util.getPrefixedPropertyName("set", propType + "Property");
-      }
-      
-      out.println(setProperty + "(bean, " +
-                                  componentClass + "." + propKey + ", " +
-                                  propVar + ");" );
-    }
-
-    private void _writeSetValueBinding(
-      PrettyWriter out,
-      String       componentClass,
-      String       propName,
-      String       propVar)
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", " +
-                                        "createValueBinding(" + propVar + "));" );
-    }
-
-    private void _writeVirtualSetMethod(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String[] propKeys = _getAccessKeyPropertyKeys(componentClass, propName);
-
-      String propVar = "_" + propName;
-      out.println("if (" + propVar + " != null)");
-      out.println("{");
-      out.indent();
-
-      if (_is12())
-      {
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println(propVar + ",");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object o = " + propVar + ".getValue(null);");
-        out.println("if (o != null)");
-        out.indent();
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println("o.toString(),");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println("vb,");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("VirtualAttributeUtils.setAccessKeyAttribute(");
-        out.indent();
-        out.println("bean,");
-        out.println(propVar + ",");
-        out.println(propKeys[0] + ",");
-        out.println(propKeys[1] +  ");");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-      }
-
-      out.unindent();
-      out.println("}");
-    }
-
-    private void _writeSetMethodBinding(
-      PrettyWriter  out,
-      String             componentClass,
-      PropertyBean        property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      if (_is12())
-      {
-        out.println("if (" + propVar + " != null)");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", " +
-                    "new MethodExpressionMethodBinding(" + propVar + "));");
-        out.unindent();
-      }
-      else
-      {
-        MethodSignatureBean signature = property.getMethodBindingSignature();
-        String[] paramTypes = (signature != null) ? signature.getParameterTypes() : null;
-        
-        String classArray;
-        
-        if (paramTypes == null || paramTypes.length == 0)
-        {
-          classArray = "new Class[0]";
-        }
-        else
-        {
-          StringBuffer sb = new StringBuffer();
-          sb.append("new Class[]{");
-          for (int i=0; i < paramTypes.length; i++)
-          {
-            if (i > 0)
-              sb.append(',');
-            sb.append(paramTypes[i]);
-            sb.append(".class");
-          }
-          
-          // TODO: remove trailing comma
-          sb.append(',');
-          
-          sb.append('}');
-          classArray = sb.toString();
-        }
-        
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        
-        if (isStringMethodBindingReturnType(signature))
-        {
-          out.println("MethodBinding mb;");
-          out.println("if (isValueReference(" + propVar + "))");
-          out.indent();
-          out.println("mb = createMethodBinding(" + propVar + ", " + classArray + ");");
-          out.unindent();
-          out.println("else");
-          out.indent();
-          out.println("mb = new org.apache.myfaces.trinidadinternal.taglib.ConstantMethodBinding(" + propVar + ");");
-          out.unindent();
-        }
-        else
-        {
-          // never a literal, no need for ConstantMethodBinding
-          out.println("MethodBinding mb = createMethodBinding(" + propVar + ", " +
-                      classArray + ");");
-        }
-        
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", mb);");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-    private void _writeSetMethodExpression(
-      PrettyWriter  out,
-      String             componentClass,
-      PropertyBean        property) throws IOException
-    {
-      String propName = property.getPropertyName();
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      out.println("bean.setProperty(" + componentClass + "." + propKey + ", " +
-                  propVar + ");");
-    }
-
-    private void _writeSetKeyStroke(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-
-      if (_is12())
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object val = " + propVar + ".getValue(null);");
-        out.println("if (val != null)");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tKeyStroke.getKeyStroke(val.toString()));");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tKeyStroke.getKeyStroke(" + propVar + "));");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-
-    private void _writeSetAWTKeyStroke(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      if (_is12())
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object val = " + propVar + ".getValue(null);");
-        out.println("if (val != null)");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tAWTKeyStroke.getAWTKeyStroke(val.toString()));");
-        out.unindent();
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (" + propVar + " != null)");
-        out.println("{");
-        out.indent();
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("\tAWTKeyStroke.getAWTKeyStroke(" + propVar + "));");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-    }
-
-
-
-    private void _writeSetColorList(
-      PrettyWriter  out,
-      String        componentClass,
-      String        propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      out.println("if (" + propVar + " != null)");
-      out.println("{");
-      out.indent();
-      if (_is12())
-      {
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object o = " + propVar + ".getValue(null);");
-        out.println("if (o != null)");
-        out.indent();
-        out.println("{");
-        out.println("try");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("                 TagUtils.getColorList(o.toString()));");
-        out.unindent();
-        out.println("}");
-        out.println("catch (ParseException pe)");
-        out.println("{");
-        out.indent();
-        out.println("setValidationError(");
-        out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");        
-      }
-      else
-      {
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("try");
-        out.println("{");
-        out.indent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
-        out.println("                 TagUtils.getColorList(" + propVar + "));");
-        out.unindent();
-        out.println("}");
-        out.println("catch (ParseException pe)");
-        out.println("{");
-        out.indent();
-        out.println("setValidationError(");
-        out.println("  pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
-        out.unindent();
-        out.println("}");
-        out.unindent();
-        out.println("}");
-      }
-      out.unindent();
-      out.println("}");
-    }
-
-
-    private void _writeSetConverter(
-      PrettyWriter  out,
-      String             componentClass,
-      String             propName) throws IOException
-    {
-      String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
-      String propVar = "_" + propName;
-
-      out.println("if (" + propVar + " != null)");
-      out.println("{");
-      out.indent();
-      if (_is12())
-      {
-        out.println("if (!" + propVar + ".isLiteralText())");
-        out.println("{");
-        out.indent();
-        out.println("bean.setValueExpression(" + componentClass + "." + propKey + ", " + propVar + ");");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Object o = " + propVar + ".getValue(null);");
-        out.println("if (o != null)");
-        out.println("{");
-
-        out.indent();
-        out.println("Converter converter = getFacesContext().getApplication().");
-        out.indent();
-        out.println("createConverter(o.toString());");
-        out.unindent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", converter);");
-        
-        out.unindent();
-        out.println("}");
-        
-        out.unindent();
-        out.println("}");
-      }
-      else
-      {
-        out.println("if (isValueReference(" + propVar + "))");
-        out.println("{");
-        out.indent();
-        out.println("ValueBinding vb = createValueBinding(" + propVar + ");");
-        out.println("bean.setValueBinding(" + componentClass + "." + propKey + ", vb);");
-        out.unindent();
-        out.println("}");
-        out.println("else");
-        out.println("{");
-        out.indent();
-        out.println("Converter converter = getFacesContext().getApplication().");
-        out.indent();
-        out.println("createConverter(" + propVar + ");");
-        out.unindent();
-        out.println("bean.setProperty(" + componentClass + "." + propKey + ", converter);");
-        out.unindent();
-        out.println("}");
-      }
-      out.unindent();
-      out.println("}");
-    }
-  }
-
-  private boolean isStringMethodBindingReturnType(
-    MethodSignatureBean sig)
-  {
-    return (sig != null && "java.lang.String".equals(sig.getReturnType()));
+    
   }
 
   private boolean _is12()

Added: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java?view=auto&rev=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java (added)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java Wed Nov  1 14:31:13 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator;
+
+import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.SourceTemplate;
+
+import java.io.IOException;
+
+/**
+ * Generator
+ *
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public interface ClassGenerator
+{
+    void writeImports(
+            PrettyWriter out,
+            SourceTemplate template,
+            String packageName,
+            String fullSuperclassName,
+            String superclassName,
+            ComponentBean component);
+
+    void writeClassBegin(
+            PrettyWriter out,
+            String className,
+            String superclassName,
+            ComponentBean component,
+            SourceTemplate template);
+
+    void writeConstructor(
+            PrettyWriter out,
+            ComponentBean component,
+            int modifiers) throws IOException;
+
+    void writeClassEnd(
+            PrettyWriter out);
+
+}

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ClassGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java?view=auto&rev=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java (added)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java Wed Nov  1 14:31:13 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator;
+
+import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.Filter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.FilteredIterator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.Util;
+
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * TODO: comment this!
+ *
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class GeneratorHelper
+{
+    private GeneratorHelper(){}
+
+    public static boolean isConverter(
+      String propClass)
+    {
+      return ("javax.faces.convert.Converter".equals(propClass));
+    }
+
+    public static boolean isKeyStroke(
+            String propClass)
+    {
+        return ("javax.swing.KeyStroke".equals(propClass));
+    }
+
+    public static boolean isAWTKeyStroke(
+            String propClass)
+    {
+        return ("java.awt.AWTKeyStroke".equals(propClass));
+    }
+
+    public static boolean isColorList(
+            String propClass,
+            String[] propClassParams)
+    {
+        return ("java.util.List".equals(propClass) &&
+                propClassParams.length == 1 &&
+                "java.awt.Color".equals(propClassParams[0]));
+    }
+
+    static public void writeImports(
+      PrettyWriter out,
+      String       packageName,
+      Set imports)
+    {
+      Iterator iterator = imports.iterator();
+      iterator = new FilteredIterator(iterator,
+                                      new PackageImportsFilter(packageName));
+      while (iterator.hasNext())
+      {
+        String className = (String)iterator.next();
+        out.println("import " + className + ";");
+      }
+
+      out.println();
+    }
+
+    public static class PackageImportsFilter implements Filter
+    {
+      public PackageImportsFilter(
+        String packageName)
+      {
+        _packageName = packageName;
+      }
+
+      public boolean accept(
+        Object object)
+      {
+        String className = (String)object;
+        String packageName = Util.getPackageFromFullClass(className);
+        return (!packageName.equals(_packageName) &&
+                !packageName.equals("java.lang"));
+      }
+
+      private final String _packageName;
+    }
+
+    public static String getJspPropertyType(PropertyBean property, boolean is12)
+    {
+      if (property.isMethodExpression())
+        return "MethodExpression";
+
+      if (is12 && property.isMethodBinding())
+        return "MethodExpression";
+
+      if (is12 && !property.isLiteralOnly())
+        return "ValueExpression";
+      return "String";
+    }
+}

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/GeneratorHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java (from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/AbstractComponentGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java?view=diff&rev=470122&p1=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/AbstractComponentGenerator.java&r1=470045&p2=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/AbstractComponentGenerator.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java Wed Nov  1 14:31:13 2006
@@ -13,9 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.myfaces.trinidadbuild.plugin.faces.generator;
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.component;
 
 import org.apache.maven.plugin.logging.Log;
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.GeneratorHelper;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.EventBean;
@@ -289,7 +290,7 @@
         // do not import implicit types!
         imports.removeAll(Util.PRIMITIVE_TYPES);
 
-        Util.writeImports(out, packageName, imports);
+        GeneratorHelper.writeImports(out, packageName, imports);
     }
 
     protected void addSpecificImports(
@@ -603,12 +604,12 @@
         out.println("public void " + setMethod + "(" + propertyClass + " " + propVar + ")");
         out.println("{");
         out.indent();
-        writePropertySetterContent(out, property, propertyClass);
+        writePropertySetterMethodBody(out, property, propertyClass);
         out.unindent();
         out.println("}");
     }
 
-    protected abstract void writePropertySetterContent(
+    protected abstract void writePropertySetterMethodBody(
             PrettyWriter out,
             PropertyBean property,
             String propertyClass) throws IOException;
@@ -662,7 +663,7 @@
         out.println("{");
         out.indent();
 
-        writePropertyGetterContent(out, property);
+        writePropertyGetterMethodBody(out, property);
 
         out.unindent();
         out.println("}");
@@ -677,7 +678,7 @@
         return false;
     }
 
-    protected abstract void writePropertyGetterContent(
+    protected abstract void writePropertyGetterMethodBody(
             PrettyWriter out,
             PropertyBean property) throws IOException;
 

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java (from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ComponentGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java?view=diff&rev=470122&p1=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ComponentGenerator.java&r1=470045&p2=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/ComponentGenerator.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java Wed Nov  1 14:31:13 2006
@@ -1,8 +1,23 @@
-package org.apache.myfaces.trinidadbuild.plugin.faces.generator;
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.component;
 
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.ClassGenerator;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
 import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
-import org.apache.myfaces.trinidadbuild.plugin.faces.util.SourceTemplate;
 
 import java.io.IOException;
 
@@ -12,25 +27,8 @@
  * @author Bruno Aranda (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public interface ComponentGenerator
+public interface ComponentGenerator extends ClassGenerator
 {
-    void writeClassBegin(
-            PrettyWriter out,
-            String className,
-            String superclassName,
-            ComponentBean component,
-            SourceTemplate template);
-
-    void writeClassEnd(
-            PrettyWriter out);
-
-    void writeImports(
-            PrettyWriter out,
-            SourceTemplate template,
-            String packageName,
-            String fullSuperclassName,
-            String superclassName,
-            ComponentBean component);
 
     void writeGenericConstants(
             PrettyWriter out,
@@ -49,11 +47,6 @@
     void writeFacetConstants(
             PrettyWriter out,
             ComponentBean component) throws IOException;
-
-    void writeConstructor(
-            PrettyWriter out,
-            ComponentBean component,
-            int modifiers) throws IOException;
 
     void writeGetFamily(
             PrettyWriter out) throws IOException;

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/ComponentGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java (from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/MyFacesComponentGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java?view=diff&rev=470122&p1=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/MyFacesComponentGenerator.java&r1=470045&p2=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/MyFacesComponentGenerator.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java Wed Nov  1 14:31:13 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.myfaces.trinidadbuild.plugin.faces.generator;
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.component;
 
 import org.apache.maven.plugin.logging.Log;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
@@ -82,14 +82,14 @@
         out.println("setRendererType("+rendererType+");");
     }
 
-    protected void writePropertySetterContent(PrettyWriter out,
+    protected void writePropertySetterMethodBody(PrettyWriter out,
                                               PropertyBean property,
                                               String propertyClass) throws IOException
     {
         out.println("this."+property.getFieldPropertyName()+" = "+property.getPropertyName()+";");
     }
 
-    protected void writePropertyGetterContent(PrettyWriter out,
+    protected void writePropertyGetterMethodBody(PrettyWriter out,
                                               PropertyBean property) throws IOException
     {
         String varName = property.getFieldPropertyName();

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/MyFacesComponentGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java (from r470045, incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/TrinidadComponentGenerator.java)
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java?view=diff&rev=470122&p1=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/TrinidadComponentGenerator.java&r1=470045&p2=incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java&r2=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/TrinidadComponentGenerator.java (original)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java Wed Nov  1 14:31:13 2006
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.myfaces.trinidadbuild.plugin.faces.generator;
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.component;
 
 import org.apache.maven.plugin.logging.Log;
 import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
@@ -148,7 +148,7 @@
         return true;
     }
 
-    protected void writePropertySetterContent(PrettyWriter out,
+    protected void writePropertySetterMethodBody(PrettyWriter out,
                                               PropertyBean property,
                                               String propertyClass) throws IOException
     {
@@ -176,7 +176,7 @@
         }
     }
 
-    protected void writePropertyGetterContent(
+    protected void writePropertyGetterMethodBody(
             PrettyWriter out,
             PropertyBean property) throws IOException
     {

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/TrinidadComponentGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java?view=auto&rev=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java (added)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java Wed Nov  1 14:31:13 2006
@@ -0,0 +1,241 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib;
+
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.GeneratorHelper;
+import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.FilteredIterator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.SourceTemplate;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.Util;
+
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * TODO: comment this!
+ *
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public abstract class AbstractComponentTagGenerator implements ComponentTagGenerator
+{
+
+    public void writeImports(PrettyWriter out,
+                             SourceTemplate template,
+                             String packageName,
+                             String fullSuperclassName,
+                             String superclassName,
+                             ComponentBean component)
+    {
+        String componentFullClass = component.getComponentClass();
+
+        Set imports = new TreeSet();
+
+      Iterator properties = component.properties();
+      properties = new FilteredIterator(properties, new TagAttributeFilter());
+      //if (properties.hasNext())
+      //{
+      //  imports.add(componentFullClass);
+      //}
+
+      // TODO: remove these imports
+      // FIXME: Actually last 2 can be kept when not abstract
+      //imports.add("javax.faces.component.UIComponent");
+
+      // superclassName is fully qualified if it collides
+      // with the generated class name and should not be
+      // imported when such a collision would occur
+      if (!superclassName.equals(fullSuperclassName))
+        imports.add(fullSuperclassName);
+
+      while (properties.hasNext())
+      {
+        PropertyBean property = (PropertyBean)properties.next();
+
+        String   propertyClass = property.getPropertyClass();
+        String[] propertyClassParams = property.getPropertyClassParameters();
+
+        if (propertyClass != null && property.isLiteralOnly())
+        {
+          // Import the property class only if only litterals are supported
+          // otherwise the class will be a String inside the tag to support
+          // ValueBinding
+          imports.add(propertyClass);
+        }
+
+
+
+        // TODO: restore import and make reference to
+        //       ConstantMethodBinding relative rather
+        //       than absolute
+        //if (property.isMethodBinding() &&
+        //    isStringMethodBindingReturnType(property))
+        //{
+        //  imports.add("org.apache.myfaces.trinidadinternal.taglib.ConstantMethodBinding");
+        //}
+      }
+
+        addSpecificImports(imports, component);
+
+      // do not import implicit!
+      imports.removeAll(Util.PRIMITIVE_TYPES);
+
+      GeneratorHelper.writeImports(out, packageName, imports);
+    }
+
+    public void writeClassBegin(PrettyWriter out,
+                                String className,
+                                String superclassName,
+                                ComponentBean component,
+                                SourceTemplate template)
+    {
+         int modifiers = component.getTagClassModifiers();
+        String classStart = Modifier.toString(modifiers);
+
+        out.println("/**");
+        out.println(" * Auto-generated tag class.");
+        out.println(" */");
+
+        // TODO: use canonical ordering
+        classStart = classStart.replaceAll("public abstract", "abstract public");
+        out.println(classStart + " class " + className +
+                                 " extends " + superclassName);
+        out.println("{");
+        out.indent();
+    }
+
+
+    public void writeConstructor(PrettyWriter out,
+                                 ComponentBean component,
+                                 int modifiers) throws IOException
+    {
+        String fullClassName = component.getTagClass();
+      String className = Util.getClassFromFullClass(fullClassName);
+      out.println();
+      out.println("/**");
+      // TODO: restore this correctly phrased comment (tense vs. command)
+      //out.println(" * Constructs an instance of " + className + ".");
+      out.println(" * Construct an instance of the " + className + ".");
+      out.println(" */");
+      out.println("public " + className + "()");
+      out.println("{");
+      out.println("}");
+    }
+
+    public void writeGetComponentType(
+      PrettyWriter  out,
+      ComponentBean component) throws IOException
+    {
+      String componentType = component.getComponentType();
+      out.println();
+      out.println("@Override");
+      out.println("public String getComponentType()");
+      out.println("{");
+      out.indent();
+      out.println("return \"" + componentType + "\";");
+      out.unindent();
+      out.println("}");
+    }
+
+    public void writeGetRendererType(
+      PrettyWriter  out,
+      ComponentBean component) throws IOException
+    {
+      String rendererType = component.getRendererType();
+      out.println();
+      out.println("@Override");
+      out.println("public String getRendererType()");
+      out.println("{");
+      out.indent();
+      out.println("return " + Util.convertStringToLiteral(rendererType) + ";");
+      out.unindent();
+      out.println("}");
+    }
+
+    public void writeClassEnd(PrettyWriter out)
+    {
+        out.unindent();
+        out.println("}");
+    }
+
+    public void writePropertyMembers(PrettyWriter out,
+                                     ComponentBean component) throws IOException
+    {
+        Iterator properties = component.properties();
+        properties = new FilteredIterator(properties, new TagAttributeFilter());
+
+        while (properties.hasNext())
+        {
+            PropertyBean property = (PropertyBean) properties.next();
+            writePropertyDeclaration(out, property);
+            writePropertySetter(out,property);
+        }
+    }
+
+    public void writeReleaseMethod(PrettyWriter out,
+                                   ComponentBean component) throws IOException
+    {
+        Iterator properties = component.properties();
+        properties = new FilteredIterator(properties, new TagAttributeFilter());
+        // TODO: remove special case for UIXFormTag
+        if (properties.hasNext() ||
+                "org.apache.myfaces.trinidadinternal.taglib.UIXFormTag".equals(component.getTagClass()))
+        {
+            out.println();
+            out.println("@Override");
+            out.println("public void release()");
+            out.println("{");
+            out.indent();
+            out.println("super.release();");
+            while (properties.hasNext())
+            {
+                PropertyBean property = (PropertyBean) properties.next();
+                String propName = property.getPropertyName();
+                String propVar = "_" + Util.getVariableFromName(propName);
+                out.println(propVar + " = null;");
+            }
+            out.unindent();
+            out.println("}");
+        }
+    }
+
+    public abstract void writeSetPropertiesMethod(PrettyWriter out,
+                                         String componentClass,
+                                         ComponentBean component) throws IOException;
+
+    protected void addSpecificImports(
+            Set imports,
+            ComponentBean component)
+    {
+        // nothing by default
+    }
+
+    protected abstract void writePropertyDeclaration(PrettyWriter out,
+                                                PropertyBean property) throws IOException;
+
+    protected abstract void writePropertySetter(PrettyWriter out,
+                                                PropertyBean property) throws IOException;
+
+    protected abstract void writeSetPropertyMethodBody(PrettyWriter out,
+                                                       String componentClass,
+                                                       Iterator properties) throws IOException;
+
+}

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java?view=auto&rev=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java (added)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java Wed Nov  1 14:31:13 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib;
+
+import org.apache.myfaces.trinidadbuild.plugin.faces.generator.ClassGenerator;
+import org.apache.myfaces.trinidadbuild.plugin.faces.io.PrettyWriter;
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.ComponentBean;
+
+import java.io.IOException;
+
+/**
+ * Generates tag classes
+ *
+ * @author Bruno Aranda (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public interface ComponentTagGenerator extends ClassGenerator
+{
+
+    void writeSetPropertiesMethod(PrettyWriter out,
+                                  String componentClass,
+                                  ComponentBean component) throws IOException;
+
+    void writeReleaseMethod(PrettyWriter out,
+                            ComponentBean component) throws IOException;
+
+    void writeGetComponentType(PrettyWriter out,
+                            ComponentBean component) throws IOException;
+
+    void writeGetRendererType(PrettyWriter out,
+                            ComponentBean component) throws IOException;
+
+    void writePropertyMembers(PrettyWriter out,
+                            ComponentBean component) throws IOException;
+}

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/ComponentTagGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java?view=auto&rev=470122
==============================================================================
--- incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java (added)
+++ incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java Wed Nov  1 14:31:13 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadbuild.plugin.faces.generator.taglib;
+
+import org.apache.myfaces.trinidadbuild.plugin.faces.parse.PropertyBean;
+import org.apache.myfaces.trinidadbuild.plugin.faces.util.PropertyFilter;
+
+/**
+ * TODO: comment this!
+*
+* @author Bruno Aranda (latest modification by $Author$)
+* @version $Revision$ $Date$
+*/
+final public class TagAttributeFilter extends PropertyFilter
+{
+    protected boolean accept(
+            PropertyBean property)
+    {
+        return (!property.isTagAttributeExcluded());
+    }
+}

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/myfaces-1_2-maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/TagAttributeFilter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL