Pman.Tab.BuilderTree.bjs
authorAlan Knowles <alan@akbkhome.com>
Thu, 10 Feb 2011 15:11:50 +0000 (23:11 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 10 Feb 2011 15:11:50 +0000 (23:11 +0800)
Pman.Tab.BuilderTree.bjs

index b0ed8a5..a089e20 100644 (file)
@@ -50,7 +50,7 @@
                                     "enableDD": true,
                                     "rootVisible": true,
                                     "xtype": "TreePanel",
-                                    "|appendNode": "function(parent, inConfig, point) {\n    \n        \n \n    var items = [];\n    if (inConfig.items) { // loading!\n        items = inConfig.items;\n        delete inConfig.items;\n    }\n    \n    var config = this.cloneConfig(inConfig);\n    \n    if (!parent) {\n\tparent = this.root;\n    }\n          \n    var newNode = new Roo.tree.TreeNode({\n            text: this.configToText(config)\n    });\n            \n    \n    newNode.elConfig = config;\n    //if (markUndo === true) {\n    //Pman.Tab.Builder.markUndo(\"Add \" + newNode.text);\n    //\n        // appends to our tree...\n        \n    switch(point) {\n        case 'before':\n            parent.parentNode.insertBefore(newNode, parent);\n            break;\n        case 'after':\n            // if it's the last node.. then we append..\n            var ix = parent.parentNode.indexOf(parent) + 1;\n            if (parent.parentNode.childNodes.length == ix) {\n                 parent.appendChild(newNode);\n                 break;\n            }\n            var bef = parent.parentNode.childNodes[ix];\n            parent.parentNode.insertBefore(newNode, bef);\n            break;\n        \n        case 'append':\n        default:    \n            parent.appendChild(newNode);\n            break;\n    }\n        \n    if (items.length) {\n        Roo.each(items, function(i) {\n            this.appendNode(newNode, i);\n        },this);\n        \n    }\n        \n        \n        /*\n        -- panels with panes...\n\t\tif (items && items.length) {\n\t\t\tfor (var i = 0; i < items.length; i++) {\n\t\t\t\t\tthis.appendConfig(items[i], newNode, false);\n\t\t\t}\n\t\t}\n\t\tif (opts.doUpdate !== false) {\n\t\t\tthis.updateForm(false, newNode);\n\t\t}\n        */\n    return newNode;\n\n\t \n}\n",
+                                    "|appendNode": "function(parent, inConfig, point) {\n    \n        \n \n    var items = [];\n    if (inConfig.items) { // loading!\n        items = inConfig.items;\n        delete inConfig.items;\n    }\n    \n    var config = this.cloneConfig(inConfig);\n    \n    if (!parent) {\n\tparent = this.root;\n    }\n          \n    var newNode = new Roo.tree.TreeNode({\n            text: this.configToText(config)\n    });\n            \n    \n    newNode.elConfig = config;\n    //if (markUndo === true) {\n    //Pman.Tab.Builder.markUndo(\"Add \" + newNode.text);\n    //\n        // appends to our tree...\n        \n    switch(point) {\n        case 'before':\n            parent.parentNode.insertBefore(newNode, parent);\n            break;\n        case 'after':\n            // if it's the last node.. then we append..\n            var ix = parent.parentNode.indexOf(parent) + 1;\n            if (parent.parentNode.childNodes.length == ix) {\n                 parent.parentNode.appendChild(newNode);\n                 break;\n            }\n            var bef = parent.parentNode.childNodes[ix];\n            parent.parentNode.insertBefore(newNode, bef);\n            break;\n        \n        case 'append':\n        default:    \n            parent.appendChild(newNode);\n            break;\n    }\n        \n    if (items.length) {\n        Roo.each(items, function(i) {\n            this.appendNode(newNode, i);\n        },this);\n        \n    }\n        \n        \n        /*\n        -- panels with panes...\n\t\tif (items && items.length) {\n\t\t\tfor (var i = 0; i < items.length; i++) {\n\t\t\t\t\tthis.appendConfig(items[i], newNode, false);\n\t\t\t}\n\t\t}\n\t\tif (opts.doUpdate !== false) {\n\t\t\tthis.updateForm(false, newNode);\n\t\t}\n        */\n    return newNode;\n\n\t \n}\n",
                                     "|clearAll": "function() {\n    var rt = this.root;\n     if (rt.childNodes.length) {\n        rt.removeChild(rt.childNodes[0]);\n    }\n   \n    this.root.elConfig  = Roo.apply({ }, this.defaultElConfig());  \n    //var btop = Pman.Tab.BuilderTop;\n    //if (btop.modsel && btop.modsel.lastData) {\n    //    this.tree.root.elConfig.app = btop.modsel.lastData.app;\n    //}\n    \n    this.setCurrentNode(this.root,true);\n\n}\n",
                                     "|cloneConfig": "function(config) {\n    if (!config) { return null; }\n    var newConfig = {};\n    \n    for (var i in config) {\n        if (typeof config[i] == 'object') {\n             newConfig[i] = this.cloneConfig(config[i]);\n        } else if (typeof config[i] != 'function') { // should this happen?\n             newConfig[i] = config[i];\n        }\n    }\n    return newConfig;\n}\n",
                                     "|configToText": "function(c) {\n     \n\tvar txt = [];\n\tc = c || {};\n          var sr = (typeof(c['+buildershow']) != 'undefined') &&  !c['+buildershow'] ? true : false;\n        if (sr) txt.push('<s>');\n        if (typeof(c['*prop']) != 'undefined')   { txt.push(c['*prop']+ ':'); }\n\tif (c.xtype)      { txt.push(c.xtype); }\n\tif (c.fieldLabel) { txt.push('[' + c.fieldLabel + ']'); }\n\tif (c.boxLabel)   { txt.push('[' + c.boxLabel + ']'); }\n    \n    \n\tif (c.layout)     { txt.push('<i>' + c.layout + '</i>'); }\n\tif (c.title)      { txt.push('<b>' + c.title + '</b>'); }\n        if (c.header)    { txt.push('<b>' + c.header + '</b>'); }\n        if (c.legend)      { txt.push('<b>' + c.legend + '</b>'); }\n\tif (c.text)       { txt.push('<b>' + c.text + '</b>'); }\n        if (c.name)       { txt.push('<b>' + c.name+ '</b>'); }\n\tif (c.region)     { txt.push('<i>(' + c.region + ')</i>'); }\n        if (c.dataIndex) { txt.push('[' + c.dataIndex+ ']'); }\n        if (sr) txt.push('</s>');\n\treturn (txt.length == 0 ? \"Element\" : txt.join(\" \"));\n \n  \n}\n",