You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/05/07 18:58:43 UTC
svn commit: r772709 - in /ofbiz/trunk/framework:
base/src/org/ofbiz/base/util/StringUtil.java
widget/src/org/ofbiz/widget/form/ModelForm.java
widget/src/org/ofbiz/widget/form/ModelFormField.java
Author: adrianc
Date: Thu May 7 16:58:40 2009
New Revision: 772709
URL: http://svn.apache.org/viewvc?rev=772709&view=rev
Log:
Updated model widgets to use operator substitution.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=772709&r1=772708&r2=772709&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Thu May 7 16:58:40 2009
@@ -500,12 +500,15 @@
*/
public static String convertOperatorSubstitutions(String expression) {
String result = expression;
- if (result != null && result.contains("@")) {
+ if (result != null && (result.contains("@") || result.contains("'"))) {
Set<String> keys = substitionPatternMap.keySet();
for (String replacement : keys) {
Pattern pattern = substitionPatternMap.get(replacement);
result = pattern.matcher(result).replaceAll(replacement);
}
+ if (Debug.verboseOn()) {
+ Debug.logVerbose("Converted " + expression + " to " + result, module);
+ }
}
return result;
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=772709&r1=772708&r2=772709&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Thu May 7 16:58:40 2009
@@ -1931,7 +1931,7 @@
Iterator altTargetIter = this.altTargets.iterator();
while (altTargetIter.hasNext()) {
AltTarget altTarget = (AltTarget) altTargetIter.next();
- Object retVal = bsh.eval(altTarget.useWhen);
+ Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
boolean condTrue = false;
// retVal should be a Boolean, if not something weird is up...
if (retVal instanceof Boolean) {
@@ -2607,7 +2607,7 @@
// use the same Interpreter (ie with the same context setup) for all evals
Interpreter bsh = this.getBshInterpreter(context);
for (AltRowStyle altRowStyle : this.altRowStyles) {
- Object retVal = bsh.eval(altRowStyle.useWhen);
+ Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altRowStyle.useWhen));
// retVal should be a Boolean, if not something weird is up...
if (retVal instanceof Boolean) {
Boolean boolVal = (Boolean) retVal;
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=772709&r1=772708&r2=772709&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Thu May 7 16:58:40 2009
@@ -2404,7 +2404,7 @@
context.put("bshInterpreter", bsh);
}
- Object retVal = bsh.eval(useWhen);
+ Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhen));
// retVal should be a Boolean, if not something weird is up...
if (retVal instanceof Boolean) {