cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: [flowscript] How to set an integer value in the FlowScript?
Date Fri, 30 Jan 2004 02:52:31 GMT
JS Number  is a double according to the specification. ScriptableWidget 
provides coercions that allow you to write:

  offset.value = 0;

See the sample I recently committed.

Regards,
Chris

Joerg Heinicke wrote:

> On 28.01.2004 18:21, Carlos Chávez wrote:
>
>>  i am think this is related with the datatype of Woody and Java
>>  the datatype in woody integer is converter in java.lang.Integer
>>  and the datatype in woody decimal is converter in java.math.BigDecimal
>
>
> IMO it's a problem of the FlowScript implementation/Rhino or what 
> exactly, that defaults to Double for numbers. Can't this be handled 
> more automatically by the FlowScript when calling Java? Christopher?
>
>>   Try this :
>>
>>          offsetWidget.value = new java.lang.Integer(0);
>
>
> Thank you very much, this works like a charm :)
>
>>> Now I tried to access the error on the other end by changing the Woody
>>> definition and binding. As there is no double datatype I tried float 
>>> with
>>> the
>>> following result:
>>> "Tried to set value of output widget "repeater.offset" with an 
>>> object of
>>> an
>>> incorrect type: expected class java.lang.Float, received class
>>> java.math.BigDecimal."
>>> That was not what I expected! Also this error occurs on binding load 
>>> time,
>>> not
>>> when I set the value. Is this a bug??
>>
>
> My concern above was another one as no "decimal" was involved. I set 
> the datatype and the convertor to "float" and the binding had a 
> problem with it (no FlowScript "widget.value = 0" involved!). If I 
> remember correctly the binding was to an XML file and the element with 
> its value was <offset>10</offset>.
>
> Ok, instead of asking for further help on the last issue I had a look 
> into the convertors myself - they are nicely short :) And I guess I 
> found the reason for this problem: The PlainFloatConvertor returned a 
> BigDecimal object - I guess just a copy & paste problem. I will commit 
> it now. Please confirm my observation.
>
> Joerg
>


Mime
View raw message