Re: Issue regarding NumberFormat

2014-12-29 Thread Ignacio Baca Moreno-Torres
The dot (.) inside the pattern is a token that represent the 'decimal 
separator', and the decimal separator for fr is a comma (,). 
https://github.com/gwtproject/gwt/blob/master/user/src/com/google/gwt/i18n/client/constants/NumberConstantsImpl_fr.properties

On Monday, December 29, 2014 10:24:34 AM UTC+1, Gaurav Mourya wrote:
>
> Hi All,
>
> I am using GWT 2.5.1 and I have an issue regarding “NumberFormat” supports 
> for multiple language.
>
> Please refer the following below URL : -  
> http://samples.gwtproject.org/samples/Showcase/Showcase.html?locale=en_GB#!CwNumberFormat
>
> As per required pattern I’ll be not getting value.
>
> For example at top right side you will get drop down, which are having 
> multiple languages.  
>
> Select “British English” (en) and you may see the below. It’s formatting 
> the value in defined pattern.
>
> But if you select the “France” (fr) locale. Then it won’t displaying 
> properly formatted value, the dot (.) is replaced with comma (,).
>  Please let me know if you have any solution.
>
>
>
> Thanks & Regards,
> Gaurav Mourya
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Issue regarding NumberFormat

2014-12-29 Thread Gaurav Mourya


Hi All,

I am using GWT 2.5.1 and I have an issue regarding “NumberFormat” supports 
for multiple language.

Please refer the following below URL : -  
http://samples.gwtproject.org/samples/Showcase/Showcase.html?locale=en_GB#!CwNumberFormat

As per required pattern I’ll be not getting value.

For example at top right side you will get drop down, which are having 
multiple languages.  

Select “British English” (en) and you may see the below. It’s formatting 
the value in defined pattern.

But if you select the “France” (fr) locale. Then it won’t displaying 
properly formatted value, the dot (.) is replaced with comma (,).
 Please let me know if you have any solution.



Thanks & Regards,
Gaurav Mourya

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


NumberFormat

2013-05-20 Thread Muhammed Abdul Salim
Hai,

 I have a doubt regarding currency format in GWT.I am using gwt2.5 and
tried formatting my value to Indian currency format using "il8n
NumberFormat" by setting "Locale = en_IN" in gwt.xml. when i execute my
code result was Rs. 10,000,000.00 instead of  Rs 10,00,00,000.00 .Please
help to clear this issue.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: NumberFormat output wrong?

2013-04-22 Thread Philippe Lhoste

On 16/04/2013 18:43, Thad wrote:

NumberFormat has not worked the way I expected
(see 
https://groups.google.com/d/msg/google-web-toolkit/zlbRIhTKqrA/cyjaDB12K6UJ for 
an
experience with devmode vs production).

On Monday, April 15, 2013 3:29:30 PM UTC-4, Patrick Tucker wrote:

Today I noticed that the output of my NumberFormat (GWT 2.5.0) is not what 
I thought
it had been set to.  So I played with it a little and found the output to 
be inconsistent.
The formats:

1: NumberFormat.getFormat("#,###.##")
2: NumberFormat.getFormat("#,###.00")
3: NumberFormat.getFormat("#,##0.00")

The output is as follows:

1: 3.57, 0.98, 0.6
2: 3.57, .98, .60
3: 3.57, 0.98, 0.60

  The NumberFormat class doc states the following:

0 Number Yes Digit
# Number Yes Digit, zero shows as absent

According to the doc comments, show above, I was expect the following 
output for each
format:

1: 3.57, .98, .6
2: 3.57, .98, .60
3: 3.57, 0.98, 0.60

  What going on here?  The output for 1 should not have the leading 0, just 
like the
2nd format.


The "zero shows as absent" indication is terse and vague... We can suppose it is about 
"non-significant zeroes", but it is better if explicitly stated!


Just note that Java's DecimalFormat just acts the same:

DecimalFormat[] nfs =
{
new DecimalFormat("#,###.##"),
new DecimalFormat("#,###.00"),
new DecimalFormat("#,##0.00")
};
double[] vals = { 3.57, 0.98, 0.6 };
for (DecimalFormat nf : nfs)
  for (double v : vals)
System.out.println(nf.format(v));

==>

3,57
0,98
0,6
3,57
,98
,60
3,57
0,98
0,60

(French locale!)
I am not sure how to interpret that when reading the JavaDoc...

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --

--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: NumberFormat output wrong?

2013-04-16 Thread Thad
NumberFormat has not worked the way I expected 
(see 
https://groups.google.com/d/msg/google-web-toolkit/zlbRIhTKqrA/cyjaDB12K6UJ 
for an experience with devmode vs production).

On Monday, April 15, 2013 3:29:30 PM UTC-4, Patrick Tucker wrote:
>
> Today I noticed that the output of my NumberFormat (GWT 2.5.0) is not what 
> I thought it had been set to.  So I played with it a little and found the 
> output to be inconsistent.
>  
> The formats:
>
> 1: NumberFormat.getFormat("#,###.##")
> 2: NumberFormat.getFormat("#,###.00")
> 3: NumberFormat.getFormat("#,##0.00")
>
>  
> The output is as follows:
>
> 1: 3.57, 0.98, 0.6
> 2: 3.57, .98, .60
> 3: 3.57, 0.98, 0.60
>
>  The NumberFormat class doc states the following:
>
> 0 Number Yes Digit 
> # Number Yes Digit, zero shows as absent 
>
> According to the doc comments, show above, I was expect the following 
> output for each format:
>
> 1: 3.57, .98, .6
> 2: 3.57, .98, .60
> 3: 3.57, 0.98, 0.60
>
>  
>  What going on here?  The output for 1 should not have the leading 0, just 
> like the 2nd format.
>  
> Thanks,
> Pat
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




NumberFormat output wrong?

2013-04-15 Thread Patrick Tucker
Today I noticed that the output of my NumberFormat (GWT 2.5.0) is not what 
I thought it had been set to.  So I played with it a little and found the 
output to be inconsistent.
 
The formats:

1: NumberFormat.getFormat("#,###.##")
2: NumberFormat.getFormat("#,###.00")
3: NumberFormat.getFormat("#,##0.00")

 
The output is as follows:

1: 3.57, 0.98, 0.6
2: 3.57, .98, .60
3: 3.57, 0.98, 0.60

 The NumberFormat class doc states the following:

0 Number Yes Digit 
# Number Yes Digit, zero shows as absent 

According to the doc comments, show above, I was expect the following 
output for each format:

1: 3.57, .98, .6
2: 3.57, .98, .60
3: 3.57, 0.98, 0.60

 
 What going on here?  The output for 1 should not have the leading 0, just 
like the 2nd format.
 
Thanks,
Pat

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




NumberFormat and Internationalization Messages

2012-11-22 Thread Thad
I'm am unable to get com.google.gwt.i18n.client.Messages for format a float 
in production.

