You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by arterzatij <ar...@gmail.com> on 2012/07/04 01:40:54 UTC
BigDecimal on Tapestry pages
Hello,
I am using a property of my entity as BigDecimal to manage prices in my
app.
When filled with data, I provide a number with point as decimal
separator, such as this "12.35". By submitting the information and
displaying the information in the logger, I am getting the following number
"1235", if I try to send a new number with a comma, the validator tells me
that "12.35" is not a number ...
Looking at the API I can not find where to configure the type of decimal
separator ...
My server is configured to recognize the decimal separator.
Spanish as a language.
Any suggestions with this behavior among ... BigDecimal <=> tapestry
--
View this message in context: http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BigDecimal on Tapestry pages
Posted by arterzatij <ar...@gmail.com>.
How the browser gets this locale?
I have my regional configuration, to handle the decimal separator as ".",
when I submit a number with a "," as decimal separator de js tapestry
validator rise me an error, so, how tapestry is telling me that? If tapestry
js validator has a "," like decimal separator.
Any suggestions?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260p5714309.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BigDecimal on Tapestry pages
Posted by Steve Eynon <st...@alienfactory.co.uk>.
> tapestry js are handling decimalSeparator as coma
> So, how I can change this?
That's set from
NumericTranslatorSupportImpl#createJSONDecimalFormatSymbols() which
looks it up from the Locale of the browser.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BigDecimal on Tapestry pages
Posted by ICE Ernesto Arteaga Zavala <ar...@gmail.com>.
2012/7/4 Steve Eynon <st...@alienfactory.co.uk>
> As I'm aware, BigDecimal's are not treated any differently to other
> Java Number objects.
>
> It's the NumericTranslator that handles the conversion, which palms
> most of it's work to NumericTranslatorSupportImpl which sets the
> following JavaScript symbols (your values may be different) which are
> used by the formatLocalizedNumber() JavaScript func in Tapestry.js.
>
> Tapestry.decimalFormatSymbols = {
> "minusSign" : "-",
> "groupingSeparator" : ",",
> "decimalSeparator" : "."
> };
>
>
Looking up above values I found that tapestry js are handling
decimalSeparator as coma
Tapestry.decimalFormatSymbols = { "minusSign" : "-", "groupingSeparator" :
".", "decimalSeparator" : ","};
So, how I can change this?
> I would try using Floats (just for now) to see if they work correctly.
>
> Depending on where you're logging and how you're saving, the problem
> could be with your Database mapping. e.g. By default Hibernate doesn't
> preserve the BigDecimal scale.
>
Right now I'm logging on the Page java class and I'm not saving to database.
>
> Steve.
>
> (Side note: Urgh! BigDecimals are horrid horrid things! But yeah, for
> monetary values there's nothing else to use by default in Java. Sigh.)
>
>
:(
> --
> Steve Eynon
> -------------------------------
> "If at first you don't succeed,
> so much for skydiving!"
>
>
>
> On 4 July 2012 07:40, arterzatij <ar...@gmail.com> wrote:
> > Hello,
> >
> > I am using a property of my entity as BigDecimal to manage prices in
> my
> > app.
> >
> >
> >
> > When filled with data, I provide a number with point as decimal
> > separator, such as this "12.35". By submitting the information and
> > displaying the information in the logger, I am getting the following
> number
> > "1235", if I try to send a new number with a comma, the validator tells
> me
> > that "12.35" is not a number ...
> >
> > Looking at the API I can not find where to configure the type of decimal
> > separator ...
> >
> > My server is configured to recognize the decimal separator.
> > Spanish as a language.
> >
> > Any suggestions with this behavior among ... BigDecimal <=> tapestry
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Saludos,
-------------------------------------------------------------------
"Nada que se consiga sin pena y sin trabajo
es verdaderamente valioso."
Joseph Addison
-------------------------------------------------------------------
ICE Ernesto Arteaga Zavala
Ingeniero de Desarrollo
Re: BigDecimal on Tapestry pages
Posted by ICE Ernesto Arteaga Zavala <ar...@gmail.com>.
I have this on my app module:
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration) {
// Defines english, spanish as supported locales
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,es");
}
when I remove 'es' everything goes fine,
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration) {
// Defines english, spanish as supported locales
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
}
but when I remove 'en' living 'es' the problems are coming...
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration) {
// Defines english, spanish as supported locales
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "es");
}
2012/8/14 Steve Eynon <st...@alienfactory.co.uk>
> In your module class, if you add:
>
> public static void
> contributeApplicationDefaults(MappedConfiguration<String, String>
> config) {
> config.add(SymbolConstants.SUPPORTED_LOCALES, "en");
> }
>
> then T5 should only support English, meaning only full stops should be
> used as decimal separators. See
> org.apache.tapestry5.services.LocalizationSetter for more details.
>
> Steve.
>
> --
> Steve Eynon
> -------------------------------
> "If at first you don't succeed,
> so much for skydiving!"
>
>
>
> On 14 August 2012 06:41, arterzatij <ar...@gmail.com> wrote:
> > Hi,
> >
> > Currently I tested with 'en' locale and it works well, so bigdecimal is
> not
> > the problem. But when I changed to 'es' locale (I live in Mexico), it
> gets
> > the decimal separator as ',' ,on my regional settings of OS and browser
> are
> > configured to handle '.' as decimal separator. Any suggestions?
> >
> > Thanks!
> >
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260p5715370.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Saludos,
-------------------------------------------------------------------
"Nada que se consiga sin pena y sin trabajo
es verdaderamente valioso."
Joseph Addison
-------------------------------------------------------------------
ICE Ernesto Arteaga Zavala
Ingeniero de Desarrollo
Re: BigDecimal on Tapestry pages
Posted by Steve Eynon <st...@alienfactory.co.uk>.
In your module class, if you add:
public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
config) {
config.add(SymbolConstants.SUPPORTED_LOCALES, "en");
}
then T5 should only support English, meaning only full stops should be
used as decimal separators. See
org.apache.tapestry5.services.LocalizationSetter for more details.
Steve.
--
Steve Eynon
-------------------------------
"If at first you don't succeed,
so much for skydiving!"
On 14 August 2012 06:41, arterzatij <ar...@gmail.com> wrote:
> Hi,
>
> Currently I tested with 'en' locale and it works well, so bigdecimal is not
> the problem. But when I changed to 'es' locale (I live in Mexico), it gets
> the decimal separator as ',' ,on my regional settings of OS and browser are
> configured to handle '.' as decimal separator. Any suggestions?
>
> Thanks!
>
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260p5715370.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BigDecimal on Tapestry pages
Posted by arterzatij <ar...@gmail.com>.
Hi,
Currently I tested with 'en' locale and it works well, so bigdecimal is not
the problem. But when I changed to 'es' locale (I live in Mexico), it gets
the decimal separator as ',' ,on my regional settings of OS and browser are
configured to handle '.' as decimal separator. Any suggestions?
Thanks!
--
View this message in context: http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260p5715370.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BigDecimal on Tapestry pages
Posted by Steve Eynon <st...@alienfactory.co.uk>.
As I'm aware, BigDecimal's are not treated any differently to other
Java Number objects.
It's the NumericTranslator that handles the conversion, which palms
most of it's work to NumericTranslatorSupportImpl which sets the
following JavaScript symbols (your values may be different) which are
used by the formatLocalizedNumber() JavaScript func in Tapestry.js.
Tapestry.decimalFormatSymbols = {
"minusSign" : "-",
"groupingSeparator" : ",",
"decimalSeparator" : "."
};
I would try using Floats (just for now) to see if they work correctly.
Depending on where you're logging and how you're saving, the problem
could be with your Database mapping. e.g. By default Hibernate doesn't
preserve the BigDecimal scale.
Steve.
(Side note: Urgh! BigDecimals are horrid horrid things! But yeah, for
monetary values there's nothing else to use by default in Java. Sigh.)
--
Steve Eynon
-------------------------------
"If at first you don't succeed,
so much for skydiving!"
On 4 July 2012 07:40, arterzatij <ar...@gmail.com> wrote:
> Hello,
>
> I am using a property of my entity as BigDecimal to manage prices in my
> app.
>
>
>
> When filled with data, I provide a number with point as decimal
> separator, such as this "12.35". By submitting the information and
> displaying the information in the logger, I am getting the following number
> "1235", if I try to send a new number with a comma, the validator tells me
> that "12.35" is not a number ...
>
> Looking at the API I can not find where to configure the type of decimal
> separator ...
>
> My server is configured to recognize the decimal separator.
> Spanish as a language.
>
> Any suggestions with this behavior among ... BigDecimal <=> tapestry
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/BigDecimal-on-Tapestry-pages-tp5714260.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org