In this case we are no converting data, we want to transfer a Float from a 
point to another.
We are using this  built-in 
http://freemarker.org/docs/ref_builtins_number.html#ref_builtin_c

Jacques

On Thursday, January 02, 2014 2:52 PM adrian.c...@sandglass-software.com wrote
> You are not understanding the problem and I don't know how to make it
> any simpler.
> 
> Mini-language and screen widgets both utilize the conversion framework
> to convert data types. The conversion framework is thoroughly tested and
> Float <--> String conversions work perfectly. If you are having a
> problem, then it is somewhere else - NOT in Mini-language or screen widgets.
> 
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
> 
> On 1/2/2014 8:10 AM, Jacques Le Roux wrote:
>> No, it's not the template. Actually as soon as you pass in 
>> SetField.runAction() (for widgets, similar for minilang) and have
>> (for instance) fr as locale in your env, you are screwed: the decimals are 
>> lost. That's why I changed things there.
>> 
>> Moreover this issue does not appear for points which comes directly from the 
>> DB and use the same path to the geoLocation.ftl
>> template but no set field 
>> For instance partymgr/control/PartyGeoLocation?partyId=DemoCustomer
>> or facility/control/EditFacilityGeoPoint?facilityId=WebStoreWarehouse
>> 
>> Jacques
>> 
>> On Thursday, January 02, 2014 1:08 PM adrian.c...@sandglass-software.com 
>> wrote
>>> That appears to be a problem in the template.
>>> 
>>> Adrian Crum
>>> Sandglass Software
>>> www.sandglass-software.com
>>> 
>>> On 1/2/2014 6:40 AM, Jacques Le Roux wrote:
>>>> I'm not quite sure to follow you. For isntance, currently if you change
>>>>    type="Float" locale="en"/>
>>>> for
>>>> />
>>>> in
>>>> <screen name="ExampleGeoLocationPointSet1">
>>>> 
>>>> You get an error in HtmlWidget.StringHtmlWrapperForFtl():
>>>> freemarker.core.NonNumericalException: point.lon is not a number, it is
>>>> org.ofbiz.widget.screen.HtmlWidget$StringHtmlWrapperForFtl
>>>> 
>>>> Jacques
>>>> 
>>>> On Thursday, January 02, 2014 12:23 PM adrian.c...@sandglass-software.com 
>>>> wrote
>>>>> The String would be converted to a Float. What would be the issue?
>>>>> 
>>>>> Adrian Crum
>>>>> Sandglass Software
>>>>> www.sandglass-software.com
>>>>> 
>>>>> On 1/2/2014 6:12 AM, Jacques Le Roux wrote:
>>>>>> Though Adrian,
>>>>>> 
>>>>>> There is something which makes me wonder.
>>>>>> 
>>>>>> Suppose we were not in the geolocation context, and we want to set a 
>>>>>> Float value like it's done in
>>>>>> 
>>>>>> <screen name="ExampleGeoLocationPointSet1">
>>>>>> and
>>>>>> <simple-method method-name="editGeoLocation" short-description="Edit 
>>>>>> GeoLocation">
>>>>>> 
>>>>>> And we have a floating-point DB field
>>>>>> 
>>>>>> Won't we get the same issue?
>>>>>> 
>>>>>> Jacques
>>>>>> 
>>>>>> 
>>>>>> On Thursday, January 02, 2014 8:52 AM jacques.le.r...@les7arts.com wrote
>>>>>>> It's just a temporary hack I hastily commited last night, so as I was 
>>>>>>> unsure I preferred to be safe than sorry.
>>>>>>> Good to know that MethodContext is thread safe.
>>>>>>> 
>>>>>>> I have still to check but your new data model proposition sounds to me 
>>>>>>> at 1st glance.
>>>>>>> 
>>>>>>> Note that the current works well, even for i18n, as long as you only 
>>>>>>> use a direct relation with data.
>>>>>>> But if you use <set> to save your data in DB then the problem arises.. 
>>>>>>> That's why I got this way...
>>>>>>> 
>>>>>>> Jacques
>>>>>>> 
>>>>>>> On Thursday, January 02, 2014 1:39 AM 
>>>>>>> adrian.c...@sandglass-software.com wrote
>>>>>>>> There is no need to synchronize on the <set> element model - it is
>>>>>>>> thread-safe. The MethodContext instance is per-thread, so it doesn't
>>>>>>>> need synchronization either.
>>>>>>>> 
>>>>>>>> Please take some time to understand the architecture before committing
>>>>>>>> changes like this.
>>>>>>>> 
>>>>>>>> Adrian Crum
>>>>>>>> Sandglass Software
>>>>>>>> www.sandglass-software.com
>>>>>>>> 
>>>>>>>> On 1/1/2014 7:15 PM, jler...@apache.org wrote:
>>>>>>>>> Author: jleroux
>>>>>>>>> Date: Thu Jan  2 00:15:38 2014
>>>>>>>>> New Revision: 1554706
>>>>>>>>> 
>>>>>>>>> URL: http://svn.apache.org/r1554706
>>>>>>>>> Log:
>>>>>>>>> This is a temporary hack waiting for a better geolocation data model, 
>>>>>>>>> related with OFBIZ-5453
>>>>>>>>> 
>>>>>>>>> Modified:
>>>>>>>>>         
>>>>>>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>>>>>>>>> 
>>>>>>>>> Modified: 
>>>>>>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>>>>>>>>> URL:
>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java?rev=1554706&r1=1554705&r2=1554706&view=diff
>>>>>>>>> ==============================================================================
>>>>>>>>>  ---
>>>>>>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>>>>>>>>>  (original) +++
>>>>>>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
>>>>>>>>>  Thu Jan  2 00:15:38 2014 @@ -144,10
>>>>>>>>>                      +144,17 @@ public final class SetOperation 
>>>>>>>>> extends Debug.logWarning(exc, "Error evaluating scriptlet
>>>>>>>>>                  [" + this.scriptlet + "]: " + exc, module); }
>>>>>>>>>              } else if (!this.fromFma.isEmpty()) {
>>>>>>>>> +            Locale localeTemp = null; // FIXME this is a temporary 
>>>>>>>>> hack waiting for a better geolocation data model,
>>>>>>>>>                  related with OFBIZ-5453 if 
>>>>>>>>> (!this.localeFse.isEmpty() && this.type.length() > 0) {
>>>>>>>>> -                methodContext.setLocale(new 
>>>>>>>>> Locale(this.localeFse.expandString(methodContext.getEnvMap())));
>>>>>>>>> +                localeTemp = methodContext.getLocale();
>>>>>>>>> +                synchronized (this) {
>>>>>>>>> +                    methodContext.setLocale(new 
>>>>>>>>> Locale(this.localeFse.expandString(methodContext.getEnvMap())));
>>>>>>>>> +                    newValue = 
>>>>>>>>> this.fromFma.get(methodContext.getEnvMap());
>>>>>>>>> +                    methodContext.setLocale(localeTemp);
>>>>>>>>> +                }
>>>>>>>>> +            } else {
>>>>>>>>> +                newValue = 
>>>>>>>>> this.fromFma.get(methodContext.getEnvMap());
>>>>>>>>>                  }
>>>>>>>>> -            newValue = this.fromFma.get(methodContext.getEnvMap());
>>>>>>>>>                  if (Debug.verboseOn())
>>>>>>>>>                      Debug.logVerbose("In screen getting value for 
>>>>>>>>> field from [" + this.fromFma.toString() + "]: " +
>>>>>>>>>              newValue, module); } else if (!this.valueFse.isEmpty()) {

Reply via email to