My DefaultMessage looks like "{0,float,#.0}\"". In DevMode, my number has 
one digit after the decimal, e.g., 8.8" or 11.6"

In production--now Javascript vs Java--the number has *many* digits after 
the decimal, e.g., 8.80190734863" or 11.60381469726"
This is true in IE and Chrome (I've not tested Firefox and Safari).

Am I wrong thinking that this formatting should work like 
java.text.NumberFormat?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/cyjaDB12K6UJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to use NumberFormat to set maximum number of integer digit

2012-06-30 Thread Bakul
Simply split it by dot. Take last 3 chars of first string, use formatting for 
second. And join again by dot

-Bakul

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/jo7O_wFoSZ0J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to use NumberFormat to set maximum number of integer digit

2012-06-30 Thread Joseph Lust

>
> that means format a 1234.567 will get 234.58. 
>

Why would you ever want to do that? Now you users don't know if you are 
displaying 234 or 1234 of 1000234. Your trouble might be coming from this 
unusual formatting you are attempting. Most number formatting functions 
won't do this because it does not make sense. They focus on truncation and 
rounding of the decimals which simply reduce the LSB's, not the MSB's.

If you must do this, just write your own function to truncate the higher 
magnitude values.


Sincerely,
Joseph 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/77QmVzK0bZcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



How to use NumberFormat to set maximum number of integer digit

2012-06-29 Thread Mao Qin
Hi everyone, 

There is one topic about how-to use NumberFormat to set minimum number of 
integer digit.
But now I come across one problem, I only wanna keep the decimal format 
looking like "000.00", three integer and two number after decimal point. 
that means format a 1234.567 will get 234.58.
how to use NumberFormat to set maximum number of integer digit. Since 
java.text.NumberFormat is very convenient to do this job.
By contrast, com.google.gwt.client.i18n.NumberFormat is seemed as it could 
not perform this function.
should I need to write a function to implement it or maybe use a special 
pattern?
Do someone have any suggestions?
Thanks!

Best Regards!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/axcUroN5BS8J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat custom grouping separator

2012-01-02 Thread tanteanni
(Happy New Year!)

I need to change grouping separator (, in US . in DE) to Space (' ') for 
all Locales how to achieve that?

thx in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/9LaKQwI6roUJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat currency pattern issues (wrong positiveSuffix and possible encoding issues)

2011-12-16 Thread Tiago
Well, "$10" or "10 USD" should clearly be invalid strings for an euro
locale.
I wouldn't mind "10 EUR" being invalid for the default format too
since using currency codes is quite specific. Actually, all these
could be configurable parameters (requiring, ignoring or refusing
currency symbols and/or currency codes). What I don't find correct is
to always require a " €".. the user can't even type a  ...

Not being able to use NumberFormat to parse currency values would be a
pity. I would expect to be able to use the same format both ways
(formatting and parsing). And well, if this choice is made "by
design", shouldn't it be documented? The exception "X does not have
either positive or negative affixes" doesn't have anything to do with
the actual issue. " €" is not a "positiveSuffix".

Thanks

On Dec 16, 9:41 am, Thomas Broyer  wrote:
> Not sure this is a bug, maybe by-design (i.e. don't use the currency format
> for parsing).
> If you want to parse a number, don't use a currency format.
> If you expect the user to (optionally) type in the currency symbol, you'd
> better pre-process the value (what if the user types "$10" in a € locale?
> how about "10 USD" or "10 EUR"?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat currency pattern issues (wrong positiveSuffix and possible encoding issues)

2011-12-16 Thread Thomas Broyer
Not sure this is a bug, maybe by-design (i.e. don't use the currency format 
for parsing).
If you want to parse a number, don't use a currency format.
If you expect the user to (optionally) type in the currency symbol, you'd 
better pre-process the value (what if the user types "$10" in a € locale? 
how about "10 USD" or "10 EUR"?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/3QfYlrQhipMJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat currency pattern issues (wrong positiveSuffix and possible encoding issues)

2011-12-15 Thread Tiago
Thank you Thomas for the clarification.

Do you agree though that there's a bug on NumberFormat? It should not
require " €" to be in the end of a string it parses, although it
may add it to the end of a string it formats. Right?

On Dec 15, 2:40 pm, Thomas Broyer  wrote:
> -62, -96, or in hexadecimal C2,A0 is the encoding (in UTF-8) of a
> non-breaking space (U+00A0, widely known on the web as  ) It's a
> distinct Unicode character than a space (U+0020, encoded in UTF-8 as 32);
> it's not an encoding issue (btw, all strings in JavaScript are in UCS-2,
> just like in Java)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat currency pattern issues (wrong positiveSuffix and possible encoding issues)

2011-12-15 Thread Thomas Broyer
-62, -96, or in hexadecimal C2,A0 is the encoding (in UTF-8) of a 
non-breaking space (U+00A0, widely known on the web as  ) It's a 
distinct Unicode character than a space (U+0020, encoded in UTF-8 as 32); 
it's not an encoding issue (btw, all strings in JavaScript are in UCS-2, 
just like in Java)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/gRdn0UzoZjEJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat currency pattern issues (wrong positiveSuffix and possible encoding issues)

2011-12-15 Thread Tiago Rinck Caveden
Hello,

I'm having some weird issues with NumberFormat. I'm using it with the
currency pattern, which for my locale is the euro.

The first problem I've notice is that the parser is treating the string "
€" as a "positiveSuffix". And if such string is not at the end of the
string being parsed, the error "X does not have either positive or negative
affixes" is raised. And well, it's normal that such suffix is not there,
people won't manually type a space plus the euro symbol. It's ok if such
string is added by the format method but it should not be required by the
parser.

I guess that's pretty much a bug for NumberFormat, right?

And well, that's not all. After trying to work around this by manually
adding the " €" to the end of my numbers, it still raised the same
exception. So I decide to debug it, and I saw that, in spite of the correct
string being there, the endsWith method was returning false. I just
couldn't understand, until I decide to add a watch expression requesting
the getBytes() of each string. And what was my surprise when I saw that the
blank space character had different bytes in each string being compared! In
the "positiveSuffix" variable of NumberFormat, the space character was
represented by two bytes, while in my input string, it was only the byte
32. Actually, it seems my input string was using an 8 bit encoding, since
only the euro symbol used more than one byte.

These are the strings and their bytes:
The input:  "10 €"  =>  [49, 48, 32, -30, -126, -84]
The positiveSuffix:  " €"  =>  [-62, -96, -30, -126, -84]

As you see, it seems blank space in the input is 32 while in the
positiveSuffix it is [-62, -96].

I'm guessing javascript doesn't give the same guarantee that Java does,
that is, that every in memory string uses the same encoding. But, if that's
the case, shouldn't GWT try to assure always the same encoding is being
used? Because, otherwise, how should we do? I know that we can set encoding
for Writers and Readers in Java but for in memory strings, how can we make
sure we're always using the same encoding?

Thank you,
-- 
Tiago Rinck Caveden

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat format with all available decimal digits

2011-08-29 Thread Raziel
Hi, I would like to be able to call the NumberFormat format method
with a Double and get in the string all the digits available in the
Double value.

It seems to me that you have to forcefully specify in the patter one
digit per decimal you want to display (i.e. "#.#" for 5 decimal
digits, "#.##" for 2, "#.###" for 7, etc.), or otherwise the
format method would round it up.

Is there any way or pattern where I can specify the formatter to "show
all available decimals in the passed double value"? Something like
"#.#*"

Any help will be greatly appreciated.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat and German Locale

2011-07-12 Thread tdk
ok, thanks everyone who contribute.

My conclusion is quite simple: since I only have a localized pattern,
I won't be able to use that and format the numbers acc. to it.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Aw: Re: NumberFormat and German Locale

2011-07-12 Thread Jens
NumberFormat.getDecimalFormat() just gives you a formatter using a default 
format string. If you want to use your own formatting string you have to use 
NumberFormat.getFormat(). In your case you have to use 
NumberFormat.getFormat("#,##0.0##"). The symbols "," and "." are special 
symbols used by the NumberFormat class for grouping and as decimal 
separator. You always have to use these symbols like they are defined in the 
JavaDoc for NumberFormat regardless of the target locale you want to use. 
The target locale is then responsible for changing "," and "." into the 
correct localized versions. For de_DE that would be "." for grouping 
(instead of the defined ",") and "," as decimal separator (instead of the 
defined ".").


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/FkaVLeJKYbwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat and German Locale

2011-07-12 Thread tdk


On 12 Jul., 10:26, Thomas Broyer  wrote:
> You're confusing the syntax of the pattern you give to NumberFormat for
> parsing, and then the use of that NumberFormat within the context of a
> locale.
> What you *give* to NumberFormat is locale-insensitive: #,##0.0##
> When you have that NumberFormat instance, what it does then depends on the
> current locale: when you format 1234.56 in the de_DE locale, you'll see (if
> I'm not mistaken) 1.234,56, in the fr_FR locale it'll be 1 234,56 and in the
> en_US locale it'll be 1,234.56.
ok, I think I understand what you are saying. But it's still a mystery
to me, how to tell the localized NumberFormat, e.g.
NumberFormat.getDecimalFormat(), to use ths user supplied pattern, eg
setting a certain precision, leading/trailing zeros, and such like.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat and German Locale

2011-07-12 Thread Thomas Broyer
You're confusing the syntax of the pattern you give to NumberFormat for 
parsing, and then the use of that NumberFormat within the context of a 
locale.
What you *give* to NumberFormat is locale-insensitive: #,##0.0##
When you have that NumberFormat instance, what it does then depends on the 
current locale: when you format 1234.56 in the de_DE locale, you'll see (if 
I'm not mistaken) 1.234,56, in the fr_FR locale it'll be 1 234,56 and in the 
en_US locale it'll be 1,234.56.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/1QXbOz75nHAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat and German Locale

2011-07-11 Thread tdk
Tom, Rob,

thanx for this valuable information. That default is not "default" is
quite interesting, I wasn't aware of that.
But then the question is, how do I change the NumberFormat so that it
uses the set locale, eg de_DE, instead of "default"? I have not been
able to find/understand a way to do that. Maybe you can help me with
that...

The problem I have is that I can't use a fixed locale because my users
can change the language/locale on the fly. With the help of this and
other forums I found the way how to do that by reloading the app with
an "locale=de_DE" appended to the original URL. Not very nice and
elegant but it seems to be the only way. And as I mentioned in my OP
it actually works as far as the messages from GWT are concerned.

But what about NumberFormat (and DateFormat for that matter), how can
I change the default locale?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat and German Locale

2011-07-11 Thread Thomas Broyer
In a pattern, a dot is always the decimal separator and a comma always 
represents the thousands separator. When you render a number using the 
pattern, those separators might appear differently depending on the locale 
(e.g. the decimal separator being a comma and the thousands separator being 
a dot).

As Rob said, the default locale is not the "locale used by default", it's 
the locale called 'default' (Java would call it the 
ROOTlocale,
 and many systems call it 'C'; it is 
*not* 'en' though, even though it looks a lot like it).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/-4XCY1-fqUQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat and German Locale

2011-07-11 Thread Rob Coops
Default locale is actually default, not necessarily the local set.

I don't have access to my code at the moment so I'll have to do this from
the top of my head and without actually working code... but I'll give it a
try.

When a new user accesses the app I check the locale, to see what this is set
to, "default" or something else, if it is set to default then I force it to
the locale inferred by the user's IP address, if I have this local available
otherwise I set it to English.
There is such a thing as default in the list of locale's which usually is
_EN as far as I know.

I think what you are seeing is that the "default" locale you are using is
actually default (_EN) thus the number format is most likely set to
#,##0.0## instead of the #.##0,0## you are trying to use. I would suggest
simply telling the number formatter to use the _DE format (or simply the
same as the locale is set for for the user ;-)

Sorry for the lack of code, that the explanation is clear enough without it.

Regards,

Rob


On Mon, Jul 11, 2011 at 10:06 AM, tdk  wrote:

> I have severe problems, understanding and using
> com.google.gwt.i18n.client.Numberformat, hoping somebody out there can
> help and enlighten me.
>
> When I try to get a formatter via NumberFormat.getFormat(pattern) I
> get an InvalidPatternException even so my pattern is valid within the
> german locale, eg #.##0,0##.
> I know that the locale is set correctly and used by my app, because
> all the default texts, eg when loading data, show up in german.
>
> The documentation (and posts in various forms) say, that NumberFormat
> uses the default locale to get a formatter, with a specific pattern,
> which I assume in my case is de_DE, because it is set to this. So what
> am I doing wrong, am I missing?
>
> I'm using GWT 2.3
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat and German Locale

2011-07-11 Thread tdk
I have severe problems, understanding and using
com.google.gwt.i18n.client.Numberformat, hoping somebody out there can
help and enlighten me.

When I try to get a formatter via NumberFormat.getFormat(pattern) I
get an InvalidPatternException even so my pattern is valid within the
german locale, eg #.##0,0##.
I know that the locale is set correctly and used by my app, because
all the default texts, eg when loading data, show up in german.

The documentation (and posts in various forms) say, that NumberFormat
uses the default locale to get a formatter, with a specific pattern,
which I assume in my case is de_DE, because it is set to this. So what
am I doing wrong, am I missing?

I'm using GWT 2.3

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat not formatting single-digit numbers

2011-04-13 Thread Kyle
Hi!

I'm working on an enterprise GWT/GXT application and we've recently
noticed that our currency fields are not correctly formatting single-
digit inputs.

We're using java.math.BigDecimal to represent the internal values, and
using NumberFormat.getFormat("$#,##0.00; ($#,##0.00)") for our format
setting.

What happens is when the user enters a value in a field (which has a
correctly-formatted default value of $0.00) and hits tab to exit the
field, the format only applies to entries that are 10 or larger.  If
they enter a single-digit value, it won't be formatted.  They can work
around this by first entering a number 10 or larger, tabbing out, then
going back and changing it to a single digit value, and tabbing out
again, at which point the formatting correctly applies.

To further complicate matters, this only occurs on the actual server;
the formatter works perfectly fine in local hosted mode.  This occurs
in both IE8 and Firefox 3.

We're running GWT 2.1.1.


Thanks for your time!
/Kyle

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



fixed-width numbers with NumberFormat

2010-11-14 Thread decitrig
I know I can pad a number with zeros, is there a way to pad them with
blanks? There are a couple of rules in the EBNF that seem to point
this way:

number  :=  (integer ('.' fraction)?) | sigDigits
sigDigits   :=  '#'* '@''@'* '#'*
padSpec :=  '*' padChar
padChar :=  '\u'..'\uFFFD' - quote

sigDigits, padSpec and padChar don't seem to be referenced anywhere in
the docs, and I've played around with asterixes and at-signs in the
argument for getFormat without any luck.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Currency Symbol in NumberFormat

2010-10-26 Thread Jim Douglas
Click this link:

http://gwt.google.com/samples/Showcase/Showcase.html#!CwNumberFormat

Look for the ListBox in the top right corner of that page.  Select
"English - India" from that list.

The page changes to:

http://gwt.google.com/samples/Showcase/Showcase.html?locale=en_IN#!CwNumberFormat

Note this addition to the URL, indicating that the locale is now
English - India:

?locale=en_IN

Now select "Currency" from the Pattern list.

It now reports that the formatted currency value is rupees (Rs):

Rs 31,415,926,535.90

I see that this will eventually be changing to a brand new symbol
encoded as U+20B9 in Unicode 6.0:

http://en.wikipedia.org/wiki/Indian_rupee_sign
http://www.fileformat.info/info/unicode/char/20b9/browsertest.htm

For one final test, select "Custom" from the Pattern list, then copy
and paste this text into the text box below that list:

¤ #,##,##0

Change "Value to format" to 42.

It now reports that the formatted value is:

Rs 42

On Oct 26, 9:28 pm, PARAG  wrote:
> Hi Jim,
>
> Thanks for looking into it. But still I have a problem, when in the
> custom format I use just ¤ then in the output I am getting ? and when
> I use ¤ then I get US$. Note that I do have UTF-8 encoding in the
> browser.
>
> On Oct 27, 1:23 am, Chris Conroy  wrote:
>
>
>
> > Jim,
>
> > Thanks for pointing out this problem. jat has just committed a 
> > fix:http://code.google.com/p/google-web-toolkit/source/detail?r=9150
>
> > On Tue, Oct 26, 2010 at 3:47 AM, Jim Douglas  wrote:
> > > I think you're getting thrown by a small character encoding error on
> > > that documentation page:
>
> > >http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/g...
>
> > > The page will display correctly if you force it to display in UTF-8.
> > > To do that, select something like View->Encoding->Unicode (UTF-8) from
> > > your browser menu.
>
> > > The pattern character is exactly what you expect it to be.  To see a
> > > live sample, go here and select the Currency pattern from the list:
>
> > >http://gwt.google.com/samples/Showcase/Showcase.html#!CwNumberFormat
>
> > > On Oct 25, 11:51 pm, PARAG  wrote:
> > > > Hi,
>
> > > > I want to use custom number format which may contain currency symbol
> > > > for perticular locale. I found that with the
> > > > com.google.gwt.i18n.client.NumberFormat class we can achieve this but
> > > > the symbol for the currency is ¤ instead of ¤ in java. Note that the
> > > > unicode used is same as that of the java (\u00A4). Any idea about
> > > > this?
>
> > > > Thank you.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Web Toolkit" group.
> > > To post to this group, send email to google-web-tool...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-web-toolkit+unsubscr...@googlegroups.com > >  cr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Currency Symbol in NumberFormat

2010-10-26 Thread PARAG
Hi Jim,

Thanks for looking into it. But still I have a problem, when in the
custom format I use just ¤ then in the output I am getting ? and when
I use ¤ then I get US$. Note that I do have UTF-8 encoding in the
browser.

On Oct 27, 1:23 am, Chris Conroy  wrote:
> Jim,
>
> Thanks for pointing out this problem. jat has just committed a 
> fix:http://code.google.com/p/google-web-toolkit/source/detail?r=9150
>
> On Tue, Oct 26, 2010 at 3:47 AM, Jim Douglas  wrote:
> > I think you're getting thrown by a small character encoding error on
> > that documentation page:
>
> >http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/g...
>
> > The page will display correctly if you force it to display in UTF-8.
> > To do that, select something like View->Encoding->Unicode (UTF-8) from
> > your browser menu.
>
> > The pattern character is exactly what you expect it to be.  To see a
> > live sample, go here and select the Currency pattern from the list:
>
> >http://gwt.google.com/samples/Showcase/Showcase.html#!CwNumberFormat
>
> > On Oct 25, 11:51 pm, PARAG  wrote:
> > > Hi,
>
> > > I want to use custom number format which may contain currency symbol
> > > for perticular locale. I found that with the
> > > com.google.gwt.i18n.client.NumberFormat class we can achieve this but
> > > the symbol for the currency is ¤ instead of ¤ in java. Note that the
> > > unicode used is same as that of the java (\u00A4). Any idea about
> > > this?
>
> > > Thank you.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Currency Symbol in NumberFormat

2010-10-26 Thread Chris Conroy
Jim,

Thanks for pointing out this problem. jat has just committed a fix:
http://code.google.com/p/google-web-toolkit/source/detail?r=9150

On Tue, Oct 26, 2010 at 3:47 AM, Jim Douglas  wrote:

> I think you're getting thrown by a small character encoding error on
> that documentation page:
>
>
> http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/i18n/client/NumberFormat.html
>
> The page will display correctly if you force it to display in UTF-8.
> To do that, select something like View->Encoding->Unicode (UTF-8) from
> your browser menu.
>
> The pattern character is exactly what you expect it to be.  To see a
> live sample, go here and select the Currency pattern from the list:
>
> http://gwt.google.com/samples/Showcase/Showcase.html#!CwNumberFormat
>
> On Oct 25, 11:51 pm, PARAG  wrote:
> > Hi,
> >
> > I want to use custom number format which may contain currency symbol
> > for perticular locale. I found that with the
> > com.google.gwt.i18n.client.NumberFormat class we can achieve this but
> > the symbol for the currency is ¤ instead of ¤ in java. Note that the
> > unicode used is same as that of the java (\u00A4). Any idea about
> > this?
> >
> > Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Currency Symbol in NumberFormat

2010-10-26 Thread Jim Douglas
I think you're getting thrown by a small character encoding error on
that documentation page:

http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/i18n/client/NumberFormat.html

The page will display correctly if you force it to display in UTF-8.
To do that, select something like View->Encoding->Unicode (UTF-8) from
your browser menu.

The pattern character is exactly what you expect it to be.  To see a
live sample, go here and select the Currency pattern from the list:

http://gwt.google.com/samples/Showcase/Showcase.html#!CwNumberFormat

On Oct 25, 11:51 pm, PARAG  wrote:
> Hi,
>
> I want to use custom number format which may contain currency symbol
> for perticular locale. I found that with the
> com.google.gwt.i18n.client.NumberFormat class we can achieve this but
> the symbol for the currency is ¤ instead of ¤ in java. Note that the
> unicode used is same as that of the java (\u00A4). Any idea about
> this?
>
> Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Currency Symbol in NumberFormat

2010-10-25 Thread PARAG
Hi,

I want to use custom number format which may contain currency symbol
for perticular locale. I found that with the
com.google.gwt.i18n.client.NumberFormat class we can achieve this but
the symbol for the currency is ¤ instead of ¤ in java. Note that the
unicode used is same as that of the java (\u00A4). Any idea about
this?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat on integer

2010-08-17 Thread Patrick Tucker
Me too but I wanted to make sure it wasn't already part of GWT before
submitting a request.

Thanks,
Pat

On Jul 7, 1:59 pm, Isaac Truett  wrote:
> I know that patches are always
> welcome<http://code.google.com/webtoolkit/makinggwtbetter.html>
> .
>
>
>
> On Wed, Jul 7, 2010 at 1:36 PM, Patrick Tucker  wrote:
> > Nobody knows??
>
> > On Jun 23, 10:28 am, Patrick Tucker  wrote:
> > > Why does GWT not have a getIntegerInstance() in NumberFormat??
>
> > > It seems simple enough to implement and it is part of java...
>
> > > Is it implemented somewhere else?
>
> > > Thanks,
> > > Pat
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat on integer

2010-07-07 Thread Isaac Truett
I know that patches are always
welcome<http://code.google.com/webtoolkit/makinggwtbetter.html>
.


On Wed, Jul 7, 2010 at 1:36 PM, Patrick Tucker  wrote:

> Nobody knows??
>
> On Jun 23, 10:28 am, Patrick Tucker  wrote:
> > Why does GWT not have a getIntegerInstance() in NumberFormat??
> >
> > It seems simple enough to implement and it is part of java...
> >
> > Is it implemented somewhere else?
> >
> > Thanks,
> > Pat
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat on integer

2010-07-07 Thread Patrick Tucker
Nobody knows??

On Jun 23, 10:28 am, Patrick Tucker  wrote:
> Why does GWT not have a getIntegerInstance() in NumberFormat??
>
> It seems simple enough to implement and it is part of java...
>
> Is it implemented somewhere else?
>
> Thanks,
> Pat

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat on integer

2010-06-23 Thread Patrick Tucker
Why does GWT not have a getIntegerInstance() in NumberFormat??

It seems simple enough to implement and it is part of java...

Is it implemented somewhere else?

Thanks,
Pat

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: [Javascript Error] NumberFormat

2010-04-02 Thread Gourab Panda
Hi,

The below code works for me

 NumberFormat threeDForm = NumberFormat.getFormat("#.###");

Thanks and Regards
Gourab.

On Thu, Mar 25, 2010 at 3:02 PM, StrongSteve  wrote:

> Hello,
>
> I experience the following - from my point of view unexplainable -
> behaviour when using the GWT NumberFormat
> (com.google.gwt.i18n.client.NumberFormat). I am using GWT 2.0.3,
> Eclipse Ganymed and IE8/FF3.6.
>
> Within my client package I have a static helper class which contains
> the following method:
>
> 
>
> public class Utils {
>  ...
>  public static final NumberFormat DOUBLE2_FORMAT =
> NumberFormat.getFormat("##.00");
>  ...
>
>  public String formatDouble2(double d) {
>return DOUBLE2_FORMAT.format(d);
>  }
>
>  ...
> }
>
> 
>
> Using the code above I get a javascript error when using the
> formatDouble2 method. Compiling the GWT code in a "detailed" way and
> the javascript error message is something like
> com...i18n.client.positivePrefix is null or not an object. The GUI
> gets stuck and the application is no longer usable.
>
> So how did I solve it?
> During debug instrumentalization I found two ways. Unfortunately I can
> not explain either of them - so I was hoping someone can explain me
> why it works! ;)
>
> Adding a Window.alert(...) into the formatDouble2 and everything works
> fine. Why!?
>
>
> 
>
> public class Utils {
>  ...
>  public static final NumberFormat DOUBLE2_FORMAT =
> NumberFormat.getFormat("##.00");
>  ...
>
>  public String formatDouble2(double d) {
>Window.alert("Utils: inside formatDouble2 d=" +d);
>return DOUBLE2_FORMAT.format(d);
>  }
>
>  ...
> }
>
> 
>
> The solution I am currently using is to only use pattern itself as a
> static member and create the NumerFormat within the method. This works
> too.
>
>
>
> 
>
> public class Utils {
>  ...
>  public static final String DOUBLE2_FORMAT_PATTERN = "##.00";
>  ...
>
>  public String formatDouble2(double d) {
>return NumberFormat.getFormat(DOUBLE2_FORMAT_PATTERN).format(d);
>  }
>
>  ...
> }
>
> 
>
> BTW, changing the public static to private static did not work either.
>
> Thanks in Advance for your help!
> Stefan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat

