Created
April 28, 2010 13:51
-
-
Save phiggins42/382167 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.provide("plugd.layout"); | |
(function(d){ | |
var clsCache = {}, | |
doit = function(part){ | |
// do some mangling: | |
var dtype = part.type, kids = part.children; | |
if(!clsCache[dtype]){ clsCache[dtype] = d.getObject(dtype); } | |
if(part.id){ part.props.id = part.id; } | |
// create the instance from the cached function | |
var c = clsCache[dtype], main = new c(part.props, part.id); | |
// process the children recursively | |
kids && d.forEach(kids, function(kid){ | |
doit(kid).placeAt(main); | |
}); | |
return main; // dijit._Widget | |
} | |
; | |
dojo.createLayout = function(def){ | |
// summary: Create a Layout from a passed definition | |
// def: Object | |
// The layout definition. | |
// returns: dijit._Widget | |
return doit(def); | |
} | |
})(dojo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment