Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » NumberFormatter - Handle null value and empty input
NumberFormatter - Handle null value and empty input [message #50144] Thu, 28 February 2008 12:50
Leo Niedermeier is currently offline Leo Niedermeier
Messages: 4
Registered: July 2009
Junior Member
Hi,
NumberFormatter does a good job. But I have two questions:
1. Method NumberFormatter#setValue:
...
} else if ( value == null ) {
// Is not here:
// this.value = null;
clearText(0, editValue.length());
updateText(editValue.toString(), format(0));
}
...
Why is this.value not setted to null?

2. Method NumberFormatter#getValue, catch-Block:
>} catch (ParseException e1) {
> if ( zeroIntLen + zeroDecimalLen == 0
> && (editValue.length() == 0 || editValue.charAt(0) ==
> symbols.getDecimalSeparator()) ) {
> modified = false;
> value = new Integer(0);
> } else {
...

Why is this.value setted to Integer(0) and not to null? An empty String as
input produces a '0'. Because of this, we have some problems in further
calcualtions, because '0' is not the userinput and therefore produces a
false result. When the input is an empty string, we would expect null as
parsed Number.

Thanks,
Leo
Previous Topic:Changing the tree toggle renderer in Grid
Next Topic:NumberFormatter - Handle null value and empty input
Goto Forum:
  


Current Time: Wed Aug 27 07:12:24 EDT 2014

Powered by FUDForum. Page generated in 0.07338 seconds