2010-04-01 Thread brianw
hi there,

I've been trying to format decimals numbers in the French style; eg
5 000,00
tried setting a number pattern, nothing worked;
api says "corresponding locale symbol collection" are in
com.google.gwt.i18n.client.constants and there one reads:
 use LocaleInfo.getCurrentLocale().getNumberConstants()

alas LocaleInfo no has a setLocale;
the app I working on has 2 locales: en, fr
which can be re-set on the fly by the user.

any assistance would be greatly appreciated
thx
B

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat

2010-04-01 Thread Yegor
StrongSteve,

I think you discovered a bug. I tried your code and I am getting a JS
error too. Windows.alert() in front of format() removes the error.
Hosted mode works either way. It might be a bug compiler's
optimization. A one-liner like that is probably inlined by the
compiler.

You should log this issue to the GWT issue tracker at
http://code.google.com/p/google-web-toolkit/issues/list

Yegor

On Apr 1, 4:52 am, StrongSteve  wrote:
> No one?
>
> On Mar 25, 11:32 am, StrongSteve  wrote:
>
>
>
> > Hello,
>
> > I experience the following - from my point of view unexplainable -
> > behaviour when using the GWT NumberFormat
> > (com.google.gwt.i18n.client.NumberFormat). I am using GWT 2.0.3,
> > Eclipse Ganymed and IE8/FF3.6.
>
> > Within my client package I have a static helper class which contains
> > the following method:
>
> > 
>
> > public class Utils {
> >   ...
> >   public static final NumberFormat DOUBLE2_FORMAT =
> > NumberFormat.getFormat("##.00");
> >   ...
>
> >   public String formatDouble2(double d) {
> >     return DOUBLE2_FORMAT.format(d);
> >   }
>
> >   ...
>
> > }
>
> > 
>
> > Using the code above I get a javascript error when using the
> > formatDouble2 method. Compiling the GWT code in a "detailed" way and
> > the javascript error message is something like
> > com...i18n.client.positivePrefix is null or not an object. The GUI
> > gets stuck and the application is no longer usable.
>
> > So how did I solve it?
> > During debug instrumentalization I found two ways. Unfortunately I can
> > not explain either of them - so I was hoping someone can explain me
> > why it works! ;)
>
> > Adding a Window.alert(...) into the formatDouble2 and everything works
> > fine. Why!?
>
> > 
>
> > public class Utils {
> >   ...
> >   public static final NumberFormat DOUBLE2_FORMAT =
> > NumberFormat.getFormat("##.00");
> >   ...
>
> >   public String formatDouble2(double d) {
> >     Window.alert("Utils: inside formatDouble2 d=" +d);
> >     return DOUBLE2_FORMAT.format(d);
> >   }
>
> >   ...
>
> > }
>
> > 
>
> > The solution I am currently using is to only use pattern itself as a
> > static member and create the NumerFormat within the method. This works
> > too.
>
> > 
>
> > public class Utils {
> >   ...
> >   public static final String DOUBLE2_FORMAT_PATTERN = "##.00";
> >   ...
>
> >   public String formatDouble2(double d) {
> >     return NumberFormat.getFormat(DOUBLE2_FORMAT_PATTERN).format(d);
> >   }
>
> >   ...
>
> > }
>
> > 
>
> > BTW, changing the public static to private static did not work either.
>
> > Thanks in Advance for your help!
> > Stefan

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat

