3 "name": "Pman.Tab.BuilderTree",
4 "parent": "Pman.Tab.BuilderTab",
5 "title": "Pman.Tab.BuilderTree",
6 "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderTree.bjs",
10 "xtype": "NestedLayoutPanel",
15 "xtype": "BorderLayout",
20 "xtype": "LayoutRegion",
27 "xtype": "LayoutRegion",
32 "activate": "function (_self)\n{\n \n _this.tree = _self.tree;\n if (_this.hasMouseEvent) {\n return;\n }\n \n _this.hasMouseEvent = true;\n this.el.on('mouseover', function() { _this.isMouseOver= true; });\n this.el.on('mouseout', function() { _this.isMouseOver = false; });\n\n}"
40 "beforenodedrop": "function (e)\n{\n /*\n tree - The TreePanel\n target - The node being targeted for the drop\n data - The drag data from the drag source\n point - The point of the drop - append, above or below\n source - The drag source\n rawEvent - Raw mouse event\n dropNode - Drop node(s) provided by the source OR you can supply node(s) to be inserted by setting them on this object.\n cancel - Set this to true to cancel the drop.\n */\n Roo.log(e);\n if (!e.tree || !e.dropNode) {\n console.log('no tree or dropNode');\n return; // fixme drop of elements from palete..\n }\n var np = false; // new parent\n \n switch (e.point) {\n case 'above':\n case 'below':\n np = e.target.parentNode;\n break;\n case 'append':\n np = e.target;\n break;\n }\n \n // always drop onto own parent\n if (np == e.dropNode.parentNode) {\n if (e.rawEvent.ctrlKey) {\n e.dropNode = _this.dupeNode(e.dropNode);\n }\n return true;\n }\n if (_this.canAppend(np, e.dropNode.elConfig)) {\n if (e.rawEvent.ctrlKey) {\n e.dropNode = _this.dupeNode(e.dropNode);\n \n if (np.elConfig.xtype == 'GridEditor') {\n e.dropNode.elConfig['*prop'] = 'field';\n }\n \n }\n return true;\n } \n console.log('can not drop ' + e.dropNode.elConfig.xtype + ' ontop of ' + np.elConfig.xtype);\n \n \n \n return false;\n \n\n}",
41 "nodedrop": "function (dropEvent)\n{\n e.dropNode.setText(\n _this.configToText(e.dropNode.elConfig)\n );\n var bp = Pman.Tab.BuilderPanel;\n bp.redraw.defer(1000, bp, [true]);\n\n}",
42 "click": "function (node, e)\n{\n e.preventDefault();\n // console.log(e.button);\n this.setCurrentNode(node);\n\n}",
43 "contextmenu": "function (node, e)\n{\n e.stopEvent();\n \n this.getSelectionModel().select(node);\n _this.setCurrentNode(node);\n var xt = node.elConfig.xtype;\n var altx= false;\n if (typeof(node.elConfig['*prop']) != 'undefined') {\n altx = node.parentNode.elConfig.xtype +'.' + node.elConfig['*prop'];\n }\n var mn = Pman.Tab.BuilderPalete.getMenu(xt,altx);\n \n \n if (mn) {\n mn.show(e.getTarget());\n }\n \n\n\n}",
44 "nodedragover": "function (e)\n{\n Roo.log('nodedragover');\n Roo.log(e);\n // e.cancel..\n // if we have within the same tree:\n // dropNode (the node being dragged !!important!!) \n // point: below, append\n // target - node \n // for palete\n // dropNode = false;\n // grid = the grid...\n // source.dragData.selections[..] \n \n \n // we can only check parents... (we in theory can check dupe properties.. but let's ignore that for the time being.)\n \n // ok off we go.\n \n if (!e.dropNode) {\n // drag from palete..\n if (!e.source.dragData.selections.length) {\n e.cancel = true;\n return;\n }\n var drop_rec = e.source.dragData.selections[0];\n var drop_xtype = drop_rec.data.name;\n var ok_parents = drop_rec.json.parents;\n Roo.log(\"TEST PARENTS: \" + ok_parents.join(', '));\n var new_parent = this.nodeXtype((e.point == 'append') ? e.target.parentNode : e.target);\n Roo.log(\"NEW PARENT: \" + new_parent);\n \n // see if the new_parent is actually in the list of ok_parents\n e.cancel = true;\n Roo.each(ok_parents,function(n) {\n if (n == new_parent || n.split(':').shift() == new_parent) {\n e.cancel = false;\n return true;\n }\n });\n // done all the checks...\n return;\n \n }\n \n \n} \n "
48 "containerScroll": true,
49 "ddGroup": "component",
53 "|nodeXtype": "function(n) {\n if (!n) {return ''; }\n var xt = n.elConfig.xtype || '';\n var xns= n.elConfig['|xns'] || '';\n xns += xns.length ? '.' : '';\n return xns + xt;\n}\n",
54 "|appendNode": "function(parent, inConfig, markUndo) {\n \n \n \n var items = [];\n if (inConfig.items) { // loading!\n items = inConfig.items;\n delete inConfig.items;\n }\n var config = this.cloneConfig(inConfig);\n \n if (!parent) {\n\tparent = this.root;\n }\n \n \n //var canAppend = this.canAppend(parent,config);\n //if (canAppend !== true) {\n // console.log(\"Unable to add element \" + canAppend);\n //\tRoo.Msg.alert(\"Unable to add element\", canAppend);\n //\t\treturn false;\n //\t\t}\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 parent.appendChild(newNode);\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",
55 "|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",
56 "|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",
57 "|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",
58 "|currentNodeType": "function() {\n return this.nodeXtype(this.currentNode);\n \n}\n",
59 "|defaultElConfig": "function() {\n return {\n xtype : '*Module',\n \n module : 'TestApp',\n part: 'Partname',\n modkey : 0,\n region : 'center',\n parent : 'Pman',\n name : 'Module Name',\n items: [] \n };\n}\n",
60 "|loadBJS": "function(module, part) {\n var _t = this;\n new Pman.Request({\n url : baseURL + '/Roo/Builder_part.php',\n method : 'GET',\n params : {\n _id : part\n },\n success : function(res) \n {\n // data is in.. \n Roo.log(res);\n _t.loadTree(JSON.parse(res.data.json));\n \n \n },\n\n }) \n \n \n \n}\n",
61 "|loadTree": "function(o) {\n this.clearAll();\n this.root.elConfig = o;\n this.root.setText(this.configToText(this.root.elConfig));\n this.appendNode(this.root, o.items[0]);\n this.root.expand(true);\n Pman.Tab.BuilderView.panel.redraw();\n this.setCurrentNode(this.root,true);\n}\n",
62 "|renderer": "function(n) { return n.text; }",
63 "|setCurrentNode": "function(node,select) {\n this.currentNode = node || this.root;\n \n //Pman.Tab.BuilderView.highlightElement(this.currentNode);\n\n var p = Pman.Tab.BuilderProps.grid;\n if (p) { //may not be ready yet..\n p.setCurrrentNode(this.currentNode);\n }\n \n \n this.currentNode.setText(this.configToText(this.currentNode.elConfig));\n \n if (select) { //&& node !== this.tree.root) {\n if (this.currentNode !== this.root) {\n this.currentNode.ensureVisible();\n } \n this.currentNode.expand(false,false);\n this.currentNode.select();\n\t}\n\t// update palete..\n\tPman.Tab.BuilderPalette.grid.getSelectionModel().clearSelections();\n\tPman.Tab.BuilderPalette.grid.view.refresh();\n\n}\n",
68 "xtype": "DefaultSelectionModel",
75 "|elConfig": "function() {\n return {\n xtype : '*Module',\n \n app : 'TestApp',\n // perm\n // permtype\n modkey : 0,\n '|module' : '',\n region : 'center',\n '|parent' : 'Pman',\n name : \"Module Name\",\n items: [] \n\n \n }\n}\n",