TRINIDAD-1277
Added rtexprvalue support to the property bean
diff --git a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
index 788bb54..3fbecae 100644
--- a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
+++ b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
@@ -18,6 +18,38 @@
*/
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.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+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.AbstractConverterTagGenerator;
@@ -43,40 +75,14 @@
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.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.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
/**
* @version $Id$
@@ -550,7 +556,7 @@
stream.writeCharacters("\n ");
stream.writeStartElement("name");
-
+
if (property != null)
stream.writeCharacters(property.getJspPropertyName());
else
@@ -579,7 +585,7 @@
stream.writeCharacters("true");
stream.writeEndElement();
}
-
+
if (property.isMethodExpression() || property.isMethodBinding())
{
stream.writeCharacters("\n ");
@@ -638,7 +644,7 @@
// As of JSF 1.2, "id" can be set via an rtexprvalue (but
// *not* by a ValueExpression) - it has to be evaluated
// in the JSP
- if ("id".equals(propertyName) && !disableIdExpressions)
+ if (property.isRtexprvalue() || ("id".equals(propertyName) && !disableIdExpressions))
stream.writeCharacters("true");
else
stream.writeCharacters("false");
@@ -767,7 +773,7 @@
else
{
converterGen = new MyFacesConverterTagGenerator(is12(), getLicenseHeader(), getLog());
- validatorGen = new MyFacesValidatorTagGenerator(is12(), getLicenseHeader(), getLog());
+ validatorGen = new MyFacesValidatorTagGenerator(is12(), getLicenseHeader(), getLog());
}
int count = 0;
while (components.hasNext())
@@ -792,7 +798,7 @@
class ComponentTagHandlerGenerator
{
-
+
private Set initComponentList(ComponentBean component,
String fullSuperclassName)
{
@@ -815,7 +821,7 @@
{
ComponentTagGenerator generator;
Set componentList;
-
+
String fullSuperclassName = component.findJspTagSuperclass();
if (fullSuperclassName == null)
{
@@ -823,21 +829,21 @@
+ ", generation of this Tag is skipped");
return;
}
-
+
componentList = initComponentList(component, fullSuperclassName);
-
+
String fullClassName = component.getTagClass();
try
{
getLog().debug("Generating " + fullClassName);
-
+
String sourcePath = Util.convertClassToSourcePath(fullClassName, ".java");
File targetFile = new File(generatedSourceDirectory, sourcePath);
-
+
targetFile.getParentFile().mkdirs();
StringWriter sw = new StringWriter();
PrettyWriter out = new PrettyWriter(sw);
-
+
if (component.isTrinidadComponent())
{
generator = new TrinidadComponentTagGenerator(_is12());
@@ -851,15 +857,15 @@
String className = Util.getClassFromFullClass(fullClassName);
String packageName = Util.getPackageFromFullClass(fullClassName);
-
+
// header/copyright
writePreamble(out);
-
+
// package
out.println("package " + packageName + ";");
-
+
out.println();
-
+
String superclassName = Util.getClassFromFullClass(fullSuperclassName);
if (superclassName.equals(className))
{
@@ -867,15 +873,15 @@
}
String componentFullClass = component.getComponentClass();
String componentClass = Util.getClassFromFullClass(componentFullClass);
-
+
generator.writeImports(out, null, packageName, fullSuperclassName, superclassName, componentList);
-
+
generator.writeClassBegin(out, className, superclassName, component, null);
-
+
int modifiers = component.getTagClassModifiers();
generator.writeConstructor(out, component, modifiers);
-
-
+
+
if (!Modifier.isAbstract(modifiers))
{
generator.writeGetComponentType(out, component);
@@ -887,10 +893,10 @@
generator.writePropertyMembers(out, componentList);
generator.writeSetPropertiesMethod(out, componentClass, componentList);
generator.writeReleaseMethod(out, componentList);
-
+
generator.writeClassEnd(out);
out.close();
-
+
// delay write in case of error
// timestamp should not be updated when an error occurs
// delete target file first, because it is readonly
@@ -1026,6 +1032,7 @@
/**
* @parameter
+ * @deprecated
*/
protected boolean disableIdExpressions;
@@ -1034,7 +1041,7 @@
*/
protected boolean coerceStrings;
-
+
/**
* @parameter
*/
diff --git a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
index 18fb37d..d641ea1 100644
--- a/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
+++ b/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java
@@ -6,9 +6,9 @@
* to you 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
@@ -24,12 +24,12 @@
*/
public class PropertyBean extends AttributeBean
{
- public void setUseMaxTime(boolean _useMaxTime)
+ public void setUseMaxTime(boolean _useMaxTime)
{
this._useMaxTime = _useMaxTime;
}
-
- public boolean getUseMaxTime()
+
+ public boolean getUseMaxTime()
{
return _useMaxTime;
}
@@ -132,7 +132,7 @@
/**
* Sets the transient flag of this property.
*
- * @param transient the property transient flag
+ * @param transient_ the property transient flag
*/
public void setTransient(
boolean transient_)
@@ -154,7 +154,7 @@
/**
* Sets the list flag of this property.
*
- * @param list the property list flag
+ * @param list_ the property list flag
*/
public void setList(
boolean list_)
@@ -215,6 +215,23 @@
}
/**
+ * Set the property as allowing ${} syntax
+ * @param rtexprvalue the rtexrvalue value
+ */
+ public void setRtexprvalue(boolean rtexprvalue)
+ {
+ _rtexprvalue = rtexprvalue;
+ }
+
+ /**
+ * Return the rtexrvalue flag
+ */
+ public boolean isRtexprvalue()
+ {
+ return _rtexprvalue;
+ }
+
+ /**
* Sets the alias of this property.
*
* @param aliasOf the property alias
@@ -428,7 +445,7 @@
return _fieldPropertyName;
}
-
+
/**
* If the property should be hidden from documentation
* @return If the facet should be hidden
@@ -436,7 +453,7 @@
public boolean isHidden()
{
return _hidden;
- }
+ }
/**
* Set if this facet should be hidden from documentation
@@ -451,7 +468,7 @@
* Sets the property deprecated flag
* @param deprecated
*/
- public void setDeprecated(String deprecated)
+ public void setDeprecated(String deprecated)
{
this._deprecated = deprecated;
}
@@ -473,21 +490,22 @@
{
return _noOp;
}
-
+
/**
- * Invoked if the no-op extended property meta-data is provided for the component
+ * Invoked if the no-op extended property meta-data is provided for the component
* property.
*/
- public void makeNoOp()
+ public void makeNoOp()
{
this._noOp = true;
}
-
+
private String _aliasOf;
private String _jspPropertyName;
private String _fieldPropertyName;
private boolean _required;
private boolean _literalOnly;
+ private boolean _rtexprvalue;
private boolean _stateHolder;
private boolean _transient;
private boolean _list;