You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Kent Tong (JIRA)" <ta...@jakarta.apache.org> on 2006/12/24 15:09:21 UTC

[jira] Reopened: (TAPESTRY-633) Default behavior of NumberTranslator treats zeros asymmetrically.

     [ http://issues.apache.org/jira/browse/TAPESTRY-633?page=all ]

Kent Tong reopened TAPESTRY-633:
--------------------------------

             
The new NumberTranslator is unconditionally treating empty as 0 (see the code below). It should do that only if omitZero is true.

    protected Object getValueForEmptyInput()
    {
        return new Double(0);
    }


> Default behavior of NumberTranslator treats zeros asymmetrically.
> -----------------------------------------------------------------
>
>                 Key: TAPESTRY-633
>                 URL: http://issues.apache.org/jira/browse/TAPESTRY-633
>             Project: Tapestry
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 4.0
>            Reporter: Paul Ferraro
>         Assigned To: Jesse Kuhnert
>            Priority: Minor
>             Fix For: 4.1.1
>
>
> The default behavior of the NumberTranslator uses omitZero = true.  I think that special treatment of zero values should not be the default behavior of NumberTranslator so that default behavior is entirely predicatable.
> Also, omitZero=true creates undesirably asymmetric behavior for processing zeros when you investigate a parse/format/parse cycle.
> If I enter a zero into a TextField that uses the NumberTranslator it gets parsed as a 0, when that 0 value is formatted for display, it will be formatted as "" even though it was entered and submitted as zero.  Upon resubmitting this value, without and changes, the "" will be parsed as a null.  This means that the parsed value can change even though the text value was never altered.  I think this is bad and should not be the default behavior of NumberTranslator.  I suggest defaulting omitZero to false.  Also, it would make more sense that if omitZero were true, then empty text values should be parsed as 0's.  This would create symmetric behavior even when omitZero is true.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org