2010-04-01 Thread StrongSteve
No one?

On Mar 25, 11:32 am, StrongSteve  wrote:
> Hello,
>
> I experience the following - from my point of view unexplainable -
> behaviour when using the GWT NumberFormat
> (com.google.gwt.i18n.client.NumberFormat). I am using GWT 2.0.3,
> Eclipse Ganymed and IE8/FF3.6.
>
> Within my client package I have a static helper class which contains
> the following method:
>
> 
>
> public class Utils {
>   ...
>   public static final NumberFormat DOUBLE2_FORMAT =
> NumberFormat.getFormat("##.00");
>   ...
>
>   public String formatDouble2(double d) {
>     return DOUBLE2_FORMAT.format(d);
>   }
>
>   ...
>
> }
>
> 
>
> Using the code above I get a javascript error when using the
> formatDouble2 method. Compiling the GWT code in a "detailed" way and
> the javascript error message is something like
> com...i18n.client.positivePrefix is null or not an object. The GUI
> gets stuck and the application is no longer usable.
>
> So how did I solve it?
> During debug instrumentalization I found two ways. Unfortunately I can
> not explain either of them - so I was hoping someone can explain me
> why it works! ;)
>
> Adding a Window.alert(...) into the formatDouble2 and everything works
> fine. Why!?
>
> 
>
> public class Utils {
>   ...
>   public static final NumberFormat DOUBLE2_FORMAT =
> NumberFormat.getFormat("##.00");
>   ...
>
>   public String formatDouble2(double d) {
>     Window.alert("Utils: inside formatDouble2 d=" +d);
>     return DOUBLE2_FORMAT.format(d);
>   }
>
>   ...
>
> }
>
> 
>
> The solution I am currently using is to only use pattern itself as a
> static member and create the NumerFormat within the method. This works
> too.
>
> 
>
> public class Utils {
>   ...
>   public static final String DOUBLE2_FORMAT_PATTERN = "##.00";
>   ...
>
>   public String formatDouble2(double d) {
>     return NumberFormat.getFormat(DOUBLE2_FORMAT_PATTERN).format(d);
>   }
>
>   ...
>
> }
>
> 
>
> BTW, changing the public static to private static did not work either.
>
> Thanks in Advance for your help!
> Stefan

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



