Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-13 Thread Carol Frampton
Ok, just looked it up. I was wrong. If the various branches of an if/else statement involve single statements, don't make them into blocks. But if any branch has multiple statements, make all of them into blocks. ref: http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions#CodingC

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-12 Thread Justin Mclean
HI, > One more clarification. If there is an else it should then be > >if (expresion) >{ > statement; >} >else >{ > statement; >} Even for single line statements? I've seen quite a lot of missing braces in if/elses when there only one line. I've also seen b

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-12 Thread Carol Frampton
On 3/9/12 5 :18PM, "Carol Frampton" wrote: >I didn't look at the code but I can tell you what the current style guides >says. > >An if statement should look like > >if (expression) >statement; One more clarification. If there is an else it should then be if (expresion)

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Justin Mclean
Hi, Just a not that the generated ASdoc files have been updated in both locations. And if anyone want help generating ASDocs just ask. I'd forgotten how fiddly they can be. Thanks, Justin

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Justin Mclean
Hi, I've placed the generated ASdoc from the formatter and validator classes in the whiteboard but it not very readable there. So here are some alternative links: http://cdn.classsoftware.com/apacheflex/postcodes/asdocs/mx/formatters/PostCodeFormatter.html http://cdn.classsoftware.com/apacheflex

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Justin Mclean
Hi, Well that was actually quite easy - changes checked in. Just guess it goes to show that coding can be quicker than discussion :-) I'd still appreciated someone to supply alphanumeric unit tests (the wide character numeric tests pass fine) and to compile and test the sample application with

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Justin Mclean
Hi, While I'm still not convinced that wide character support needs to be built into the PostCodeValidator class I think the simplest way is to do so is use the flash.globilization.Collator class and the equals method to compare character by character in all operations with ignoreCharacterWidt

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Justin Mclean
Hi, > As far as I know Firefox has never been webkit based. It's based on > Mozilla's Gecko engine. Yep I got that wrong (it's late here)- sorry. So you know what browsers it is supported in? Justin

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Omar Gonzalez
> Both HTML and flash applications? As I said it works in Safari for me which is WebKit based like Firefox. As far as I know Firefox has never been webkit based. It's based on Mozilla's Gecko engine. -omar

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-11 Thread Justin Mclean
Hi, > the IME has not much to do with that. Validators are intended to be use with UI components usually text input field which have IME support. The documentation makes it fairly clear (to me) that the responsibility should be in with the text field (via IME) not in the validator. > User is

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-10 Thread Martin Heidegger
On 11/03/2012 11:46, Justin Mclean wrote: Hi, Just looked into the wide character issue and it seem Flex does have support for this via IME (Input Method Editor). These some info here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/IME.html http://livedocs.adob

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-10 Thread Justin Mclean
Hi, Just looked into the wide character issue and it seem Flex does have support for this via IME (Input Method Editor). These some info here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/IME.html http://livedocs.adobe.com/flex/3/html/help.html?content=18_Clien

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-10 Thread Justin Mclean
Hi, > What is the 1.5? We should try and not use any magic numbers/strings. A few lines above is the following comment. // We want invalid char and invalid format errors to show in preference // so give wrong length errors a higher value Re magic number string I agree in general but in this ca

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-10 Thread Omar Gonzalez
On Sat, Mar 10, 2012 at 2:21 PM, Justin Mclean wrote: > Hi, > > > Well the conversion game from boolean to number is best *read* like this: > So on one hand with have 4 if statements (an extra error condition has > been added) and a extra variable vs a single line of code. IMO the single > line of

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-10 Thread Justin Mclean
Hi, > Well the conversion game from boolean to number is best *read* like this: So on one hand with have 4 if statements (an extra error condition has been added) and a extra variable vs a single line of code. IMO the single line of code is just as readable even if it does uses casts. Number(in

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-10 Thread Martin Heidegger
On 10/03/2012 12:22, Justin Mclean wrote: Couldn't you just use var invalidFormat: Number = 0 or 1 ? I could but then I would be casting a Number to boolean on the other fields. Well the conversion game from boolean to number is best *read* like this: var wrongNess: Number = 0.0; //

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Justin Mclean
HI, >> Fp 10.2 is the earliest version the current 4.6 SDK will compile with (and >> that's only after I changed the build scripts) > Just because it compiles to this version doesn't mean it will work from this > version on?! it is compilable with earlier SDK's as well ?! To be honest I have no

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Justin Mclean
Hi, >>> *) suggestFormat Should be separated from the Validator as it is not >>> "necessary" to use the Validator (dependencies, dependencies) >> I think the connivence of having a single class is better. But happy to be >> convinced otherwise. Can you give a code sample? > > I attached three e

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Justin Mclean
Hi, > Couldn't you just use var invalidFormat: Number = 0 or 1 ? I could but then I would be casting a Number to boolean on the other fields. >>> *) You mix "brace in new line" (left) with "brace in current line" (right), >>> afaik its in the current line. > PostCodeValidator - 499 & 513 just as

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Justin Mclean
Hi, >> *) I have seen Japanese people writing their postal code with the unicode >> character prefix: 〒 That is not an accepted Format The simplest way of doing this is to treat it as a country code. I've modified this to the code to accept this. From what I could find it usually has a space af

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Martin Heidegger
On 10/03/2012 09:03, Justin Mclean wrote: Couldn't find an instance of this can you point out which file? Sorry, my fault, was browsing old version. I don't see it as an issue as the alternative would involve 3 if statements and an extra variable. Couldn't you just use var invalidFormat: Num

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Justin Mclean
Hi, > you already got a lot of feedback from dan, and I agree with him but i have > additional input (please treat as constructive critic): All feedback is constructive as far as I'm concerned. > *) The file headers say "Copyright Adobe Systems ... " Couldn't find an instance of this can you poi

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Justin Mclean
Hi, Thanks for the feedback. I've made most of the suggested changes and will check in the code shortly. A lot of your suggestions also apply to the existing mx validators. > public static const: ERROR_CODE_WRONG_FORMAT:String = "wrongFormat"; Changed but you might want to note that the exist

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Carol Frampton
I didn't look at the code but I can tell you what the current style guides says. An if statement should look like if (expression) statement; or if multiline if (expression) { statement1; statement2; } and there should be a space after the "if". This is

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Martin Heidegger
Hello Justin, you already got a lot of feedback from dan, and I agree with him but i have additional input (please treat as constructive critic): Generally: *) The file headers say "Copyright Adobe Systems ... " *) Casting Booleans to Numbers ... I am not sure if I like that. *) I you have co

Re: [Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-09 Thread Daniel Harfleet
d invalidChar use wrong and invalid for all variables, whilst format uses invalid for one and wrong for other two From: Justin Mclean To: flex-dev@incubator.apache.org Sent: Thursday, 8 March 2012, 3:07 Subject: [Proposal] Add PostCodeValidator and PostCodeFo

[Proposal] Add PostCodeValidator and PostCodeFormatter to the SDK

2012-03-07 Thread Justin Mclean
Hi, This PostCodeValidator and PostCodeFormatter components are are at stage where they could be considered for inclusion into the SDK. The components, tests and example application can be found here: http://svn.apache.org/viewvc/incubator/flex/whiteboard/jmclean/validators/src/ There's a few