Permalink
Browse files

NXP-8942: Fix nxu:set tag when caching and resolving the expression t…

…wice
  • Loading branch information...
atchertchian committed Feb 29, 2012
1 parent 3875302 commit 6cbb31e17ea5e6d446d928000391ba053d3d2802
@@ -30,6 +30,8 @@
import org.apache.commons.logging.LogFactory;
import org.nuxeo.ecm.platform.ui.web.binding.alias.AliasTagHandler;
import org.nuxeo.ecm.platform.ui.web.binding.alias.AliasVariableMapper;
+import org.nuxeo.ecm.platform.ui.web.util.ComponentTagUtils;
+
import com.sun.facelets.FaceletContext;
import com.sun.facelets.FaceletException;
@@ -81,15 +83,29 @@ public void apply(FaceletContext ctx, UIComponent parent)
if (cache != null) {
cacheValue = cache.getBoolean(ctx);
}
+ boolean resolveTwiceBool = false;
+ if (resolveTwice != null) {
+ resolveTwiceBool = resolveTwice.getBoolean(ctx);
+ }
+
String varStr = var.getValue(ctx);
ValueExpression ve;
if (cacheValue) {
// resolve value and put it as is in variable mapper
Object res = value.getObject(ctx);
+ if (resolveTwiceBool && res instanceof String
+ && ComponentTagUtils.isValueReference((String) res)) {
+ ve = ctx.getExpressionFactory().createValueExpression(ctx,
+ (String) res, Object.class);
+ res = ve.getValue(ctx);
+ }
ve = ctx.getExpressionFactory().createValueExpression(res,
Object.class);
} else {
ve = value.getValueExpression(ctx, Object.class);
+ if (resolveTwiceBool) {
+ ve = new MetaValueExpression(ve);
+ }
}
AliasVariableMapper target = new AliasVariableMapper(id);

0 comments on commit 6cbb31e

Please sign in to comment.