[Javascript Error] NumberFormat

2010-03-25 Thread StrongSteve
Hello,

I experience the following - from my point of view unexplainable -
behaviour when using the GWT NumberFormat
(com.google.gwt.i18n.client.NumberFormat). I am using GWT 2.0.3,
Eclipse Ganymed and IE8/FF3.6.

Within my client package I have a static helper class which contains
the following method:



public class Utils {
  ...
  public static final NumberFormat DOUBLE2_FORMAT =
NumberFormat.getFormat("##.00");
  ...

  public String formatDouble2(double d) {
return DOUBLE2_FORMAT.format(d);
  }

  ...
}



Using the code above I get a javascript error when using the
formatDouble2 method. Compiling the GWT code in a "detailed" way and
the javascript error message is something like
com...i18n.client.positivePrefix is null or not an object. The GUI
gets stuck and the application is no longer usable.

So how did I solve it?
During debug instrumentalization I found two ways. Unfortunately I can
not explain either of them - so I was hoping someone can explain me
why it works! ;)

Adding a Window.alert(...) into the formatDouble2 and everything works
fine. Why!?




public class Utils {
  ...
  public static final NumberFormat DOUBLE2_FORMAT =
NumberFormat.getFormat("##.00");
  ...

  public String formatDouble2(double d) {
Window.alert("Utils: inside formatDouble2 d=" +d);
return DOUBLE2_FORMAT.format(d);
  }

