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 aw...@apache.org on 2006/11/14 01:35:05 UTC
svn commit: r474621 [2/43] - in
/incubator/adffaces/branches/faces-1_2-061113: plugins/maven-faces-plugin/
plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/
plugins/maven-faces-plugin/src/main/java/org/apache/myfac...
Modified: incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/GenerateJspTaglibsMojo.java Mon Nov 13 17:34:56 2006
@@ -28,6 +28,7 @@
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;
@@ -201,10 +202,14 @@
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer identity = transFactory.newTransformer();
- identity.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
- _JSP_TAG_LIBRARY_DOCTYPE_PUBLIC);
- identity.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
- _JSP_TAG_LIBRARY_DOCTYPE_SYSTEM);
+ if (!_is12())
+ {
+ identity.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
+ _JSP_TAG_LIBRARY_DOCTYPE_PUBLIC);
+ identity.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
+ _JSP_TAG_LIBRARY_DOCTYPE_SYSTEM);
+ }
+
identity.transform(mergedSource, mergedResult);
targetFile.setReadOnly();
@@ -216,7 +221,7 @@
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
XMLStreamWriter stream = outputFactory.createXMLStreamWriter(out);
- _writeStartTagLibrary(stream, "1.2", shortName, namespaceURI);
+ _writeStartTagLibrary(stream, _is12() ? "2.1" : "1.2", shortName, namespaceURI);
while (components.hasNext())
{
ComponentBean component = (ComponentBean)components.next();
@@ -276,9 +281,19 @@
{
stream.writeStartDocument("1.0");
stream.writeCharacters("\n");
- stream.writeDTD(dtd);
+ if (!_is12())
+ stream.writeDTD(dtd);
+
stream.writeCharacters("\n");
stream.writeStartElement("taglib");
+ if (_is12())
+ {
+ stream.writeNamespace("", "http://java.sun.com/xml/ns/javaee");
+ stream.writeNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ stream.writeAttribute("xsi:schemaLocation", "http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd");
+ stream.writeAttribute("version", "2.1");
+ }
+
stream.writeCharacters("\n ");
}
@@ -327,13 +342,6 @@
stream.writeCharacters("\n ");
stream.writeStartElement("tag");
stream.writeCharacters("\n ");
- stream.writeStartElement("name");
- stream.writeCharacters(component.getTagName().getLocalPart());
- stream.writeEndElement();
- stream.writeCharacters("\n ");
- stream.writeStartElement("tag-class");
- stream.writeCharacters(component.getTagClass());
- stream.writeEndElement();
if (component.getDescription() != null)
{
stream.writeCharacters("\n ");
@@ -342,6 +350,14 @@
stream.writeEndElement();
}
+ stream.writeStartElement("name");
+ stream.writeCharacters(component.getTagName().getLocalPart());
+ stream.writeEndElement();
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("tag-class");
+ stream.writeCharacters(component.getTagClass());
+ stream.writeEndElement();
+
Iterator properties = component.properties(true);
properties = new FilteredIterator(properties, new TagAttributeFilter());
while (properties.hasNext())
@@ -350,7 +366,8 @@
_writeTagAttribute(stream,
property.getPropertyName(),
property.getDescription(),
- property.getUnsupportedAgents());
+ property.getUnsupportedAgents(),
+ property);
}
stream.writeCharacters("\n ");
@@ -367,13 +384,6 @@
stream.writeCharacters("\n ");
stream.writeStartElement("tag");
stream.writeCharacters("\n ");
- stream.writeStartElement("name");
- stream.writeCharacters(converter.getTagName().getLocalPart());
- stream.writeEndElement();
- stream.writeCharacters("\n ");
- stream.writeStartElement("tag-class");
- stream.writeCharacters(converter.getTagClass());
- stream.writeEndElement();
if (converter.getDescription() != null)
{
stream.writeCharacters("\n ");
@@ -382,8 +392,16 @@
stream.writeEndElement();
}
+ stream.writeStartElement("name");
+ stream.writeCharacters(converter.getTagName().getLocalPart());
+ stream.writeEndElement();
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("tag-class");
+ stream.writeCharacters(converter.getTagClass());
+ stream.writeEndElement();
+
// converters need an id attribute
- _writeTagAttribute(stream, "id", "the identifier for the component", null);
+ _writeTagAttribute(stream, "id", "the identifier for the converter", null, null);
Iterator properties = converter.properties();
properties = new FilteredIterator(properties, new TagAttributeFilter());
@@ -393,7 +411,8 @@
_writeTagAttribute(stream,
property.getPropertyName(),
property.getDescription(),
- property.getUnsupportedAgents());
+ property.getUnsupportedAgents(),
+ property);
}
stream.writeCharacters("\n ");
@@ -404,21 +423,12 @@
XMLStreamWriter stream,
String propertyName,
String description,
- String[] unsupportedAgents) throws XMLStreamException
+ String[] unsupportedAgents,
+ PropertyBean property) throws XMLStreamException
{
stream.writeCharacters("\n ");
stream.writeStartElement("attribute");
- stream.writeCharacters("\n ");
- stream.writeStartElement("name");
- stream.writeCharacters(propertyName);
- stream.writeEndElement();
-
- stream.writeCharacters("\n ");
- stream.writeStartElement("rtexprvalue");
- stream.writeCharacters("false");
- stream.writeEndElement();
-
if (description != null ||
unsupportedAgents.length > 0)
{
@@ -444,6 +454,92 @@
stream.writeEndElement();
}
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("name");
+
+ if (property != null)
+ stream.writeCharacters(property.getJspPropertyName());
+ else
+ stream.writeCharacters(propertyName);
+
+ stream.writeEndElement();
+
+ if (!_is12())
+ {
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("rtexprvalue");
+ stream.writeCharacters("false");
+ stream.writeEndElement();
+ }
+ else
+ {
+ if (property != null)
+ {
+ if (property.isRequired())
+ {
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("required");
+ stream.writeCharacters("true");
+ stream.writeEndElement();
+ }
+
+ if (property.isMethodExpression() || property.isMethodBinding())
+ {
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("deferred-method");
+ stream.writeCharacters("\n ");
+ MethodSignatureBean sig = property.getMethodBindingSignature();
+ if (sig != null)
+ {
+ stream.writeStartElement("method-signature");
+ stream.writeCharacters(sig.getReturnType());
+ stream.writeCharacters(" myMethod(");
+ String[] params = sig.getParameterTypes();
+ for (int i = 0; i < params.length; i++)
+ {
+ if (i > 0)
+ stream.writeCharacters(", ");
+ stream.writeCharacters(params[i]);
+ }
+
+ stream.writeCharacters(")");
+ stream.writeEndElement();
+ }
+ stream.writeEndElement();
+ }
+ else if (!property.isLiteralOnly() ||
+ // "binding" is always a deferred-value
+ "binding".equals(propertyName))
+ {
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("deferred-value");
+ if (_CAN_COERCE.contains(property.getPropertyClass()))
+ {
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("type");
+ stream.writeCharacters(property.getPropertyClass());
+ stream.writeEndElement();
+ stream.writeCharacters("\n ");
+ }
+
+ stream.writeEndElement();
+ }
+ else
+ {
+ stream.writeCharacters("\n ");
+ stream.writeStartElement("rtexprvalue");
+ // 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))
+ stream.writeCharacters("true");
+ else
+ stream.writeCharacters("false");
+ stream.writeEndElement();
+ }
+ }
+ }
+
stream.writeCharacters("\n ");
stream.writeEndElement();
}
@@ -474,7 +570,7 @@
}
// validators need an id attribute
- _writeTagAttribute(stream, "id", "the identifier for the component", null);
+ _writeTagAttribute(stream, "id", "the identifier for the validator", null, null);
Iterator properties = validator.properties();
properties = new FilteredIterator(properties, new TagAttributeFilter());
@@ -484,7 +580,8 @@
_writeTagAttribute(stream,
property.getPropertyName(),
property.getDescription(),
- property.getUnsupportedAgents());
+ property.getUnsupportedAgents(),
+ property);
}
stream.writeCharacters("\n ");
@@ -594,8 +691,17 @@
out.println(" * Auto-generated tag class.");
out.println(" */");
- out.println("public class " + className +
- " extends ConverterTag");
+ if (_is12())
+ {
+ out.println("public class " + className +
+ " extends ConverterELTag");
+ }
+ else
+ {
+ out.println("public class " + className +
+ " extends ConverterTag");
+ }
+
out.println("{");
out.indent();
@@ -633,7 +739,15 @@
{
Set imports = new TreeSet();
- imports.add("javax.faces.webapp.ConverterTag");
+ if (_is12())
+ {
+ imports.add("javax.faces.webapp.ConverterELTag");
+ imports.add("javax.faces.context.FacesContext");
+ imports.add("javax.faces.application.Application");
+ }
+ else
+ imports.add("javax.faces.webapp.ConverterTag");
+
imports.add("javax.servlet.jsp.JspException");
imports.add(converter.getConverterClass());
@@ -642,7 +756,10 @@
if (properties.hasNext())
{
imports.add("javax.faces.convert.Converter");
- imports.add("javax.faces.el.ValueBinding");
+ if (_is12())
+ imports.add("javax.el.ValueExpression");
+ else
+ imports.add("javax.faces.el.ValueBinding");
imports.add("org.apache.myfaces.trinidadinternal.taglib.util.TagUtils");
}
@@ -706,7 +823,9 @@
{
String propName = property.getPropertyName();
String propVar = "_" + Util.getVariableFromName(propName);
- out.println("private String " + propVar + ";");
+ String jspPropType = _getJspPropertyType(property);
+
+ out.println("private " + jspPropType + " " + propVar + ";");
}
private void _writePropertySet(
@@ -716,9 +835,10 @@
String propName = property.getPropertyName();
String propVar = Util.getVariableFromName(propName);
String setMethod = Util.getPrefixedPropertyName("set", propName);
+ String jspPropType = _getJspPropertyType(property);
// TODO: restore coding standards, and make final
- out.println("public void " + setMethod + "(String " + propVar + ")");
+ out.println("public void " + setMethod + "(" + jspPropType + " " + propVar + ")");
out.println("{");
out.indent();
out.println("_" + propVar + " = " + propVar + ";");
@@ -730,19 +850,22 @@
PrettyWriter out,
ConverterBean converter) throws IOException
{
- String converterFullClass = converter.getConverterClass();
- String converterClass = Util.getClassFromFullClass(converterFullClass);
-
- out.println();
- // TODO: restore coding standards, and make final
- out.println("@Override");
- out.println("public int doStartTag() throws JspException");
- out.println("{");
- out.indent();
- out.println("super.setConverterId(" + converterClass + ".CONVERTER_ID);");
- out.println("return super.doStartTag();");
- out.unindent();
- out.println("}");
+ if (!_is12())
+ {
+ String converterFullClass = converter.getConverterClass();
+ String converterClass = Util.getClassFromFullClass(converterFullClass);
+
+ out.println();
+ // TODO: restore coding standards, and make final
+ out.println("@Override");
+ out.println("public int doStartTag() throws JspException");
+ out.println("{");
+ out.indent();
+ out.println("super.setConverterId(" + converterClass + ".CONVERTER_ID);");
+ out.println("return super.doStartTag();");
+ out.unindent();
+ out.println("}");
+ }
}
private void _writeCreateConverter(
@@ -762,8 +885,18 @@
out.println("protected Converter createConverter() throws JspException");
out.println("{");
out.indent();
- out.println(converterClass + " converter = " +
- "(" + converterClass + ")super.createConverter();");
+ if (_is12())
+ {
+ out.println("String converterId = " + converterClass + ".CONVERTER_ID;");
+ out.println("Application appl = FacesContext.getCurrentInstance().getApplication();");
+ out.println(converterClass + " converter = " +
+ "(" + converterClass + ")appl.createConverter(converterId);");
+ }
+ else
+ {
+ out.println(converterClass + " converter = " +
+ "(" + converterClass + ")super.createConverter();");
+ }
out.println("_setProperties(converter);");
out.println("return converter;");
out.unindent();
@@ -806,44 +939,89 @@
String propFullClass = property.getPropertyClass();
String propClass = Util.getClassFromFullClass(propFullClass);
String propVar = "_" + Util.getVariableFromName(propName);
+
out.println("if (" + propVar + " != null)");
out.println("{");
out.indent();
- out.println("if (TagUtils.isValueReference(" + propVar + "))");
- out.println("{");
- out.indent();
- out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
- out.println("converter.setValueBinding(\"" + propName + "\", vb);");
- out.unindent();
- out.println("}");
- String propType = _resolveType(propFullClass);
- if (propType != null)
+
+ if (_is12())
{
- out.println("else");
+ out.println("if (!" + propVar + ".isLiteralText())");
out.println("{");
out.indent();
- if ("StringArray".equals(propType))
+ out.println("converter.setValueExpression(\"" + propName + "\", " +
+ propVar + ");");
+ out.unindent();
+ out.println("}");
+ String propType = _resolveType(propFullClass);
+ if (propType != null)
{
- out.println("try");
+ out.println("else");
out.println("{");
+ out.indent();
+ if ("StringArray".equals(propType))
+ {
+ out.println("try");
+ out.println("{");
+ }
+
+ out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ".getValue(null));");
+ String setMethod = Util.getPrefixedPropertyName("set", propName);
+ out.println("converter." + setMethod + "(value);");
+ if ("StringArray".equals(propType))
+ {
+ out.println("}");
+ out.println("catch (ParseException pe)");
+ out.println("{");
+ out.indent();
+ out.println("throw new JspException(");
+ out.println(" pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+ out.unindent();
+ out.println("}");
+ }
+ out.unindent();
+ out.println("}");
}
- out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
- String setMethod = Util.getPrefixedPropertyName("set", propName);
- out.println("converter." + setMethod + "(value);");
- if ("StringArray".equals(propType))
+ }
+ else
+ {
+ out.println("if (TagUtils.isValueReference(" + propVar + "))");
+ out.println("{");
+ out.indent();
+ out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
+ out.println("converter.setValueBinding(\"" + propName + "\", vb);");
+ out.unindent();
+ out.println("}");
+ String propType = _resolveType(propFullClass);
+ if (propType != null)
{
- out.println("}");
- out.println("catch (ParseException pe)");
+ out.println("else");
out.println("{");
out.indent();
- out.println("throw new JspException(");
- out.println(" pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+ if ("StringArray".equals(propType))
+ {
+ out.println("try");
+ out.println("{");
+ }
+ out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
+ String setMethod = Util.getPrefixedPropertyName("set", propName);
+ out.println("converter." + setMethod + "(value);");
+ if ("StringArray".equals(propType))
+ {
+ out.println("}");
+ out.println("catch (ParseException pe)");
+ out.println("{");
+ out.indent();
+ out.println("throw new JspException(");
+ out.println(" pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+ out.unindent();
+ out.println("}");
+ }
out.unindent();
out.println("}");
}
- out.unindent();
- out.println("}");
}
+
out.unindent();
out.println("}");
}
@@ -873,6 +1051,19 @@
out.println("}");
}
}
+
+ private String _getJspPropertyType(PropertyBean property)
+ {
+ if (property.isMethodExpression())
+ return "MethodExpression";
+
+ if (_is12() && property.isMethodBinding())
+ return "MethodExpression";
+
+ if (_is12() && !property.isLiteralOnly())
+ return "ValueExpression";
+ return "String";
+ }
}
class ValidatorTagGenerator
@@ -910,8 +1101,17 @@
out.println(" * Auto-generated tag class.");
out.println(" */");
- out.println("public class " + className +
- " extends ValidatorTag");
+ if (_is12())
+ {
+ out.println("public class " + className +
+ " extends ValidatorELTag");
+ }
+ else
+ {
+ out.println("public class " + className +
+ " extends ValidatorTag");
+ }
+
out.println("{");
out.indent();
@@ -949,7 +1149,15 @@
{
Set imports = new TreeSet();
- imports.add("javax.faces.webapp.ValidatorTag");
+ if (_is12())
+ {
+ imports.add("javax.faces.webapp.ValidatorELTag");
+ imports.add("javax.faces.context.FacesContext");
+ imports.add("javax.faces.application.Application");
+ }
+ else
+ imports.add("javax.faces.webapp.ValidatorTag");
+
imports.add("javax.servlet.jsp.JspException");
imports.add(validator.getValidatorClass());
@@ -958,7 +1166,10 @@
if (properties.hasNext())
{
imports.add("javax.faces.validator.Validator");
- imports.add("javax.faces.el.ValueBinding");
+ if (_is12())
+ imports.add("javax.el.ValueExpression");
+ else
+ imports.add("javax.faces.el.ValueBinding");
imports.add("org.apache.myfaces.trinidadinternal.taglib.util.TagUtils");
}
@@ -1022,7 +1233,9 @@
{
String propName = property.getPropertyName();
String propVar = "_" + Util.getVariableFromName(propName);
- out.println("private String " + propVar + ";");
+ String jspPropType = _getJspPropertyType(property);
+
+ out.println("private " + jspPropType + " " + propVar + ";");
}
private void _writePropertySet(
@@ -1032,9 +1245,10 @@
String propName = property.getPropertyName();
String propVar = Util.getVariableFromName(propName);
String setMethod = Util.getPrefixedPropertyName("set", propName);
+ String jspPropType = _getJspPropertyType(property);
// TODO: restore coding standards, and make final
- out.println("public void " + setMethod + "(String " + propVar + ")");
+ out.println("public void " + setMethod + "(" + jspPropType + " " + propVar + ")");
out.println("{");
out.indent();
out.println("_" + propVar + " = " + propVar + ";");
@@ -1046,19 +1260,22 @@
PrettyWriter out,
ValidatorBean validator) throws IOException
{
- String validatorFullClass = validator.getValidatorClass();
- String validatorClass = Util.getClassFromFullClass(validatorFullClass);
-
out.println();
- // TODO: restore coding standards, and make final
- out.println("@Override");
- out.println("public int doStartTag() throws JspException");
- out.println("{");
- out.indent();
- out.println("super.setValidatorId(" + validatorClass + ".VALIDATOR_ID);");
- out.println("return super.doStartTag();");
- out.unindent();
- out.println("}");
+ if (!_is12())
+ {
+ String validatorFullClass = validator.getValidatorClass();
+ String validatorClass = Util.getClassFromFullClass(validatorFullClass);
+
+ // TODO: restore coding standards, and make final
+ out.println("@Override");
+ out.println("public int doStartTag() throws JspException");
+ out.println("{");
+ out.indent();
+ out.println("super.setValidatorId(" + validatorClass + ".VALIDATOR_ID);");
+ out.println("return super.doStartTag();");
+ out.unindent();
+ out.println("}");
+ }
}
private void _writeCreateValidator(
@@ -1078,8 +1295,18 @@
out.println("protected Validator createValidator() throws JspException");
out.println("{");
out.indent();
- out.println(validatorClass + " validator = " +
- "(" + validatorClass + ")super.createValidator();");
+ if (_is12())
+ {
+ out.println("String validatorId = " + validatorClass + ".VALIDATOR_ID;");
+ out.println("Application appl = FacesContext.getCurrentInstance().getApplication();");
+ out.println(validatorClass + " validator = " +
+ "(" + validatorClass + ")appl.createValidator(validatorId);");
+ }
+ else
+ {
+ out.println(validatorClass + " validator = " +
+ "(" + validatorClass + ")super.createValidator();");
+ }
out.println("_setProperties(validator);");
out.println("return validator;");
out.unindent();
@@ -1125,41 +1352,84 @@
out.println("if (" + propVar + " != null)");
out.println("{");
out.indent();
- out.println("if (TagUtils.isValueReference(" + propVar + "))");
- out.println("{");
- out.indent();
- out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
- out.println("validator.setValueBinding(\"" + propName + "\", vb);");
- out.unindent();
- out.println("}");
- String propType = _resolveType(propFullClass);
- if (propType != null)
+ if (_is12())
{
- out.println("else");
+ out.println("if (!" + propVar + ".isLiteralText())");
out.println("{");
out.indent();
- if ("StringArray".equals(propType))
+ out.println("validator.setValueExpression(\"" + propName + "\", " +
+ propVar + ");");
+ out.unindent();
+ out.println("}");
+ String propType = _resolveType(propFullClass);
+ if (propType != null)
{
- out.println("try");
+ out.println("else");
out.println("{");
+ out.indent();
+ if ("StringArray".equals(propType))
+ {
+ out.println("try");
+ out.println("{");
+ }
+
+ out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ".getValue(null));");
+ String setMethod = Util.getPrefixedPropertyName("set", propName);
+ out.println("validator." + setMethod + "(value);");
+ if ("StringArray".equals(propType))
+ {
+ out.println("}");
+ out.println("catch (ParseException pe)");
+ out.println("{");
+ out.indent();
+ out.println("throw new JspException(");
+ out.println(" pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+ out.unindent();
+ out.println("}");
+ }
+ out.unindent();
+ out.println("}");
}
- out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
- String setMethod = Util.getPrefixedPropertyName("set", propName);
- out.println("validator." + setMethod + "(value);");
- if ("StringArray".equals(propType))
+ }
+ else
+ {
+ out.println("if (TagUtils.isValueReference(" + propVar + "))");
+ out.println("{");
+ out.indent();
+ out.println("ValueBinding vb = TagUtils.getValueBinding(" + propVar + ");");
+ out.println("validator.setValueBinding(\"" + propName + "\", vb);");
+ out.unindent();
+ out.println("}");
+ String propType = _resolveType(propFullClass);
+ if (propType != null)
{
- out.println("}");
- out.println("catch (ParseException pe)");
+ out.println("else");
out.println("{");
out.indent();
- out.println("throw new JspException(");
- out.println(" pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+ if ("StringArray".equals(propType))
+ {
+ out.println("try");
+ out.println("{");
+ }
+ out.println(propClass + " value = TagUtils.get" + propType + "(" + propVar + ");");
+ String setMethod = Util.getPrefixedPropertyName("set", propName);
+ out.println("validator." + setMethod + "(value);");
+ if ("StringArray".equals(propType))
+ {
+ out.println("}");
+ out.println("catch (ParseException pe)");
+ out.println("{");
+ out.indent();
+ out.println("throw new JspException(");
+ out.println(" pe.getMessage() + \": \" + \"Position \" + pe.getErrorOffset());");
+ out.unindent();
+ out.println("}");
+ }
out.unindent();
out.println("}");
}
- out.unindent();
- out.println("}");
}
+
out.unindent();
out.println("}");
}
@@ -1189,6 +1459,19 @@
out.println("}");
}
}
+
+ private String _getJspPropertyType(PropertyBean property)
+ {
+ if (property.isMethodExpression())
+ return "MethodExpression";
+
+ if (_is12() && property.isMethodBinding())
+ return "MethodExpression";
+
+ if (_is12() && !property.isLiteralOnly())
+ return "ValueExpression";
+ return "String";
+ }
}
class ComponentTagGenerator
@@ -1321,35 +1604,64 @@
imports.add(propertyClass);
}
+ imports.add("javax.el.ValueExpression");
+
if (_isKeyStroke(propertyClass))
{
- imports.add("javax.faces.el.ValueBinding");
+ if (_is12())
+ imports.add("javax.el.ValueExpression");
+ else
+ imports.add("javax.faces.el.ValueBinding");
imports.add("javax.swing.KeyStroke");
}
else if (_isAWTKeyStroke(propertyClass))
{
- imports.add("javax.faces.el.ValueBinding");
+ if (_is12())
+ imports.add("javax.el.ValueExpression");
+ else
+ imports.add("javax.faces.el.ValueBinding");
imports.add("java.awt.AWTKeyStroke");
}
else if (_isConverter(propertyClass))
{
- imports.add("javax.faces.el.ValueBinding");
+ if (_is12())
+ imports.add("javax.el.ValueExpression");
+ else
+ imports.add("javax.faces.el.ValueBinding");
imports.add("javax.faces.convert.Converter");
}
else if (property.isVirtual())
{
- imports.add("javax.faces.el.ValueBinding");
+ 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))
{
- imports.add("javax.faces.el.ValueBinding");
+ 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())
{
- imports.add("javax.faces.el.MethodBinding");
+ 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
@@ -1483,7 +1795,22 @@
{
String propName = property.getPropertyName();
String propVar = "_" + Util.getVariableFromName(propName);
- out.println("private String " + propVar + ";");
+ 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(
@@ -1491,11 +1818,13 @@
PropertyBean property) throws IOException
{
String propName = property.getPropertyName();
+ String jspPropName = property.getJspPropertyName();
String propVar = Util.getVariableFromName(propName);
- String setMethod = Util.getPrefixedPropertyName("set", propName);
+ String setMethod = Util.getPrefixedPropertyName("set", jspPropName);
+ String jspPropType = _getJspPropertyType(property);
// TODO: restore coding standards, and make final
- out.println("public void " + setMethod + "(String " + propVar + ")");
+ out.println("public void " + setMethod + "(" + jspPropType + " " + propVar + ")");
out.println("{");
out.indent();
out.println("_" + propVar + " = " + propVar + ";");
@@ -1550,6 +1879,10 @@
{
_writeSetMethodBinding(out, componentClass, property);
}
+ else if (property.isMethodExpression())
+ {
+ _writeSetMethodExpression(out, componentClass, property);
+ }
else if (_isKeyStroke(propClass))
{
_writeSetKeyStroke(out, componentClass, propName);
@@ -1646,11 +1979,25 @@
PrettyWriter out,
String componentClass,
String propName,
- String propClass,
+ 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, propClass, propVar);
+ _writeSetProperty(out, componentClass, propName, propFullClass, propVar);
+ }
+ else
+ {
+ String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
+ out.println("bean.setProperty(" +
+ componentClass + "." + propKey + ", " +
+ propVar + ");" );
+ }
}
private void _writeSetProperty(
@@ -1664,7 +2011,7 @@
String propClass = Util.getClassFromFullClass(propFullClass);
String boxedClass = Util.getBoxedClass(propClass);
String setProperty = "setProperty";
- if (!boxedClass.equals(propClass) ||
+ if ((!_is12() && !boxedClass.equals(propClass)) ||
"java.lang.Number".equals(propFullClass) ||
"java.util.Date".equals(propFullClass) ||
(boxedClass.indexOf("[]") != -1))
@@ -1672,6 +2019,7 @@
String propType = boxedClass.replaceAll("\\[\\]", "Array");
setProperty = Util.getPrefixedPropertyName("set", propType + "Property");
}
+
out.println(setProperty + "(bean, " +
componentClass + "." + propKey + ", " +
propVar + ");" );
@@ -1699,32 +2047,68 @@
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("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();
+
+ 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("}");
}
@@ -1737,89 +2121,142 @@
String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
String propVar = "_" + propName;
- MethodSignatureBean signature = property.getMethodBindingSignature();
- String[] paramTypes = (signature != null) ? signature.getParameterTypes() : null;
-
- String classArray;
-
- if (paramTypes == null || paramTypes.length == 0)
+ if (_is12())
{
- classArray = "new Class[0]";
+ out.println("if (" + propVar + " != null)");
+ out.indent();
+ out.println("bean.setProperty(" + componentClass + "." + propKey + ", " +
+ "new MethodExpressionMethodBinding(" + propVar + "));");
+ out.unindent();
}
else
{
- StringBuffer sb = new StringBuffer();
- sb.append("new Class[]{");
- for (int i=0; i < paramTypes.length; i++)
+ 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))
{
- if (i > 0)
- sb.append(',');
- sb.append(paramTypes[i]);
- sb.append(".class");
+ 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("}");
+ }
+ }
- // TODO: remove trailing comma
- sb.append(',');
+ private void _writeSetMethodExpression(
+ PrettyWriter out,
+ String componentClass,
+ PropertyBean property) throws IOException
+ {
+ String propName = property.getPropertyName();
+ String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
+ String propVar = "_" + propName;
- sb.append('}');
- classArray = sb.toString();
- }
+ out.println("bean.setProperty(" + componentClass + "." + propKey + ", " +
+ propVar + ");");
+ }
- out.println("if (" + propVar + " != null)");
- out.println("{");
- out.indent();
+ private void _writeSetKeyStroke(
+ PrettyWriter out,
+ String componentClass,
+ String propName) throws IOException
+ {
+ String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
+ String propVar = "_" + propName;
- if (isStringMethodBindingReturnType(signature))
+
+ if (_is12())
{
- out.println("MethodBinding mb;");
- out.println("if (isValueReference(" + propVar + "))");
+ out.println("if (" + propVar + " != null)");
+ out.println("{");
+ out.indent();
+ out.println("if (!" + propVar + ".isLiteralText())");
+ out.println("{");
out.indent();
- out.println("mb = createMethodBinding(" + propVar + ", " + classArray + ");");
+ 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("mb = new org.apache.myfaces.trinidadinternal.taglib.ConstantMethodBinding(" + propVar + ");");
+ out.println("bean.setProperty(" + componentClass + "." + propKey + ",");
+ out.println("\tKeyStroke.getKeyStroke(val.toString()));");
+ out.unindent();
+ out.unindent();
+ out.println("}");
out.unindent();
+ out.println("}");
}
else
{
- // never a literal, no need for ConstantMethodBinding
- out.println("MethodBinding mb = createMethodBinding(" + propVar + ", " +
- classArray + ");");
+ 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("}");
}
-
- out.println("bean.setProperty(" + componentClass + "." + propKey + ", mb);");
- out.unindent();
- out.println("}");
- }
-
- private void _writeSetKeyStroke(
- 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();
- 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("}");
}
@@ -1831,25 +2268,53 @@
String propKey = Util.getConstantNameFromProperty(propName, "_KEY");
String propVar = "_" + propName;
- 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("}");
+ 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("}");
+ }
}
@@ -1865,32 +2330,69 @@
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("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("}");
+ 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("}");
}
@@ -1907,23 +2409,54 @@
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("Converter converter = getFacesContext().getApplication().");
- out.indent();
- out.println("createConverter(" + propVar + ");");
- out.unindent();
- out.println("bean.setProperty(" + componentClass + "." + propKey + ", converter);");
- out.unindent();
- out.println("}");
+ 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("}");
}
@@ -1935,6 +2468,11 @@
return (sig != null && "java.lang.String".equals(sig.getReturnType()));
}
+ private boolean _is12()
+ {
+ return "1.2".equals(jsfVersion) || "12".equals(jsfVersion);
+ }
+
private class IfComponentModifiedFilter extends ComponentFilter
{
protected boolean accept(
@@ -2041,6 +2579,12 @@
*/
private boolean force;
+
+ /**
+ * @parameter
+ */
+ private String jsfVersion;
+
static private String _resolveType(
String className)
{
@@ -2089,4 +2633,26 @@
" href CDATA #IMPLIED\n" +
" xpointer CDATA #IMPLIED>\n" +
"]>\n";
+
+ static final private Set _CAN_COERCE = new HashSet();
+ static
+ {
+ _CAN_COERCE.add("java.lang.String");
+ _CAN_COERCE.add("java.lang.Integer");
+ _CAN_COERCE.add("java.lang.Long");
+ _CAN_COERCE.add("java.lang.Boolean");
+ _CAN_COERCE.add("java.lang.Double");
+ _CAN_COERCE.add("java.lang.Float");
+ _CAN_COERCE.add("java.lang.Short");
+ _CAN_COERCE.add("java.lang.Character");
+ _CAN_COERCE.add("java.lang.Byte");
+ _CAN_COERCE.add("int");
+ _CAN_COERCE.add("long");
+ _CAN_COERCE.add("boolean");
+ _CAN_COERCE.add("double");
+ _CAN_COERCE.add("float");
+ _CAN_COERCE.add("short");
+ _CAN_COERCE.add("char");
+ _CAN_COERCE.add("byte");
+ }
}
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=474621&r1=474620&r2=474621
==============================================================================
--- 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 Mon Nov 13 17:34:56 2006
@@ -179,6 +179,8 @@
// faces-config/component/property/property-extension
digester.addBeanPropertySetter("faces-config/component/property/property-extension/state-holder",
"stateHolder");
+ digester.addBeanPropertySetter("faces-config/component/property/property-extension/jsp-property-name",
+ "jspPropertyName");
// faces-config/component/property/property-extension
digester.addBeanPropertySetter("faces-config/component/property/property-extension/list",
"list");
Modified: incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.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/PropertyBean.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/plugins/maven-faces-plugin/src/main/java/org/apache/myfaces/trinidadbuild/plugin/faces/parse/PropertyBean.java Mon Nov 13 17:34:56 2006
@@ -280,6 +280,18 @@
return ("javax.faces.el.MethodBinding".equals(getPropertyClass()));
}
+
+ /**
+ * Returns true if this property is a method binding.
+ *
+ * @return true if this property is a method binding,
+ * otherwise false
+ */
+ public boolean isMethodExpression()
+ {
+ return ("javax.el.MethodExpression".equals(getPropertyClass()));
+ }
+
/**
* Parses the possible values for this property into a String array
* using space as the separator between values.
@@ -304,8 +316,32 @@
setUnsupportedAgents(unsupportedAgents.split(" "));
}
+ /**
+ * Sets the JSP name of this property.
+ *
+ * @param jspPropertyName the JSP property name
+ */
+ public void setJspPropertyName(
+ String jspPropertyName)
+ {
+ _jspPropertyName = jspPropertyName;
+ }
+
+ /**
+ * Returns the JSP name of this property.
+ *
+ * @return the JSP property name
+ */
+ public String getJspPropertyName()
+ {
+ if (_jspPropertyName == null)
+ return getPropertyName();
+
+ return _jspPropertyName;
+ }
private String _aliasOf;
+ private String _jspPropertyName;
private boolean _required;
private boolean _literalOnly;
private boolean _stateHolder;
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/pom.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/pom.xml?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/pom.xml (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/pom.xml Mon Nov 13 17:34:56 2006
@@ -22,7 +22,7 @@
<artifactId>trinidad</artifactId>
<packaging>pom</packaging>
<name>Apache Incubator Trinidad Podling</name>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>incubator-1.2-m1-SNAPSHOT</version>
<description>Apache Incubator Trinidad Podling</description>
<issueManagement>
@@ -222,7 +222,7 @@
<plugin>
<groupId>org.apache.myfaces.trinidadbuild</groupId>
<artifactId>maven-faces-plugin</artifactId>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>incubator-1.2-m1-SNAPSHOT</version>
<inherited>true</inherited>
</plugin>
@@ -247,8 +247,10 @@
<configuration>
<source>1.5</source>
<target>1.5</target>
+<!--
<showWarnings>true</showWarnings>
- <compilerArgument>-Xlint:all,-serial,-fallthrough</compilerArgument>
+ <compilerArgument>-Xlint:all,-serial,-fallthrough,-deprecation</compilerArgument>
+-->
</configuration>
</plugin>
@@ -338,16 +340,16 @@
</dependency>
<dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>1.1.4</version>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2-b19</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>1.1.4</version>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.2-b19</version>
<scope>provided</scope>
</dependency>
@@ -356,6 +358,26 @@
<artifactId>shale-test</artifactId>
<version>1.0.3</version>
<scope>test</scope>
+ <!-- Ignore the references to myfaces and the JSP API -->
+ <!-- We could force shale to JSF RI 1.2, but it's better
+ this way - Shale isn't marking JSF 1.2 as provided,
+ so it's pulling in its own version -->
+ <exclusions>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -375,20 +397,20 @@
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-build</artifactId>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>${pom.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-api</artifactId>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-api</artifactId>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>${pom.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
@@ -396,7 +418,7 @@
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-impl</artifactId>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>${pom.version}</version>
</dependency>
@@ -408,11 +430,18 @@
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
- <version>1.1.6</version>
+ <version>1.1.11</version>
</dependency>
<!--
@@ -466,5 +495,4 @@
</snapshotRepository>
-->
</distributionManagement>
-
</project>
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/pom.xml?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/pom.xml (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/pom.xml Mon Nov 13 17:34:56 2006
@@ -18,7 +18,7 @@
<parent>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad</artifactId>
- <version>incubator-m1-SNAPSHOT</version>
+ <version>incubator-1.2-m1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -132,8 +132,8 @@
</dependency>
<dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
</dependency>
<!-- "test" scope dependencies -->
@@ -146,6 +146,13 @@
<dependency>
<groupId>org.apache.shale</groupId>
<artifactId>shale-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.7.0</version>
<scope>test</scope>
</dependency>
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java Mon Nov 13 17:34:56 2006
@@ -15,6 +15,8 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.el.MethodExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
@@ -40,7 +42,7 @@
* @param event
* @throws javax.faces.event.AbortProcessingException
*/
- @Override
+ @Override
public void broadcast(FacesEvent event)
throws AbortProcessingException
{
@@ -48,7 +50,7 @@
// Deliver to the default ChartDrillDownEvent
if (event instanceof ChartDrillDownEvent)
{
- broadcastToMethodBinding(event, getChartDrillDownListener());
+ broadcastToMethodExpression(event, getChartDrillDownListener());
}
super.broadcast(event);
}
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXCommandTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXCommandTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXCommandTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXCommandTemplate.java Mon Nov 13 17:34:56 2006
@@ -15,7 +15,10 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.el.MethodExpression;
+
import javax.faces.component.ActionSource;
+import javax.faces.component.ActionSource2;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
@@ -35,12 +38,48 @@
* @author The Oracle ADF Faces Team
*/
abstract public class UIXCommandTemplate extends UIXComponentBase
- implements ActionSource, DialogSource
+ implements ActionSource, ActionSource2, DialogSource
{
/**/ // Abstract methods implemented by code gen
+/**/ abstract public MethodExpression getActionExpression();
+/**/ abstract public MethodExpression setActionExpression();
+/**/ abstract public MethodExpression getLaunchListener();
/**/ abstract public MethodBinding getActionListener();
-/**/ abstract public MethodBinding getReturnListener();
-/**/ abstract public MethodBinding getLaunchListener();
+/**/ abstract public MethodExpression getReturnListener();
+/**/ abstract public MethodExpression getLaunchListener();
+
+ @Deprecated
+ public void setLaunchListener(MethodBinding binding)
+ {
+ setLaunchListener(adaptMethodBinding(binding));
+ }
+
+ @Deprecated
+ public void setReturnListener(MethodBinding binding)
+ {
+ setReturnListener(adaptMethodBinding(binding));
+ }
+
+
+ public MethodBinding getAction()
+ {
+ MethodExpression me = getActionExpression();
+ if (me == null)
+ return null;
+
+ if (me instanceof MethodBindingMethodExpression)
+ return ((MethodBindingMethodExpression) me).getMethodBinding();
+
+ return new MethodExpressionMethodBinding(me);
+ }
+
+ public void setAction(MethodBinding binding)
+ {
+ if (binding instanceof MethodExpressionMethodBinding)
+ setActionExpression(((MethodExpressionMethodBinding) binding).getMethodExpression());
+ else
+ setActionExpression(new MethodBindingMethodExpression(binding));
+ }
/**
* <p>Intercept <code>queueEvent</code> and mark the phaseId for the
@@ -107,7 +146,7 @@
if (event instanceof LaunchEvent)
{
- broadcastToMethodBinding(event, getLaunchListener());
+ broadcastToMethodExpression(event, getLaunchListener());
boolean useWindow =
Boolean.TRUE.equals(getAttributes().get("useWindow"));
@@ -115,7 +154,7 @@
}
else if (event instanceof ReturnEvent)
{
- broadcastToMethodBinding(event, getReturnListener());
+ broadcastToMethodExpression(event, getReturnListener());
// =-=AEW: always jump to render response??? Seems the safest
// option, because we don't want to immediately update a model
// or really perform any validation.
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXDecorateCollectionTemplate.java Mon Nov 13 17:34:56 2006
@@ -15,6 +15,7 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.faces.context.FacesContext;
import javax.faces.component.NamingContainer;
/**
@@ -61,9 +62,9 @@
* @return the local clientId
*/
@Override
- protected final String getLocalClientId()
+ public final String getContainerClientId(FacesContext context)
{
- String id = super.getLocalClientId();
+ String id = getClientId(context);
String key = getCurrencyString();
if (key != null)
{
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXEditableValueTemplate.java Mon Nov 13 17:34:56 2006
@@ -17,6 +17,8 @@
import java.util.Iterator;
+import javax.el.ValueExpression;
+
import javax.faces.application.Application;
import javax.faces.application.FacesMessage;
import javax.faces.component.EditableValueHolder;
@@ -25,7 +27,6 @@
import javax.faces.convert.ConverterException;
import javax.faces.el.EvaluationException;
import javax.faces.el.MethodBinding;
-import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.ValueChangeEvent;
@@ -111,6 +112,7 @@
// Submitted value == null means "the component was not submitted
// at all"; validation should not continue
+
Object submittedValue = getSubmittedValue();
if (submittedValue == null)
return;
@@ -239,21 +241,21 @@
if (!isValid() || !isLocalValueSet())
return;
- ValueBinding binding = getFacesBean().getValueBinding(VALUE_KEY);
- if (binding == null)
+ ValueExpression expression = getFacesBean().getValueExpression(VALUE_KEY);
+ if (expression == null)
return;
try
{
Object localValue = getLocalValue();
- binding.setValue(context, localValue);
+ expression.setValue(context.getELContext(), localValue);
setValue(null);
setLocalValueSet(false);
if (_LOG.isFiner())
{
_LOG.finer("Wrote value {0} to model {1} in component {2}",
new Object[]{localValue,
- binding.getExpressionString(),
+ expression.getExpressionString(),
this});
}
}
@@ -263,8 +265,8 @@
// bean attribute level validation:
if (_LOG.isFine())
{
- _LOG.fine("Error updating binding ({0})",
- binding.getExpressionString());
+ _LOG.fine("Error updating expression ({0})",
+ expression.getExpressionString());
_LOG.fine(e);
}
@@ -381,7 +383,6 @@
{
newValue = renderer.getConvertedValue(context, this,
submittedValue);
-
if (_LOG.isFine())
{
_LOG.fine("Renderer " + renderer + " returned value " + newValue + "(" +
@@ -466,7 +467,7 @@
{
Object o = getAttributes().get("label");
if (o == null)
- o = getValueBinding("label");
+ o = getValueExpression("label");
return o;
}
@@ -475,7 +476,7 @@
{
Object o = getAttributes().get("requiredMessageDetail");
if (o == null)
- o = getValueBinding("requiredMessageDetail");
+ o = getValueExpression("requiredMessageDetail");
return o;
}
@@ -527,13 +528,13 @@
return converter;
}
- ValueBinding valueBinding = getValueBinding("value");
- if (valueBinding == null)
+ ValueExpression valueExpression = getValueExpression("value");
+ if (valueExpression == null)
{
return null;
}
- Class<?> converterType = valueBinding.getType(context);
+ Class<?> converterType = valueExpression.getType(context.getELContext());
// if converterType is null, String, or Object, assume
// no conversion is needed
if (converterType == null ||
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPollTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPollTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPollTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPollTemplate.java Mon Nov 13 17:34:56 2006
@@ -15,6 +15,8 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.el.MethodExpression;
+
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
@@ -32,7 +34,13 @@
/**/ // Abstract methods implemented by code gen
/**/ abstract public boolean isImmediate();
-/**/ abstract public MethodBinding getPollListener();
+/**/ abstract public MethodExpression getPollListener();
+
+ @Deprecated
+ public void setPollListener(MethodBinding binding)
+ {
+ setPollListener(adaptMethodBinding(binding));
+ }
//
// Abstract methods implemented by subclass.
@@ -45,7 +53,7 @@
// Notify the specified Poll listener method (if any)
if (event instanceof PollEvent)
{
- broadcastToMethodBinding(event, getPollListener());
+ broadcastToMethodExpression(event, getPollListener());
}
}
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java Mon Nov 13 17:34:56 2006
@@ -15,7 +15,10 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.el.MethodExpression;
+
import javax.faces.component.ActionSource;
+import javax.faces.component.ActionSource2;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
@@ -36,12 +39,40 @@
* @author The Oracle ADF Faces Team
*/
abstract public class UIXSelectInputTemplate extends UIXEditableValue
- implements ActionSource
+ implements ActionSource, ActionSource2
{
/**/ // Abstract methods implemented by code gen
+/**/ abstract public MethodExpression getActionExpression();
+/**/ abstract public MethodExpression setActionExpression();
/**/ abstract public MethodBinding getActionListener();
-/**/ abstract public MethodBinding getReturnListener();
+/**/ abstract public MethodExpression getReturnListener();
+
+ @Deprecated
+ public void setReturnListener(MethodBinding binding)
+ {
+ setReturnListener(adaptMethodBinding(binding));
+ }
+
+ public MethodBinding getAction()
+ {
+ MethodExpression me = getActionExpression();
+ if (me == null)
+ return null;
+
+ if (me instanceof MethodBindingMethodExpression)
+ return ((MethodBindingMethodExpression) me).getMethodBinding();
+
+ return new MethodExpressionMethodBinding(me);
+ }
+
+ public void setAction(MethodBinding binding)
+ {
+ if (binding instanceof MethodExpressionMethodBinding)
+ setActionExpression(((MethodExpressionMethodBinding) binding).getMethodExpression());
+ else
+ setActionExpression(new MethodBindingMethodExpression(binding));
+ }
/**
* <p>Intercept <code>queueEvent</code> and mark the phaseId for any
@@ -113,7 +144,7 @@
{
super.broadcast(event);
- broadcastToMethodBinding(event, getReturnListener());
+ broadcastToMethodExpression(event, getReturnListener());
Object returnValue = ((ReturnEvent) event).getReturnValue();
if (returnValue != null)
{
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java Mon Nov 13 17:34:56 2006
@@ -16,6 +16,7 @@
package org.apache.myfaces.trinidad.component;
import java.io.IOException;
+import javax.el.MethodExpression;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
@@ -36,11 +37,17 @@
public abstract class UIXSelectRangeTemplate extends UIXComponentBase
{
/**/ // Abstract methods implemented by code gen
-/**/ abstract public MethodBinding getRangeChangeListener();
+/**/ abstract public MethodExpression getRangeChangeListener();
/**/ abstract public void setFirst(int first);
/**/ abstract public boolean isImmediate();
/**/ abstract public Object getValue();
+ @Deprecated
+ public void setRangeChangeListener(MethodBinding binding)
+ {
+ setRangeChangeListener(adaptMethodBinding(binding));
+ }
+
@Override
public void encodeBegin(FacesContext context) throws IOException
{
@@ -58,7 +65,7 @@
// update first when the event is delivered
setFirst(gtEvent.getNewStart());
- broadcastToMethodBinding(event, getRangeChangeListener());
+ broadcastToMethodExpression(event, getRangeChangeListener());
}
// Perform standard superclass processing
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java Mon Nov 13 17:34:56 2006
@@ -15,6 +15,7 @@
*/
package org.apache.myfaces.trinidad.component;
+import javax.el.MethodExpression;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
@@ -34,7 +35,13 @@
/**/ abstract public boolean isDisclosed();
/**/ abstract public void setDisclosed(boolean setDisclosed);
/**/ abstract public boolean isImmediate();
-/**/ abstract public MethodBinding getDisclosureListener();
+/**/ abstract public MethodExpression getDisclosureListener();
+
+ @Deprecated
+ public void setDisclosureListener(MethodBinding binding)
+ {
+ setDisclosureListener(adaptMethodBinding(binding));
+ }
@Override
public void processDecodes(FacesContext context)
@@ -81,7 +88,7 @@
getFacesContext().renderResponse();
// Notify the specified disclosure listener method (if any)
- broadcastToMethodBinding(event, getDisclosureListener());
+ broadcastToMethodExpression(event, getDisclosureListener());
}
}
Modified: incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java?view=diff&rev=474621&r1=474620&r2=474621
==============================================================================
--- incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java (original)
+++ incubator/adffaces/branches/faces-1_2-061113/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java Mon Nov 13 17:34:56 2006
@@ -19,6 +19,8 @@
import java.util.Iterator;
import java.util.List;
+import javax.el.MethodExpression;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
@@ -101,7 +103,7 @@
// since the range is now different we can clear the currency cache:
clearCurrencyStringCache();
- broadcastToMethodBinding(event, getRangeChangeListener());
+ broadcastToMethodExpression(event, getRangeChangeListener());
}
else if (event instanceof RowDisclosureEvent)
{
@@ -109,20 +111,20 @@
RowKeySet set = getDisclosedRowKeys();
set.addAll(eEvent.getAddedSet());
set.removeAll(eEvent.getRemovedSet());
- broadcastToMethodBinding(event, getRowDisclosureListener());
+ broadcastToMethodExpression(event, getRowDisclosureListener());
}
else if (event instanceof SortEvent)
{
SortEvent sEvent = (SortEvent) event;
setSortCriteria(sEvent.getSortCriteria());
- broadcastToMethodBinding(event, getSortListener());
+ broadcastToMethodExpression(event, getSortListener());
}
else if (event instanceof SelectionEvent)
{
//pu: Implicitly record a Change for 'selectionState' attribute
addAttributeChange("selectedRowKeys",
getSelectedRowKeys());
- broadcastToMethodBinding(event, getSelectionListener());
+ broadcastToMethodExpression(event, getSelectionListener());
}
super.broadcast(event);
@@ -137,11 +139,35 @@
/**/ abstract public void setShowAll(boolean showAll);
/**/ abstract public boolean isShowAll();
/**/ abstract public UIComponent getDetailStamp();
-/**/ public abstract MethodBinding getRangeChangeListener();
-/**/ public abstract MethodBinding getSortListener();
-/**/ public abstract MethodBinding getRowDisclosureListener();
-/**/ public abstract MethodBinding getSelectionListener();
+/**/ public abstract MethodExpression getRangeChangeListener();
+/**/ public abstract MethodExpression getSortListener();
+/**/ public abstract MethodExpression getRowDisclosureListener();
+/**/ public abstract MethodExpression getSelectionListener();
/**/ public abstract boolean isImmediate();
+
+ @Deprecated
+ public void setRangeChangeListener(MethodBinding binding)
+ {
+ setRangeChangeListener(adaptMethodBinding(binding));
+ }
+
+ @Deprecated
+ public void setSortListener(MethodBinding binding)
+ {
+ setSortListener(adaptMethodBinding(binding));
+ }
+
+ @Deprecated
+ public void setRowDisclosureListener(MethodBinding binding)
+ {
+ setRowDisclosureListener(adaptMethodBinding(binding));
+ }
+
+ @Deprecated
+ public void setSelectionListener(MethodBinding binding)
+ {
+ setSelectionListener(adaptMethodBinding(binding));
+ }
@Override
@SuppressWarnings("unchecked")