Simplify the generated tag handler logic. No need
to check if the ValueExpression is literal or not
as the implementation of setValueExpression() must
do this anyway.
Removed the special logic for the bundle attribute.
It isn't used.
SECTION: Modified Files
----------------------------
M src/com/sun/faces/generate/HtmlTaglib21Generator.java
SECTION: Diffs
----------------------------
Index: src/com/sun/faces/generate/HtmlTaglib21Generator.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-tools/src/com/sun/faces/generate/HtmlTaglib21Generator.java,v
retrieving revision 1.4
diff -u -r1.4 HtmlTaglib21Generator.java
--- src/com/sun/faces/generate/HtmlTaglib21Generator.java 14 Mar 2006
01:09:04 -0000 1.4
+++ src/com/sun/faces/generate/HtmlTaglib21Generator.java 17 May 2006
17:33:19 -0000
@@ -206,8 +206,7 @@
continue;
}
- String propertyName = property.getPropertyName();
- String propertyType = property.getPropertyClass();
+ String propertyName = property.getPropertyName();
// SPECIAL - Don't generate these properties
if ("binding".equals(propertyName) ||
@@ -216,8 +215,7 @@
"converter".equals(propertyName)) {
continue;
}
- String ivar = mangle(propertyName);
- String vbKey = ivar;
+ String ivar = mangle(propertyName);
String comp =
GeneratorUtil.stripJavaxFacesPrefix(componentType).toLowerCase();
String capPropName = capitalize(propertyName);
@@ -225,25 +223,15 @@
if (property.isValueExpressionEnabled()) {
writer.fwrite("if (" + ivar + " != null) {\n");
writer.indent();
- writer.fwrite("if (!" + ivar + ".isLiteralText()) {\n");
- writer.indent();
- writer.fwrite(comp + ".setValueExpression(\"" + vbKey +
- "\", " + ivar + ");\n");
- writer.outdent();
- writer.fwrite("} else {\n");
- writer.indent();
- if (primitive(propertyType)) {
- writer.fwrite(comp + ".set" + capPropName +
- "(" + GeneratorUtil.convertToObject(propertyType) +
- ".valueOf(" + ivar + ".getExpressionString())." +
- propertyType + "Value());\n");
+ writer.fwrite(comp);
+ if ("_for".equals(ivar)) {
+ writer.write(".setValueExpression(\"for\", " +
+ ivar + ");\n");
} else {
- writer.fwrite(comp + ".set" + capPropName + '(' +
ivar +
- ".getExpressionString());\n");
+ writer.write(".setValueExpression(\"" + ivar + "\", " +
+ ivar + ");\n");
}
writer.outdent();
- writer.fwrite("}\n");
- writer.outdent();
writer.fwrite("}\n\n");
} else if (property.isMethodExpressionEnabled()) {
if ("action".equals(ivar)) {
@@ -283,50 +271,24 @@
if (!attribute.isTagAttribute()) {
continue;
}
- String attributeName = attribute.getAttributeName();
- String attributeType = attribute.getAttributeClass();
+ String attributeName = attribute.getAttributeName();
String ivar = mangle(attributeName);
- String vbKey = ivar;
String comp =
GeneratorUtil.stripJavaxFacesPrefix(componentType).toLowerCase();
writer.fwrite("if (" + ivar + " != null) {\n");
writer.indent();
- writer.fwrite("if (!" + ivar + ".isLiteralText()) {\n");
- writer.indent();
+
writer.fwrite(comp);
- if ("_for".equals(ivar)) {
- writer.write(".setValueExpression(\"" + '_' + vbKey +
"\", " +
+ if ("_for".equals(ivar)) {
+ writer.write(".setValueExpression(\"for\", " +
ivar + ");\n");
} else {
- writer.write(".setValueExpression(\"" + vbKey + "\", " +
+ writer.write(".setValueExpression(\"" + ivar + "\", " +
ivar + ");\n");
}
- writer.outdent();
- writer.fwrite("} else {\n");
- writer.indent();
- if (primitive(attributeType)) {
- writer.fwrite(comp + ".getAttributes().put(\"" + ivar +
- "\", ");
- writer.write(GeneratorUtil.convertToObject(attributeType) +
- ".valueOf(" + ivar + ".getExpressionString()));\n");
- } else {
- if ("bundle".equals(ivar)) {
- writer.fwrite(comp +
-
".getAttributes().put(com.sun.faces.RIConstants.BUNDLE_ATTR, ");
- } else if ("_for".equals(ivar)) {
- writer.fwrite(comp +
- ".getAttributes().put(\"for\", ");
- } else {
- writer.fwrite(comp +
- ".getAttributes().put(\"" + ivar + "\", ");
- }
- writer.write(ivar + ".getExpressionString());\n");
- }
- writer.outdent();
- writer.fwrite("}\n");
- writer.outdent();
+ writer.outdent();
writer.fwrite("}\n");
}