Pman.Tab.BuilderTree.bjs
[Pman.Builder] / Pman.Tab.BuilderTree.bjs
1 {
2     "id": "roo-file-95",
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",
7     "items": [
8         {
9             "region": "west",
10             "xtype": "NestedLayoutPanel",
11             "|xns": "Roo",
12             "items": [
13                 {
14                     "|xns": "Roo",
15                     "xtype": "BorderLayout",
16                     "*prop": "layout",
17                     "items": [
18                         {
19                             "|xns": "Roo",
20                             "xtype": "LayoutRegion",
21                             "*prop": "center"
22                         },
23                         {
24                             "*prop": "south",
25                             "height": 300,
26                             "split": true,
27                             "xtype": "LayoutRegion",
28                             "|xns": "Roo"
29                         },
30                         {
31                             "listeners": {
32                                 "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}"
33                             },
34                             "region": "center",
35                             "xtype": "TreePanel",
36                             "|xns": "Roo",
37                             "items": [
38                                 {
39                                     "listeners": {
40                                         "beforenodedrop": "function (e)\n{\n    \n    return Pman.Builder.Tree.handleDropNode(e);      \n\n}",
41                                         "click": "function (node, e)\n{\n      e.preventDefault();\n                       // console.log(e.button);\n        Pman.BuilderTree.setCurrentNode(node);\n        \n    \n        \n\n}",
42                                         "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}",
43                                         "nodedragover": "function (e)\n{\n    \n        return Pman.Builder.Tree.handleDragOver(e);      \n \n     \n   \n}   \n    "
44                                     },
45                                     "*prop": "tree",
46                                     "animate": false,
47                                     "containerScroll": true,
48                                     "ddGroup": "component",
49                                     "enableDD": true,
50                                     "rootVisible": true,
51                                     "xtype": "TreePanel",
52                                     "|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    }",
53                                     "|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",
54                                     "|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",
55                                     "|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",
56                                     "|renderer": "function(n) { return n.text; }",
57                                     "|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",
58                                     "|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}",
59                                     "|xns": "Roo.tree",
60                                     "items": [
61                                         {
62                                             "|xns": "Roo.tree",
63                                             "xtype": "DefaultSelectionModel",
64                                             "*prop": "sm"
65                                         },
66                                         {
67                                             "*prop": "root",
68                                             "text": "Part",
69                                             "xtype": "TreeNode",
70                                             "|elConfig": "function() {\n    return  {\n         xtype : '*top',\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",
71                                             "|xns": "Roo.tree"
72                                         }
73                                     ]
74                                 },
75                                 {
76                                     "|xns": "Roo.menu",
77                                     "xtype": "Menu",
78                                     "*prop": "menu",
79                                     "items": [
80                                         {
81                                             "listeners": {
82                                                 "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}"
83                                             },
84                                             "text": "Delete Node",
85                                             "xtype": "Item",
86                                             "|xns": "Roo.menu"
87                                         },
88                                         {
89                                             "text": "Save as template",
90                                             "xtype": "Item",
91                                             "|xns": "Roo.menu"
92                                         }
93                                     ]
94                                 }
95                             ]
96                         }
97                     ]
98                 }
99             ]
100         }
101     ],
102     "permname": "",
103     "modOrder": "001"
104 }