  ...
}



The solution I am currently using is to only use pattern itself as a
static member and create the NumerFormat within the method. This works
too.





public class Utils {
  ...
  public static final String DOUBLE2_FORMAT_PATTERN = "##.00";
  ...

  public String formatDouble2(double d) {
return NumberFormat.getFormat(DOUBLE2_FORMAT_PATTERN).format(d);
  }

  ...
}



BTW, changing the public static to private static did not work either.

Thanks in Advance for your help!
Stefan

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat/DateTimeFormat reusability

2010-02-24 Thread cretz
Since you are in JavaScript, thread safety should not matter as far as
concurrent updates to object state. Regardless, you can see from the
code in both classes that the state is not really changed once the
pattern has been parsed.

Of course, there can be memory size issues if you store lots objects
statically versus creating as necessary (a CPU issue). That is your
decision based on your design.

On Feb 23, 3:21 pm, "Evgeny Shepelyuk"  wrote:
> Hello,
>
> Are classes mentioned in subject thread-safew and reusable.
> For instance if i'm using them in cell renderer in GXT grid for formatting  
> value.
> Should i create instance each time i need to format value or instance can  
> be created once and then reused ?
>
> --
> Best Regards
> Evgeny K. Shepelt      

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat/DateTimeFormat reusability

2010-02-23 Thread Evgeny Shepelyuk

Hello,

Are classes mentioned in subject thread-safew and reusable.
For instance if i'm using them in cell renderer in GXT grid for formatting  
value.
Should i create instance each time i need to format value or instance can  
be created once and then reused ?


