Author: awiner
Date: Thu Dec 14 16:57:16 2006
New Revision: 487411
URL: http://svn.apache.org/viewvc?view=rev&rev=487411
Log:
Merge in two commits missed during the component generator branch, and clean up
the code a little
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java
URL:
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java?view=diff&rev=487411&r1=487410&r2=487411
==============================================================================
---
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java
(original)
+++
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/AbstractFacesMojo.java
Thu Dec 14 16:57:16 2006
@@ -186,13 +186,13 @@
{
if (licenseHeaderFile == null)
{
- return _DEFAULT_LICENSE_HEADER;
+ return _DEFAULT_LICENSE_HEADER;
}
-
+
if (!licenseHeaderFile.exists())
{
- throw new MojoExecutionException("License header file not found: "
- +licenseHeaderFile.getName());
+ throw new MojoExecutionException("License header file not found: "
+ +licenseHeaderFile.getName());
}
if (licenseHeaderFile.isDirectory())
@@ -201,34 +201,34 @@
+licenseHeaderFile.getName());
}
- StringBuffer sb = new StringBuffer();
-
- try
- {
- BufferedReader reader = new BufferedReader(new
FileReader(licenseHeaderFile));
- String line;
-
- while ((line = reader.readLine()) != null)
- {
- sb.append(line+"\n");
- }
- }
- catch (IOException e)
+ StringBuffer sb = new StringBuffer();
+
+ try
+ {
+ BufferedReader reader = new BufferedReader(new
FileReader(licenseHeaderFile));
+ String line;
+
+ while ((line = reader.readLine()) != null)
{
- throw new MojoExecutionException("Exception reading license header
file", e);
+ sb.append(line+"\n");
}
-
- return sb.toString();
+ }
+ catch (IOException e)
+ {
+ throw new MojoExecutionException("Exception reading license header
file", e);
+ }
+
+ return sb.toString();
}
-
+
protected String getLicenseHeader() throws MojoExecutionException
{
- if (_licenseHeader == null)
- {
- _licenseHeader = readLicenseHeader();
- }
-
- return _licenseHeader;
+ if (_licenseHeader == null)
+ {
+ _licenseHeader = readLicenseHeader();
+ }
+
+ return _licenseHeader;
}
static public class URLCreationFactory extends AbstractObjectCreationFactory
@@ -594,22 +594,23 @@
static final private String _DEFAULT_LICENSE_HEADER =
- "/*\n" +
- " * Licensed to the Apache Software Foundation (ASF) under
one\n" +
- " * or more contributor license agreements. See the NOTICE
file\n" +
- " * distributed with this work for additional information\n"
+
- " * regarding copyright ownership. The ASF licenses this
file\n" +
- " * to you under the Apache License, Version 2.0 (the\n" +
- " * \"License\"); you may not use this file except in
compliance\n" +
- " * with the License. You may obtain a copy of the License
at\n" +
- " *\n" +
- " * http://www.apache.org/licenses/LICENSE-2.0\n" +
- " *\n" +
- " * Unless required by applicable law or agreed to in
writing,\n" +
- " * software distributed under the License is distributed on
an\n" +
- " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY\n" +
- " * KIND, either express or implied. See the License for
the\n" +
- " * specific language governing permissions and
limitations\n" +
- " * under the License.\n" +
- "*/";
+ "/*\n" +
+ " * Licensed to the Apache Software Foundation (ASF) under one\n" +
+ " * or more contributor license agreements. See the NOTICE file\n" +
+ " * distributed with this work for additional information\n" +
+ " * regarding copyright ownership. The ASF licenses this file\n" +
+ " * to you under the Apache License, Version 2.0 (the\n" +
+ " * \"License\"); you may not use this file except in compliance\n" +
+ " * with the License. You may obtain a copy of the License at\n" +
+ " *\n" +
+ " * http://www.apache.org/licenses/LICENSE-2.0\n" +
+ " *\n" +
+ " * Unless required by applicable law or agreed to in writing,\n" +
+ " * software distributed under the License is distributed on an\n" +
+ " * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n" +
+ " * KIND, either express or implied. See the License for the\n" +
+ " * specific language governing permissions and limitations\n" +
+ " * under the License.\n" +
+ "*/\n";
}
+
\ No newline at end of file
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
URL:
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java?view=diff&rev=487411&r1=487410&r2=487411
==============================================================================
---
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
(original)
+++
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateComponentsMojo.java
Thu Dec 14 16:57:16 2006
@@ -120,9 +120,10 @@
{
generator = new TrinidadComponentGenerator(getLog(), _is12());
}
- else {
- generator = new MyFacesComponentGenerator(getLog(),_is12() );
- }
+ else
+ {
+ generator = new MyFacesComponentGenerator(getLog(),_is12() );
+ }
try
{
@@ -213,11 +214,13 @@
if (template == null)
{
- generator.writePropertyMethods(out, component);
- } else {
- generator.writePropertyMethods(out, component,
template.getIgnoreMethods());
- }
-
+ generator.writePropertyMethods(out, component);
+ }
+ else
+ {
+ generator.writePropertyMethods(out, component,
template.getIgnoreMethods());
+ }
+
if (!suppressListenerMethods)
generator.writeListenerMethods(out, component);
@@ -269,11 +272,11 @@
}
}
- private boolean _is12()
- {
- return "1.2".equals(jsfVersion) || "12".equals(jsfVersion);
- }
-
+ private boolean _is12()
+ {
+ return "1.2".equals(jsfVersion) || "12".equals(jsfVersion);
+ }
+
/**
* @parameter expression="${project}"
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
URL:
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java?view=diff&rev=487411&r1=487410&r2=487411
==============================================================================
---
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
(original)
+++
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/component/AbstractComponentGenerator.java
Thu Dec 14 16:57:16 2006
@@ -408,13 +408,28 @@
{
return "new Integer(" + value + ")";
}
+ else if ("double".equals(className))
+ {
+ return "new Double(" + value + ")";
+ }
else if ("float".equals(className))
{
return "new Float(" + value + ")";
}
+ else if ("Number".equals(className))
+ {
+ if(value.indexOf(".") == -1)
+ {
+ return "new Integer(" + value + ")";
+ }
+ else
+ {
+ return "new Double(" + value + ")";
+ }
+ }
else
{
- throw new IllegalStateException();
+ throw new IllegalStateException("property-class " + className + " not
supported for auto-boxing");
}
}
@@ -959,6 +974,7 @@
//resolvableTypes.put("java.util.Date", "Date");
resolvableTypes.put("int", "Integer");
resolvableTypes.put("float", "Float");
+ resolvableTypes.put("double", "Double");
resolvableTypes.put("java.util.Locale", "Locale");
resolvableTypes.put("long", "Long");
resolvableTypes.put("java.lang.String", "String");
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/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/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java?view=diff&rev=487411&r1=487410&r2=487411
==============================================================================
---
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
(original)
+++
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/generator/taglib/AbstractComponentTagGenerator.java
Thu Dec 14 16:57:16 2006
@@ -25,7 +25,11 @@
import java.io.IOException;
import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
/**
* TODO: comment this!
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
URL:
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java?view=diff&rev=487411&r1=487410&r2=487411
==============================================================================
---
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
(original)
+++
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/ComponentBean.java
Thu Dec 14 16:57:16 2006
@@ -350,27 +350,6 @@
}
/**
- * Sets the peer type for this component.
- *
- * @param peerType the peer type
- */
- public void setPeerType(
- String peerType)
- {
- _peerType = peerType;
- }
-
- /**
- * Returns the peer type for this component.
- *
- * @return the peer type
- */
- public String getPeerType()
- {
- return _peerType;
- }
-
- /**
* Returns the default renderer type for this component.
*
* @return the default renderer type
@@ -381,17 +360,17 @@
return (parent != null) ? parent.findRendererType() : null;
}
- /**
- * Returns the default peer type for this component.
- *
- * @return the default peer type
- */
- public String getDefaultPeerType()
+ public String getImplementationType()
{
- ComponentBean parent = resolveSupertype();
- return (parent != null) ? parent.findPeerType() : null;
+ return _implementationType;
}
+ public void setImplementationType(String implementationType)
+ {
+ _implementationType = implementationType;
+ }
+
+
/**
* Adds a property to this component.
*
@@ -883,20 +862,6 @@
return (parent != null) ? parent.findRendererType() : null;
}
- /**
- * Finds the peer type in the component inheritance
- * hierarchy.
- *
- * @return the peer type
- */
- public String findPeerType()
- {
- if (_peerType != null)
- return _peerType;
-
- ComponentBean parent = resolveSupertype();
- return (parent != null) ? parent.findPeerType() : null;
- }
/**
* Finds the component superclass in the component inheritance
@@ -949,20 +914,23 @@
*/
public boolean isTrinidadComponent()
{
- ComponentBean componentSupertype = resolveSupertype();
+ String implementationType = getImplementationType();
+ if (implementationType != null)
+ return "trinidad".equals(implementationType);
- if (componentSupertype != null)
+ ComponentBean componentSupertype = resolveSupertype();
+ if (componentSupertype != null)
+ {
+ if
(_TRINIDAD_COMPONENT_BASE.equals(componentSupertype.getComponentClass()))
{
- if
(_TRINIDAD_COMPONENT_BASE.equals(componentSupertype.getComponentClass()))
- {
- return true;
- }
- else
- {
- return componentSupertype.isTrinidadComponent();
- }
+ return true;
}
-
+ else
+ {
+ return componentSupertype.isTrinidadComponent();
+ }
+ }
+
return false;
}
@@ -1021,7 +989,7 @@
private String _componentSupertype;
private String _componentSuperclass;
private String _rendererType;
- private String _peerType;
+ private String _implementationType;
private QName _tagName;
private String _tagClass;
private String _tagSuperclass;
Modified:
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
URL:
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java?view=diff&rev=487411&r1=487410&r2=487411
==============================================================================
---
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
(original)
+++
incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/FacesConfigParser.java
Thu Dec 14 16:57:16 2006
@@ -138,8 +138,6 @@
"componentSuperclass");
digester.addBeanPropertySetter("faces-config/component/component-extension/renderer-type",
"rendererType");
-
digester.addBeanPropertySetter("faces-config/component/component-extension/peer-type",
- "peerType");
digester.addBeanPropertySetter("faces-config/component/component-extension/naming-container",
"namingContainer");
digester.addBeanPropertySetter("faces-config/component/component-extension/accepts-child-components",
@@ -148,6 +146,8 @@
"tagClass");
digester.addBeanPropertySetter("faces-config/component/component-extension/tag-superclass",
"tagSuperclass");
+
digester.addBeanPropertySetter("faces-config/component/component-extension/implementation-type",
+ "implementationType");
digester.addCallMethod("faces-config/component/component-extension/tag-class-modifier",
"parseTagClassModifier", 1);
digester.addCallParam("faces-config/component/component-extension/tag-class-modifier",
0);