You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by gv...@apache.org on 2005/11/02 05:07:36 UTC
svn commit: r330187 - in /struts/shale/trunk/clay-plugin/src:
java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
test/org/apache/shale/clay/config/ConfigTestCase.java
Author: gvanmatre
Date: Tue Nov 1 20:07:26 2005
New Revision: 330187
URL: http://svn.apache.org/viewcvs?rev=330187&view=rev
Log:
Rearranged the processing of the new symbol replacement so that a symbol value containing EL will be evaluated.
Modified:
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/ConfigTestCase.java
Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java?rev=330187&r1=330186&r2=330187&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyValueCommand.java Tue Nov 1 20:07:26 2005
@@ -83,17 +83,18 @@
if (tagUtils == null)
throw new NullPointerException(messages.getMessage("clay.null.tagUtils"));
+ // replace all symbols returning the target attribute value
+ String expr = replaceMnemonic(clayContext);
+
//when using the html templating, javascript and css will have matching curly braces {}.
//and pound sign # too.
int pound = -1;
int leftCurly = -1;
int rightCurly = -1;
- if (attributeBean.getValue() != null) {
- pound = attributeBean.getValue().indexOf('#');
- leftCurly = attributeBean.getValue().indexOf('{');
- rightCurly = attributeBean.getValue().indexOf('}');
- }
+ pound = expr.indexOf('#');
+ leftCurly = expr.indexOf('{');
+ rightCurly = expr.indexOf('}');
String bindingType = attributeBean.getBindingType();
if (bindingType == null)
@@ -107,9 +108,6 @@
&& (child instanceof UIComponentBase));
//use early binding
boolean isEarly = bindingType.equals(AttributeBean.BINDING_TYPE_EARLY);
-
-
- String expr = replaceMnemonic(clayContext);
if (isEL && isVB)
tagUtils.setValueBinding((UIComponentBase) child, attributeBean.getName(), expr);
Modified: struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/ConfigTestCase.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/ConfigTestCase.java?rev=330187&r1=330186&r2=330187&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/ConfigTestCase.java (original)
+++ struts/shale/trunk/clay-plugin/src/test/org/apache/shale/clay/config/ConfigTestCase.java Tue Nov 1 20:07:26 2005
@@ -639,6 +639,27 @@
assertEquals("command finished", isFinal, true);
assertEquals("value = 10", child.getValue(), "10");
+
+ // test a symbol value of an el value
+ child = (javax.faces.component.html.HtmlOutputText) facesContext.getApplication().createComponent("javax.faces.HtmlOutputText");
+ assertNotNull("javax.faces.HtmlOutputText", child);
+
+ displayElement.addSymbol("@value", "#{value}");
+ attr.setBindingType(AttributeBean.BINDING_TYPE_EARLY);
+ servletContext.setAttribute("value", "10");
+
+ clayContext.setFacesContext(facesContext);
+ clayContext.setChild(child);
+ clayContext.setAttribute(attr);
+ clayContext.setDisplayElement(displayElement);
+ // normally done in the AssignChildrenCommand
+ clayContext.setSymbols(displayElement.getSymbols());
+
+ isFinal = command.execute(clayContext);
+ assertEquals("command finished", isFinal, true);
+ assertEquals("value = 10", child.getValue(), "10");
+
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org