{
- "id": "roo-file-190",
+ "id": "roo-file-200",
"name": "Pman.Tab.BuilderTree",
"parent": "Pman.Tab.BuilderTab",
"title": "Pman.Tab.BuilderTree",
- "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderTree.bjs",
+ "path": "/home/edward/gitlive/Pman.Builder/Pman.Tab.BuilderTree.bjs",
"items": [
{
"region": "west",
},
{
"listeners": {
- "activate": "function (_self)\n{\n \n _this.tree = _self.tree;\n _this.menu = _self.menu;\n\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}"
+ "activate": "function (_self)\n{\n \n _this.tree = _self.tree;\n _this.menu = _self.menu;\n\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}"
},
"region": "center",
"xtype": "TreePanel",
{
"listeners": {
"beforenodedrop": "function (e)\n{\n \n return Pman.Builder.Tree.handleDropNode(e); \n\n}",
- "click": "function (node, e)\n{\n e.preventDefault();\n // console.log(e.button);\n Pman.BuilderTree.setCurrentNode(node);\n \n \n \n\n}",
+ "click": "function (node, e)\n{\n e.preventDefault();\n // console.log(e.button);\n Pman.Builder.Tree.setCurrentNode(node);\n \n \n \n\n}",
"contextmenu": "function (node, e)\n{\n e.stopEvent();\n \n this.getSelectionModel().select(node);\n Pman.Builder.Tree.setCurrentNode(node);\n \n _this.menu = Roo.factory(_this.menu);\n\n _this.menu.show(node.ui.textNode, 'tr');\n return;\n \n /*\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}",
"nodedragover": "function (e)\n{\n \n return Pman.Builder.Tree.handleDragOver(e); \n \n \n \n} \n "
},
"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 console.log(\"APPEND NODE: \" + point); \n switch(point) {\n case 'above':\n parent.parentNode.insertBefore(newNode, parent);\n break;\n case 'below':\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",
- "|currentNodeType": "function() {\n return this.nodeXtype(this.currentNode);\n \n}\n",
- "|defaultElConfig": "function() {\n return {\n xtype : '*top',\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",
- "|deleteCurrent": "function() {\n if (this.currentNode == this.root) {\n return false;\n }\n var cfg = this.currentNode.elConfig;\n // things that can not be deleted...\n \n \n var pn = this.currentNode.parentNode;\n \n \n var ix = pn.indexOf(this.currentNode);\n // console.log(ix);\n pn.removeChild(this.currentNode);\n if (pn.childNodes.length) {\n ix = Math.min(pn.childNodes.length-1, ix);\n }\n this.setCurrentNode(pn.childNodes.length ? pn.childNodes[ix] : pn ,true);\n return true;\n}\n",
- "|dupeNode": " function(node)\n {\n var cfg = this.cloneConfig(node.elConfig);\n \n var newNode = new Roo.tree.TreeNode(\n {\n id: Roo.id(),\n text: this.configToText(cfg)\n });\n \n newNode.elConfig = cfg;\n node.eachChild(function(n) {\n newNode.appendChild(this.dupeNode(n));\n },this);\n \n return newNode;\n \n }",
- "|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 \n if (!res.data.json.length) {\n var cfg = _t.defaultElConfig();\n cfg.name = Pman.Tab.BuilderTop.filesel.lastData.name;\n cfg.part = Pman.Tab.BuilderTop.filesel.lastData.name;\n cfg.module = '';\n _t.loadTree(cfg);\n return;\n \n }\n \n _t.loadTree(JSON.parse(res.data.json));\n \n \n }\n\n }) \n \n \n \n}\n",
- "|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",
- "|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",
"|renderer": "function(n) { return n.text; }",
- "|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",
- "|toJS": " function(n)\n{\n if (!n) {\n return this.toJS(this.root);\n }\n var _this = this;\n var ret = this.cloneConfig(n.elConfig);\n if (n.childNodes.length) {\n ret.items = [];\n n.eachChild(function(cn) {\n ret.items.push(_this.toJS(cn));\n });\n \n }\n return ret;\n \n \n}",
"|xns": "Roo.tree",
"items": [
{
"items": [
{
"listeners": {
- "click": "function (_self)\n{\n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that node?\",\n function(r) {\n if (r!='yes') {\n return;\n }\n _this.tree.deleteCurrent();\n }\n );\n \n}"
+ "click": "function (_self)\n{\n \n var str = Pman.Builder.Tree.currentNodeType();\n if (typeof(Pman.Builder.Wizard[str]) == 'undefined') {\n Roo.MessageBox.alert(\"Sorry\", \"No wizard exists for \" + str);\n return;\n }\n var cn = Pman.Builder.Tree.currentNode;\n if (typeof(cn.elConfig['.builderCfg']) == 'undefined') {\n Roo.MessageBox.alert(\"Sorry\", \"No configuration exists for \" + str);\n return;\n }\n \n \n var cfg = Roo.decode(cn.elConfig['.builderCfg']);\n \n Roo.log(cfg);\n Pman.Dialog.BuilderAddTable.show( \n cfg, \n function(data) {\n\n \n var res = Pman.Builder.Wizard[str](data); // with old..\n Pman.Builder.Tree.replaceCurrentNode( res );\n Pman.Tab.BuilderView.panel.redraw();\n \n }\n );\n\n \n // otherwise, call back with template??\n \n \n \n \n}"
+ },
+ "text": "Edit Using Wizard",
+ "xtype": "Item",
+ "|xns": "Roo.menu"
+ },
+ {
+ "|xns": "Roo.menu",
+ "xtype": "Separator"
+ },
+ {
+ "listeners": {
+ "click": "function (_self)\n{\n \n \n Pman.Builder.Tree.collapseToggle();\n \n}"
+ },
+ "text": "Toggle Collapse",
+ "xtype": "Item",
+ "|xns": "Roo.menu"
+ },
+ {
+ "listeners": {
+ "click": "function (_self)\n{\n \n \n Pman.Builder.Tree.createSharedPart();\n \n}"
+ },
+ "text": "Create shared part from this node",
+ "xtype": "Item",
+ "|xns": "Roo.menu"
+ },
+ {
+ "|xns": "Roo.menu",
+ "xtype": "Separator"
+ },
+ {
+ "listeners": {
+ "click": "function (_self)\n{\n Roo.MessageBox.confirm(\"Confirm\", \"Are you sure you want to delete that node?\",\n function(r) {\n if (r!='yes') {\n return;\n }\n Pman.Builder.Tree.deleteCurrent();\n }\n );\n \n}"
},
"text": "Delete Node",
"xtype": "Item",