Skip to main content


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 17:50
Leo Niedermeier is currently offline Leo NiedermeierFriend
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: Mon Dec 30 16:35:53 GMT 2024

Powered by FUDForum. Page generated in 0.03392 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top