You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2008/09/28 22:55:32 UTC
svn commit: r699891 -
/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
Author: bommel
Date: Sun Sep 28 13:55:32 2008
New Revision: 699891
URL: http://svn.apache.org/viewvc?rev=699891&view=rev
Log:
(TOBAGO-702) Add mode attribute
Modified:
myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
Modified: myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java?rev=699891&r1=699890&r2=699891&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java (original)
+++ myfaces/tobago/trunk/extension/facelets/src/main/java/org/apache/myfaces/tobago/facelets/AttributeHandler.java Sun Sep 28 13:55:32 2008
@@ -72,15 +72,13 @@
if (mode != null) {
if ("isNotSet".equals(mode.getValue())) {
- String string = value.getValue();
- if (isMethodOrValueExpression(string)) {
+ if (!value.isLiteral()) {
ValueExpression expression = getExpression(faceletContext);
Boolean result = Boolean.valueOf(expression == null);
parent.getAttributes().put(name.getValue(), result);
}
} else if ("isSet".equals(mode.getValue())) {
- String string = value.getValue();
- if (isMethodOrValueExpression(string)) {
+ if (!value.isLiteral()) {
ValueExpression expression = getExpression(faceletContext);
Boolean result = Boolean.valueOf(expression != null);
parent.getAttributes().put(name.getValue(), result);
@@ -142,8 +140,7 @@
((ActionSource) parent).setActionListener(new LegacyMethodBinding(actionListener));
}
} else if ("actionFromValue".equals(mode.getValue())) {
- String string = value.getValue();
- if (isMethodOrValueExpression(string)) {
+ if (!value.isLiteral()) {
String result = value.getValue(faceletContext);
parent.getAttributes().put(name.getValue(), new ConstantMethodBinding(result));
}
@@ -235,14 +232,7 @@
private ValueExpression getExpression(FaceletContext faceletContext) {
String myValue = removeElParenthesis(value.getValue());
- ValueExpression expression = faceletContext.getVariableMapper().resolveVariable(myValue);
- return expression;
- }
-
- private ValueExpression getExpressionOld(FaceletContext faceletContext) {
- String myValue = value.getValue().replaceAll("(\\$\\{)|(\\})", "");
- ValueExpression expression = faceletContext.getVariableMapper().resolveVariable(myValue);
- return expression;
+ return faceletContext.getVariableMapper().resolveVariable(myValue);
}
private MethodExpression getMethodExpression(FaceletContext faceletContext, Class returnType, Class[] args) {
@@ -250,7 +240,7 @@
// the expression can be empty
// in this case return nothing
if (value.getValue().startsWith("${")) {
- ValueExpression expression = getExpressionOld(faceletContext);
+ ValueExpression expression = getExpression(faceletContext);
if (expression != null) {
ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
return new TagMethodExpression(value, expressionFactory.createMethodExpression(faceletContext,
@@ -272,7 +262,7 @@
// the expression can be empty
// in this case return nothing
if (value.getValue().startsWith("${")) {
- ValueExpression expression = getExpressionOld(faceletContext);
+ ValueExpression expression = getExpression(faceletContext);
if (expression != null) {
setConverter(faceletContext, parent, nameValue, expression);
}