src/aria/tools/inspector/InspectorModule.js
function (node, tplContainer, moduleContainer, dataFragmentsContainer,
                widgetsContainer) {
            if (node.type == "template" || node.type == "templateWidget") {
                var templateCtxt = node.elem;
                if (node.type == "templateWidget") {
                    if (templateCtxt.behavior) {
                        templateCtxt = templateCtxt.behavior.subTplCtxt;
                    } else {
                        templateCtxt = templateCtxt.subTplCtxt;
                    }
                }
                var selectedTemplate = this._data.selectedTemplate;
                var selectedModule = this._data.selectedModule;
                var subContent = [], widgets = [], moduleRegistered = false, moduleDescription;
                var moduleCtrlFactory = this.bridge.getAriaPackage().templates.ModuleCtrlFactory;
                this.$assert(190, !!templateCtxt);
                this.$assert(191, !!moduleCtrlFactory);
                // var data = templateCtxt.data;
                var moduleCtrl = templateCtxt.moduleCtrl;

                if (moduleCtrl) {
                    // check if module is already in the list of modules of the application
                    for (var index = 0, len = moduleContainer.length; index < len; index++) {
                        moduleDescription = moduleContainer[index];
                        if (moduleDescription.moduleCtrl == moduleCtrl) {
                            // if it was a subtemplate with the same module, current would be true -> new outer template
                            if (!moduleDescription.current) {
                                moduleDescription.outerTemplateCtxts.push(templateCtxt);
                                moduleDescription.current = true;
                            }
                            moduleRegistered = true;
                        } else {
                            moduleDescription.current = false;
                        }
                    }
                    // if not, add it, with current dom to identify
                    if (!moduleRegistered) {
                        var newModuleDescription = {
                            moduleCtrl : moduleCtrl,
                            outerTemplateCtxts : [templateCtxt],
                            current : true,
                            isReloadable : moduleCtrlFactory.isModuleCtrlReloadable(moduleCtrl)
                        };

                        if (selectedModule && selectedModule.moduleCtrl == moduleCtrl) {
                            this._data.selectedModule = newModuleDescription;
                        }
                        moduleContainer.push(newModuleDescription);
                    }
                }

                var templateDescription = {
                    templateCtxt : templateCtxt,
                    content : subContent,
                    moduleCtrl : moduleCtrl,
                    widgets : widgets
                };

                if (selectedTemplate && selectedTemplate.templateCtxt == templateCtxt) {
                    this._data.selectedTemplate = templateDescription;
                }

                tplContainer.push(templateDescription);

                widgetsContainer = widgets;
                tplContainer = subContent;
            } else if (node.type == "widget") {
                var widget = node.elem.behavior;
                // register widgets
                if (widgetsContainer && widget) {
                    var widgetDescription = {
                        widget : widget
                    };
                    widgetsContainer.push(widgetDescription);
                    if (node.content) {
                        var content = [];
                        widgetDescription.content = content;
                        widgetsContainer = content;
                    }

                }
            } // else if (node.type == "section") {
            // we do not currently display sections in the inspector (but this could be improved in the future)
            // }
            if (node.content) {
                this._convertRefreshMgrHierarchies(node.content, tplContainer, moduleContainer, dataFragmentsContainer, widgetsContainer);
            }
        }
function (node, tplContainer, moduleContainer, dataFragmentsContainer,
                widgetsContainer) {
            if (node.type == "template" || node.type == "templateWidget") {
                var templateCtxt = node.elem;
                if (node.type == "templateWidget") {
                    if (templateCtxt.behavior) {
                        templateCtxt = templateCtxt.behavior.subTplCtxt;
                    } else {
                        templateCtxt = templateCtxt.subTplCtxt;
                    }
                }
                var selectedTemplate = this._data.selectedTemplate;
                var selectedModule = this._data.selectedModule;
                var subContent = [], widgets = [], moduleRegistered = false, moduleDescription;
                var moduleCtrlFactory = this.bridge.getAriaPackage().templates.ModuleCtrlFactory;
                this.$assert(190, !!templateCtxt);
                this.$assert(191, !!moduleCtrlFactory);
                // var data = templateCtxt.data;
                var moduleCtrl = templateCtxt.moduleCtrl;

                if (moduleCtrl) {
                    // check if module is already in the list of modules of the application
                    for (var index = 0, len = moduleContainer.length; index < len; index++) {
                        moduleDescription = moduleContainer[index];
                        if (moduleDescription.moduleCtrl == moduleCtrl) {
                            // if it was a subtemplate with the same module, current would be true -> new outer template
                            if (!moduleDescription.current) {
                                moduleDescription.outerTemplateCtxts.push(templateCtxt);
                                moduleDescription.current = true;
                            }
                            moduleRegistered = true;
                        } else {
                            moduleDescription.current = false;
                        }
                    }
                    // if not, add it, with current dom to identify
                    if (!moduleRegistered) {
                        var newModuleDescription = {
                            moduleCtrl : moduleCtrl,
                            outerTemplateCtxts : [templateCtxt],
                            current : true,
                            isReloadable : moduleCtrlFactory.isModuleCtrlReloadable(moduleCtrl)
                        };

                        if (selectedModule && selectedModule.moduleCtrl == moduleCtrl) {
                            this._data.selectedModule = newModuleDescription;
                        }
                        moduleContainer.push(newModuleDescription);
                    }
                }

                var templateDescription = {
                    templateCtxt : templateCtxt,
                    content : subContent,
                    moduleCtrl : moduleCtrl,
                    widgets : widgets
                };

                if (selectedTemplate && selectedTemplate.templateCtxt == templateCtxt) {
                    this._data.selectedTemplate = templateDescription;
                }

                tplContainer.push(templateDescription);

                widgetsContainer = widgets;
                tplContainer = subContent;
            } else if (node.type == "widget") {
                var widget = node.elem.behavior;
                // register widgets
                if (widgetsContainer && widget) {
                    var widgetDescription = {
                        widget : widget
                    };
                    widgetsContainer.push(widgetDescription);
                    if (node.content) {
                        var content = [];
                        widgetDescription.content = content;
                        widgetsContainer = content;
                    }

                }
            } // else if (node.type == "section") {
            // we do not currently display sections in the inspector (but this could be improved in the future)
            // }
            if (node.content) {
                this._convertRefreshMgrHierarchies(node.content, tplContainer, moduleContainer, dataFragmentsContainer, widgetsContainer);
            }
        }