--
Best Regards
Evgeny K. Shepelt   

--
You received this message because you are subscribed to the Google Groups "Google 
Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Are NumberFormat and DateFormat reusable ?

2010-02-23 Thread jk
Hello,

I was unable to find any info regarding my questions. Are those 2
classes from com.google.gwt.i18n.client package are reusable ?
For example if i'm using grid cell renderer in GXT should i create new
instance each time i need to format value
or i can create formatter instance once and reuse it for further
formatting whenever it's required ?

--
Regards,
Evgeny Shepelyuk

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: NumberFormat problems(8 decimal places)

2010-02-15 Thread tomasm
Hi,

This is a known bug. See 
http://code.google.com/p/google-web-toolkit/issues/detail?id=4368
for more details and workarounds.

-Tomas

On Feb 5, 4:43 am, Tercio  wrote:
> Hi!
>
> I have aNumberFormatwith 8 decimal places, that the code:
>
>                NumberFormatformat =NumberFormat.getFormat("#,##0.");
>                 System.out.println(format.format(1234.5678d));
>
> When I run, it prints: "1,234.7852517"
>
> But should print: "1,234.5678"
>
> If I reduce the zeros to 6, it works("1,234.567800")
>
> Is this a bug or I'm doing something wrong?
>
> Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat problems(8 decimal places)

2010-02-04 Thread Tercio
Hi!

I have a NumberFormat with 8 decimal places, that the code:

NumberFormat format = NumberFormat.getFormat("#,##0.");
System.out.println(format.format(1234.5678d));

When I run, it prints: "1,234.7852517"

But should print: "1,234.5678"

If I reduce the zeros to 6, it works("1,234.567800")

Is this a bug or I'm doing something wrong?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



NumberFormat not understanding its own output?

2009-12-28 Thread Jaroslav Záruba
I can't get NumberFormat working, it seems like it can't parse its own
output.

I have copied following from the watch-panel in Eclipse:
/*
 * NumberFormat decimalFormat =
 * com.google.gwt.i18n.client.NumberFormat.getDecimalFormat();
 */
"decimalFormat.format(1234.5)"= "1 234,5"
"decimalFormat.parse("1 234,5")" => java.lang.NumberFormatException!?
"decimalFormat.parse("1.234,5")" => java.lang.NumberFormatException
"decimalFormat.parse("1,234.5")" => java.lang.NumberFormatException
"decimalFormat.parse("1 234.5")" => java.lang.NumberFormatException
"decimalFormat.parse("1234,5")"= 1234.5
"decimalFormat.getPattern()"= "#,##0.###"

NumberConstants of my locale:
/*
 * NumberConstants numberConstants = GWT.create
 * (NumberConstantsImpl.class); // (NumberConstantsImpl_cs)
 */
"numberConstants.decimalSeparator()"= ","
"numberConstants.groupingSeparator()"= " "
"numberConstants.monetarySeparator()"= ","
"numberConstants.monetaryGroupingSeparator()"= " "

I assume following does not matter but just in case...
...this is how my machine OS formats numbers:
Number: 123,456,789.00
Currency: 123 456 789,00 Kč
...this is how the server OS formats numbers:
Number: 123 456 789,00
Currency: 123 456 789,00 Kč

Is this a bug or am I missing something?
I assume NumberFormat should know how to parse a string it previously
returned as a result of formatting a number.

Best regards
 J. Záruba

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




NumberFormat not understanding its own output?

2009-12-22 Thread Jaroslav Záruba
I can't get the NumberFormat working, it seems like it can't parse its
own output.

I have copied following from the watch-panel in Eclipse:
/*
 * NumberFormat decimalFormat =
com.google.gwt.i18n.client.NumberFormat.getDecimalFormat();
 */
"decimalFormat.format(1234.5)"= "1 234,5"
"decimalFormat.parse("1 234,5")" => java.lang.NumberFormatException!?
"decimalFormat.parse("1.234,5")" => java.lang.NumberFormatException
"decimalFormat.parse("1,234.5")" => java.lang.NumberFormatException
"decimalFormat.parse("1 234.5")" => java.lang.NumberFormatException
"decimalFormat.parse("1234,5")"= 1234.5
"decimalFormat.getPattern()"= "#,##0.###"

NumberConstants of my locale:
/*
 * NumberConstants numberConstants = GWT.create
(NumberConstantsImpl.class);
 * (NumberConstantsImpl_cs)
 */
"numberConstants.decimalSeparator()"= ","
"numberConstants.groupingSeparator()"= " "
"numberConstants.monetarySeparator()"= ","
"numberConstants.monetaryGroupingSeparator()"= " "

I assume following does not matter but just in case...
...this is how my machine's OS formats numbers:
Number: 123,456,789.00
Currency: 123 456 789,00 Kč
...this is how the server's OS formats numbers:
Number: 123 456 789,00
Currency: 123 456 789,00 Kč

Am I missing something?

Best regards
  J. Záruba

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: NumberFormat, change seperator's

2009-11-08 Thread rjcarr

Hi SkiD-

Doesn't your subject answer your question?  Isn't the NumberFormat
class what you're looking for?

http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/index.html?com/google/gwt/i18n/client/NumberFormat.html

On Nov 6, 8:38 am, SkiD  wrote:
> Hello,
>
> i want to change the grouping seperator from "," to "." and the
> decimalseperator from "." to "," .
> How can i do that ?
>
> Greetings,
> SkiD.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~--~~~~--~~--~--~---



Re: NumberFormat getCurrenyFormat()

2009-03-19 Thread fatjack1...@googlemail.com

Anyone have any suggestions?

On Mar 18, 5:21 pm, "fatjack1...@googlemail.com"
 wrote:
> Or at least change it to £2.57 instead of $?
>
> On Mar 17, 8:58 pm, "fatjack1...@googlemail.com"
>
>  wrote:
> > Ok,
>
> > The reason I wasparsing it back in was to convert it from a String to
> > an integer. I think I have fixed part of the problem. My code now
> > looks like this:
>
> > NumberFormat fmt = NumberFormat.getCurrencyFormat();
> > String formatted = fmt.format(discountAmount);
> > discountAmount = Integer.parse(formatted);
>
> > However, it now comes up with US$2.57...How do I get it to remove the
> > US$ part?!
>
> > Regards,
> > Jack
>
> > On Mar 17, 6:38 pm, MN  wrote:
>
> > > please provide your full code.
>
> > > you print out formatted oder discountAmount?
> > > why you parse again the formatted string back to discountAmount?
>
> > > On 17 Mrz., 15:18, "fatjack1...@googlemail.com"
>
> > >  wrote:
> > > > Hi,
>
> > > > I am having some problems correctly displaying currency. Here is the
> > > > code I am using:
>
> > > > //Format the discount to two decimal places
> > > > NumberFormat fmt = NumberFormat.getCurrencyFormat();
> > > > String formatted = fmt.format(discountAmount);
> > > > discountAmount = NumberFormat.getCurrencyFormat().parse(formatted);
>
> > > > The discount amount field is set to some currency value for example
> > > > 2.5. Now, it works fine if the value is set to 2 or more decimal
> > > > places, so it would format 2.5 to 2.58. However, if the value is
> > > > intitial set to say 3, it formats the value to 3.0!
>
> > > > Now, as I am using this to display the price of something, £3.0 is not
> > > > really much use. Can someone see where I am going wrong in my code or
> > > > if I need to add something??
>
> > > > Cheers,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: NumberFormat getCurrenyFormat()

