incubator-adffaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: tr:convertNumber, type="currency", and BigDecimal
Date Mon, 18 Dec 2006 19:28:49 GMT
Well, I can't speak for the trinidad version of the component, but all
of this needs to be taken care of during conversion, and the default
f:convertNumber component only converts to Long or Double, not any
other type.

That's why we created a tomahawk:convertNumber component that was more flexible.


On 12/18/06, David Brunette <David.Brunette@chordiant.com> wrote:
>
>      Thanks for the reply.
>
>      Unless I'm mistaken, the piece of code that I am looking to update
> is called AFTER all the conversion is done.  I am simply trying to take
> the already converted value and allow it to be put into a target with
> type BigDecimal.  Hopefully all of the stuff that you have mentioned is
> already taken care of by the NumberConverter class.
>
> Dave
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> Sent: Monday, December 18, 2006 11:09 AM
> To: adffaces-dev@incubator.apache.org
> Subject: Re: tr:convertNumber, type="currency", and BigDecimal
>
> There are a couple of issues with a currency/bigdecimal converter.
>
> - You have to strip out (or add in -- I can't remember) the currency
> symbol before parsing the currency value
>
> - You have to handle a parsing bug in DecimalFormat
>
> You can find code to do both of these things here:
>
> http://issues.apache.org/jira/browse/TOMAHAWK-610
>
> You might also want to take a look at the Tomahawk sandbox
> convertNumber converter.   It doesn't yet include the two bug fixes
> above, but it provides a generic solution for converting numbers
> rather than a specific currency/BigDecimal converter.
>
> http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/mai
> n/java/org/apache/myfaces/custom/convertNumber/TypedNumberConverter.java
> ?view=markup
>
>
>
> On 12/18/06, Matthias Wessendorf <matzew@apache.org> wrote:
> > I think bigdecimal should work, since it is not uncommon
> > to use that type for currency values...
> >
> > -M
> >
> > On 12/14/06, David Brunette <David.Brunette@chordiant.com> wrote:
> > >
> > >
> > >      Hi everybody.
> > >
> > >
> > >
> > >      I am having a problem with using a <tr:convertNumber /> in my
> app
> > > for submitting currency values from an inputText (see the example
> > > below).  I have tracked the problem down to the fact the value is
> bound
> > > to a BigDecimal in my bean.  If I change the type to be Double, this
> all
> > > works fine... but the trouble is that I have to use BigDecimal in my
> > > bean, so simply changing the type is not an option for me.
> > >
> > >
> > >
> > >      I've dug into the Trinidad code and updated the BaseConverter
> class
> > > to successfully use <tr:convertNumber /> with a BigDecimal value.
> But
> > > before I create a bug and submit a patch, I would like to know if
> there
> > > is any reason in particular that BigDecimal does not seem to be
> > > supported.  Was it just missed, or was it left out for a specific
> > > reason?
> > >
> > >
> > >
> > >      Thanks...
> > >
> > >
> > >
> > > Dave
> > >
> > >
> > >
> > > <tr:inputText id="txt_monthly_income"
> > >
> > >               value="#{myBean.monthlyIncome}"
> > >
> > >               label="Monthly Income">
> > >
> > >       <tr:convertNumber pattern="#.00" type="currency"
> > > currencyCode="USD"/>
> > >
> > > </tr:inputText>
> > >
> > > The information transmitted herewith is sensitive      information
> of Chordiant Software or its customers and is intended only for use to
> the individual or entity to which it is addressed. If the reader of this
> message is not the intended recipient, you are hereby notified that any
> review, retransmission, dissemination, distribution, copying or other
> use of, or taking of any action in reliance upon, this information is
> strictly prohibited. If you have received this communication in error,
> please contact the sender and delete the material from your computer.
> > >
> > >
> >
> >
> > --
> > Matthias Wessendorf
> > http://tinyurl.com/fmywh
> >
> > further stuff:
> > blog: http://jroller.com/page/mwessendorf
> > mail: mwessendorf-at-gmail-dot-com
> >
> The information transmitted herewith is sensitive      information of Chordiant Software
or its customers and is intended only for use to the individual or entity to which it is addressed.
If the reader of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other use of, or taking
of any action in reliance upon, this information is strictly prohibited. If you have received
this communication in error, please contact the sender and delete the material from your computer.
>

Mime
View raw message