function ( node , tplContainer , moduleContainer , dataFragmentsContainer , widgetsContainer ) { if ( node . type == "template" || node . type == "templateWidget" ) { var templateCtxt = node . elem ; if ( node . type == "templateWidget" ) { if ( templateCtxt . behavior ) { templateCtxt = templateCtxt . behavior . subTplCtxt ; } else { templateCtxt = templateCtxt . subTplCtxt ; } } var selectedTemplate = this . _data . selectedTemplate ; var selectedModule = this . _data . selectedModule ; var subContent = [ ] , widgets = [ ] , moduleRegistered = false , moduleDescription ; var moduleCtrlFactory = this . bridge . getAriaPackage ( ) . templates . ModuleCtrlFactory ; this . $assert ( 190 , ! ! templateCtxt ) ; this . $assert ( 191 , ! ! moduleCtrlFactory ) ; // var data = templateCtxt.data; var moduleCtrl = templateCtxt . moduleCtrl ; if ( moduleCtrl ) { // check if module is already in the list of modules of the application for ( var index = 0 , len = moduleContainer . length ; index < len ; index ++ ) { moduleDescription = moduleContainer [ index ] ; if ( moduleDescription . moduleCtrl == moduleCtrl ) { // if it was a subtemplate with the same module, current would be true -> new outer template if ( ! moduleDescription . current ) { moduleDescription . outerTemplateCtxts . push ( templateCtxt ) ; moduleDescription . current = true ; } moduleRegistered = true ; } else { moduleDescription . current = false ; } } // if not, add it, with current dom to identify if ( ! moduleRegistered ) { var newModuleDescription = { moduleCtrl : moduleCtrl , outerTemplateCtxts : [ templateCtxt ] , current : true , isReloadable : moduleCtrlFactory . isModuleCtrlReloadable ( moduleCtrl ) } ; if ( selectedModule && selectedModule . moduleCtrl == moduleCtrl ) { this . _data . selectedModule = newModuleDescription ; } moduleContainer . push ( newModuleDescription ) ; } } var templateDescription = { templateCtxt : templateCtxt , content : subContent , moduleCtrl : moduleCtrl , widgets : widgets } ; if ( selectedTemplate && selectedTemplate . templateCtxt == templateCtxt ) { this . _data . selectedTemplate = templateDescription ; } tplContainer . push ( templateDescription ) ; widgetsContainer = widgets ; tplContainer = subContent ; } else if ( node . type == "widget" ) { var widget = node . elem . behavior ; // register widgets if ( widgetsContainer && widget ) { var widgetDescription = { widget : widget } ; widgetsContainer . push ( widgetDescription ) ; if ( node . content ) { var content = [ ] ; widgetDescription . content = content ; widgetsContainer = content ; } } } // else if (node.type == "section") { // we do not currently display sections in the inspector (but this could be improved in the future) // } if ( node . content ) { this . _convertRefreshMgrHierarchies ( node . content , tplContainer , moduleContainer , dataFragmentsContainer , widgetsContainer ) ; } }
Recursively convert a node from the refresh manager into the data structures used by the inspector.
@protected
@param {Object} node node in the RefreshManager hierarchy to start with
@param {Array} tplContainer container for templates found
@param {Array} moduleContainer container for modules found
@param {Array} dataFragmentsContainer container for data fragment, pieces of data not associated with a
module (not used currently)
@param {Array} widgetsContainer container for widgets found
Recursively convert a node from the refresh manager into the data structures used by the inspector .