Proposing a new method for the __components__ registry

Michael Flanagan <[email protected]> Thu, 02 Oct 2003 15:18:46 -0700
Newsgroups gmane.comp.windows.devel.netwindows
Message-ID <[email protected]>
There is currently a getComponentsOfType(cType) method. The docs for it 
show that it takes a DOMNode. It doesn't do anything with it. All this 
method does is return all components that match the cType specified in 
the current running nw environment. The docs should be changed to remove 
the DOMNode reference from them.

I'm proposing the method included below. What it does is return the 
components of the specified cType but only if they are children of node 
passed into the method.

I would have committed this but CVS is down for me atm.

--Michael


/*-->
<methodsynopsis>
	&public; &arr;
	<methodname>getComponentsOfTypeFromNode</methodname>
	<methodparam>&str; <parameter>type</parameter></methodparam>
	<methodparam>&node; <parameter>domNode</parameter></methodparam>
</methodsynopsis>
<para role="methodinfo">
	Returns an array of references to all component &obj;s that are children
	of the specified &node; matching the specified type. Useful for 
iterating over a
	set of widgets.
</para>
<!--*/
this.getComponentsOfTypeFromNode = function(node, cType){
	var retArr = [];
	for(x in regArr){
	 
if((regArr[x])&&(regArr[x].componentType)&&(regArr[x].componentType==cType)){
			if(__util__.isDescendant(regArr[x].domNode, node)) 
retArr[retArr.length]=regArr[x];
		}
	}
	return retArr;
}
	


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