Re: [Netwindows-cvs-notify] netWindows/winScripts/widgets validator_widget.js, 1.4, 1.5

Alex Russell <[email protected]> Fri, 16 Jan 2004 10:33:26 -0800
Newsgroups gmane.comp.windows.devel.netwindows
Organization netWindows.org
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Comments inline, please fix.

On Friday 16 January 2004 10:06 am, [email protected] 
wrote:
> Update of /cvsroot/netwindows/netWindows/winScripts/widgets
> In directory sc8-pr-cvs1:/tmp/cvs-serv31186/winScripts/widgets
>
> Modified Files:
> 	validator_widget.js
> Log Message:
> Added .changed() back to the validator widget. It was lost
> somewhere in the rewrite.
>
> Changed 'obj' references back to 'metaObj' for consistency with the
> rest of the validators. If we want to change the name of these, we
> should change them all to 'obj'.
>
> Index: validator_widget.js
> ===================================================================
> RCS file:
> /cvsroot/netwindows/netWindows/winScripts/widgets/validator_widget.
>js,v retrieving revision 1.4
> retrieving revision 1.5
> diff -u -w -d -r1.4 -r1.5
> --- validator_widget.js	6 Jan 2004 19:13:52 -0000	1.4
> +++ validator_widget.js	16 Jan 2004 18:06:28 -0000	1.5
> @@ -64,6 +64,13 @@
>  			</para>
>  	<!--*/
>
> +	this.changed = function() {
> +		var cmp = __components__.getComponentFromNode( domNode );
> +		if( !cmp || !cmp.validatorType ) return;

Um, what?

You know the style Nazi is going to bust a cap in yo ass for this, 
don't you?

Use this:

if((!cmp)||(!cmp["validatorType"])){ return; }

NO CONDITIONALS WITHOUT CURLIES!!!!!

This is non-negotiable, non-optional, and is just going to get you 
nastygrams from me.

> +
> +		domNode.value = cmp.validatorType.apply( domNode.value );
> +	}
> +
>  	// needs to be implemented by subclass
>  	this.apply = function(data){
>  		return data;
> @@ -240,21 +247,22 @@
>  function NW_VALIDATOR_FACTORY_date(domNode){
>  	var attrArr = ['displayFormat', 'dbFormat' ];
>  	var props = __util__.parseNWProps(domNode, attrArr);
> -	var obj = new NW_VALIDATOR_date(domNode);
> +	var metaObj = new NW_VALIDATOR_date(domNode);

It's internal and private. Who cares what the identifiers is? Shorter 
is better if it's not less clear. File size is the enemy here.

Clarity good. Size bad.

>  function NW_VALIDATOR_pcode(domNode){
> @@ -402,4 +410,4 @@
>  __scripts__.finalize(__config__.widgetPath+"validator_widget.js");
>  /*-->
>  </sect1>
> -<!-- */// -->
> +<!-- *///

????


- -- 
Alex Russell
[email protected]   BD10 7AFC 87F6 63F9 1691 83FA 9884 3A15 AFC9 61B7
[email protected] F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)

iD8DBQFACC52oV0dQ6uSmkYRAkIaAJ4wuZE7ts0VCDv19TcbmBXg9h6mrQCgoxba
+VjDAPkhZTWvICX8Hr/D+MU=
=Zac1
-----END PGP SIGNATURE-----


_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org