You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Pierangelo Mancusi (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/03/01 08:18:00 UTC

[jira] [Issue Comment Edited] (FLEX-20) The Max value restriction in Spark NumericStepper doesn't work properly

    [ https://issues.apache.org/jira/browse/FLEX-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219584#comment-13219584 ] 

Pierangelo Mancusi edited comment on FLEX-20 at 3/1/12 7:16 AM:
----------------------------------------------------------------

Hi John,
fist of all, nice to meet you.

let's start the answer:
your comment  to the  issue at Adobe site is wrong, cause it's based on a bad interpretation of the issue.
Of course, before i started to work on this, i tested your solution but it was wrong. (i compiled the SDK with your suggestion...btw thanks Justin for your  good work )

When the component is created passing nothing to the "value" property, it inherits the property "value=0" from the Range.as class (if you assign a numeber, the component takes it obviously).

when we change the value in the component, the TextInput.text is passed to the NumberFormatter.parseNumber(parseString:String) ( see line 796 - NumericStepper.as)

This last help method returns NaN and the property lastOperationStatus of NumberFormatter class  is set first to "illegalArgumentError" and then to "parseError".

Here is the mistake and the question is: When we can insert a "NaN" value in the NumericStepper's TextInput, which accepts  only strings rapresenting a number?...never i say.

so when  NumericStepper's  inputValue is NaN, after all possible assignement in that method,  i restore the last valid value.

that is the fix.

Also i 100% agree with you  when you say that the comparison at line 791 of the NumericStepper class  is rather questionable.
Never seen an if like that :)

                
      was (Author: pierangelo):
    Hi John,
fist of all, nice to meet you.

let's start the answer:
your comment  to the  issue at Adobe site is wrong, cause it's based on a bad interpretation of the issue.
Of course, before i started to work on this, i tested your solution but it was wrong. (i compiled the SDK with your suggestion...btw thanks Justin for your  good work )

When the component is created passing nothing to the "value" property, it inherits the property "value=0" from the Range.as class (if you assign a numeber, the component takes it obviously).

when we change the value in the component, the TextInput.text is passed to the NumberFormatter.parseNumber(parseString:String) ( see line 796 - NumericStepper.as)

This last help method return NaN and the property lastOperationStatus of NumberFormatter class  is set first to "illegalArgumentError" and then to "parseError".

Here is the mistake and the question is: When we can insert a "NaN" value in the NumericStepper's TextInput, which accepts  only strings rapresenting a number?...never i say.

so when  NumericSteppes's  inputValue is NaN, after all possible assignement in that method,  i restore the last valid value.

that is the fix.

Also i 100% agree with you  when you say that the comparison at line 791 of the NumericStepper class  is rather questionable.
Never seen an if like that :)

                  
> The Max value restriction in Spark NumericStepper doesn't work properly
> -----------------------------------------------------------------------
>
>                 Key: FLEX-20
>                 URL: https://issues.apache.org/jira/browse/FLEX-20
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Project Management
>         Environment: Apache FlexSDK 4.6 - Adobe FlexSDK 4.6 -  Adobe FlexSDK 4.5
>            Reporter: Pierangelo Mancusi
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>              Labels: patch
>         Attachments: NumericStepperPatch.txt
>
>
> original issue: https://bugs.adobe.com/jira/browse/SDK-31123
> here a summary:
> Steps to reproduce: 
> 1.Launch the browser with Numeric stepper. Set the min value as 10 max value as 50. Also set default values as 20. 
> 2.After launching the broswer clear the default value 20 and focus out from the numeric stepper. It displays "NAN" 
> 3. Again focus back to the numeric stepper and try to edit 3 digit value (Eg.777). Then foucs out. It doen't restrict to max value i.e"50" as set earlier in 
>    step 1. It allows the 3 digit value enetered instead. 
>   
>  Actual Results: The enetered value will be displayed 
>   
>   
>  Expected Results: It should restrict and display the max values as set in step 1. 
>   
>   
>  Workaround (if any): No Work around. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira