You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/04/08 23:38:18 UTC
svn commit: r1311109 -
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
Author: jleroux
Date: Sun Apr 8 21:38:17 2012
New Revision: 1311109
URL: http://svn.apache.org/viewvc?rev=1311109&view=rev
Log:
A patch from Nicolas Malin "Use flexibleStringRenderer for alt-target element on form" https://issues.apache.org/jira/browse/OFBIZ-4588
At this time the alt-target element value is only parse on bsh interpreter. To resynchronise with the rest of framework, convert with a flexibleStringRenderer.
jleroux: re-adding after reverting r1311082
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
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=1311109&r1=1311108&r2=1311109&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 Sun Apr 8 21:38:17 2012
@@ -2060,7 +2060,11 @@ public class ModelForm extends ModelWidg
// use the same Interpreter (ie with the same context setup) for all evals
Interpreter bsh = this.getBshInterpreter(context);
for (AltTarget altTarget: this.altTargets) {
- Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
+ String useWhen = altTarget.useWhen;
+ if (useWhen != null && !useWhen.isEmpty()) {
+ useWhen = FlexibleStringExpander.expandString(useWhen, context);
+ }
+ Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhen));
boolean condTrue = false;
// retVal should be a Boolean, if not something weird is up...
if (retVal instanceof Boolean) {
Re: svn commit: r1311109 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
Posted by Adrian Crum <ad...@sandglass-software.com>.
The conditionals are unnecessary - FSE will return the original string
if the string is null or empty.
-Adrian
On 4/8/2012 10:38 PM, jleroux@apache.org wrote:
> Author: jleroux
> Date: Sun Apr 8 21:38:17 2012
> New Revision: 1311109
>
> URL: http://svn.apache.org/viewvc?rev=1311109&view=rev
> Log:
> A patch from Nicolas Malin "Use flexibleStringRenderer for alt-target element on form" https://issues.apache.org/jira/browse/OFBIZ-4588
>
> At this time the alt-target element value is only parse on bsh interpreter. To resynchronise with the rest of framework, convert with a flexibleStringRenderer.
>
> jleroux: re-adding after reverting r1311082
>
> Modified:
> ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>
> 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=1311109&r1=1311108&r2=1311109&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 Sun Apr 8 21:38:17 2012
> @@ -2060,7 +2060,11 @@ public class ModelForm extends ModelWidg
> // use the same Interpreter (ie with the same context setup) for all evals
> Interpreter bsh = this.getBshInterpreter(context);
> for (AltTarget altTarget: this.altTargets) {
> - Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(altTarget.useWhen));
> + String useWhen = altTarget.useWhen;
> + if (useWhen != null&& !useWhen.isEmpty()) {
> + useWhen = FlexibleStringExpander.expandString(useWhen, context);
> + }
> + Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhen));
> boolean condTrue = false;
> // retVal should be a Boolean, if not something weird is up...
> if (retVal instanceof Boolean) {
>
>