2009-03-18 Thread fatjack1...@googlemail.com

Or at least change it to £2.57 instead of $?

On Mar 17, 8:58 pm, "fatjack1...@googlemail.com"
 wrote:
> Ok,
>
> The reason I wasparsing it back in was to convert it from a String to
> an integer. I think I have fixed part of the problem. My code now
> looks like this:
>
> NumberFormat fmt = NumberFormat.getCurrencyFormat();
> String formatted = fmt.format(discountAmount);
> discountAmount = Integer.parse(formatted);
>
> However, it now comes up with US$2.57...How do I get it to remove the
> US$ part?!
>
> Regards,
> Jack
>
> On Mar 17, 6:38 pm, MN  wrote:
>
> > please provide your full code.
>
> > you print out formatted oder discountAmount?
> > why you parse again the formatted string back to discountAmount?
>
> > On 17 Mrz., 15:18, "fatjack1...@googlemail.com"
>
> >  wrote:
> > > Hi,
>
> > > I am having some problems correctly displaying currency. Here is the
> > > code I am using:
>
> > > //Format the discount to two decimal places
> > > NumberFormat fmt = NumberFormat.getCurrencyFormat();
> > > String formatted = fmt.format(discountAmount);
> > > discountAmount = NumberFormat.getCurrencyFormat().parse(formatted);
>
> > > The discount amount field is set to some currency value for example
> > > 2.5. Now, it works fine if the value is set to 2 or more decimal
> > > places, so it would format 2.5 to 2.58. However, if the value is
> > > intitial set to say 3, it formats the value to 3.0!
>
> > > Now, as I am using this to display the price of something, £3.0 is not
> > > really much use. Can someone see where I am going wrong in my code or
> > > if I need to add something??
>
> > > Cheers,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: NumberFormat getCurrenyFormat()

2009-03-17 Thread fatjack1...@googlemail.com

Ok,

The reason I wasparsing it back in was to convert it from a String to
an integer. I think I have fixed part of the problem. My code now
looks like this:

NumberFormat fmt = NumberFormat.getCurrencyFormat();
String formatted = fmt.format(discountAmount);
discountAmount = Integer.parse(formatted);

However, it now comes up with US$2.57...How do I get it to remove the
US$ part?!

Regards,
Jack

On Mar 17, 6:38 pm, MN  wrote:
> please provide your full code.
>
> you print out formatted oder discountAmount?
> why you parse again the formatted string back to discountAmount?
>
> On 17 Mrz., 15:18, "fatjack1...@googlemail.com"
>
>  wrote:
> > Hi,
>
> > I am having some problems correctly displaying currency. Here is the
> > code I am using:
>
> > //Format the discount to two decimal places
> > NumberFormat fmt = NumberFormat.getCurrencyFormat();
> > String formatted = fmt.format(discountAmount);
> > discountAmount = NumberFormat.getCurrencyFormat().parse(formatted);
>
> > The discount amount field is set to some currency value for example
> > 2.5. Now, it works fine if the value is set to 2 or more decimal
> > places, so it would format 2.5 to 2.58. However, if the value is
> > intitial set to say 3, it formats the value to 3.0!
>
> > Now, as I am using this to display the price of something, £3.0 is not
> > really much use. Can someone see where I am going wrong in my code or
> > if I need to add something??
>
> > Cheers,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: NumberFormat getCurrenyFormat()

2009-03-17 Thread MN

please provide your full code.

you print out formatted oder discountAmount?
why you parse again the formatted string back to discountAmount?

On 17 Mrz., 15:18, "fatjack1...@googlemail.com"
 wrote:
> Hi,
>
> I am having some problems correctly displaying currency. Here is the
> code I am using:
>
> //Format the discount to two decimal places
> NumberFormat fmt = NumberFormat.getCurrencyFormat();
> String formatted = fmt.format(discountAmount);
> discountAmount = NumberFormat.getCurrencyFormat().parse(formatted);
>
> The discount amount field is set to some currency value for example
> 2.5. Now, it works fine if the value is set to 2 or more decimal
> places, so it would format 2.5 to 2.58. However, if the value is
> intitial set to say 3, it formats the value to 3.0!
>
> Now, as I am using this to display the price of something, £3.0 is not
> really much use. Can someone see where I am going wrong in my code or
> if I need to add something??
>
> Cheers,
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



NumberFormat getCurrenyFormat()

2009-03-17 Thread fatjack1...@googlemail.com

Hi,

I am having some problems correctly displaying currency. Here is the
code I am using:

//Format the discount to two decimal places
NumberFormat fmt = NumberFormat.getCurrencyFormat();
String formatted = fmt.format(discountAmount);
discountAmount = NumberFormat.getCurrencyFormat().parse(formatted);



The discount amount field is set to some currency value for example
2.5. Now, it works fine if the value is set to 2 or more decimal
places, so it would format 2.5 to 2.58. However, if the value is
intitial set to say 3, it formats the value to 3.0!

Now, as I am using this to display the price of something, £3.0 is not
really much use. Can someone see where I am going wrong in my code or
if I need to add something??

Cheers,

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



NumberFormat currency format - number of decimal places based on currency code?

2008-10-30 Thread Dobes

I'm trying to format international currency values all in the same
application, and I'm switching from using my home-baked solution to
using GWT's NumberFormat.  What I can't figure out is how to determine
and change the number of decimal places for each currency.

For example, dollars would be $1,000.00 but rupees typically don't
bother with the decimal place and they put a seperator every 4 digits
instead of 3 so they are more like Rs1,.  Can GWT support this
within one compile of the application or does it always use the same
currency format within one locale, regardless of the currency code it
is given?

Thanks,
Dobes


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Does gwt NumberFormat support COMMA as decimal seperator?

2008-10-21 Thread obesga

Depends on locale, or maybe use a String.replace(",","."); for your
purposes

Oskar

( yes, I also hate the mess about decimal separators - every system/
locale/app can define it's own pattern. Where are standarts when you
need them ? )


On 21 oct, 04:47, Kelvin <[EMAIL PROTECTED]> wrote:
> Does gwt NumberFormat support COMMA as decimal seperator? (for LOCALE
> France etc)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Does gwt NumberFormat support COMMA as decimal seperator?

2008-10-20 Thread Kelvin

Does gwt NumberFormat support COMMA as decimal seperator? (for LOCALE
France etc)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---