Pman.Tab.BuilderProps.bjs
[Pman.Builder] / Pman.Tab.BuilderProps.bjs
1 {
2     "id": "roo-file-4",
3     "name": "Pman.Tab.BuilderProps",
4     "parent": "Pman.Tab.BuilderTree",
5     "title": "Pman.Tab.BuilderProps",
6     "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderProps.bjs",
7     "items": [
8         {
9             "region": "south",
10             "xtype": "GridPanel",
11             "|xns": "Roo",
12             "items": [
13                 {
14                     "listeners": {
15                         "render": "function (grid)\n{\n    _this.grid = grid;\n}",
16                         "afteredit": "function (e)\n{\n   // change this..\n   //this.currentNode.elConfig\n   \n   \n}",
17                         "cellclick": "function (_self, rowIndex, ci, e)\n{\n     if (ci != 0) {\n        return;\n    }\n    //console.log(e);\n    // click on left col..\n    // show menu..\n    // make sure it's initialized..\n    _this.panel.menu = Roo.factory(_this.panel.menu);\n    \n    _this.panel.menu.show(e.getTarget(), 'tr');\n}",
18                         "beforeedit": "function (e)\n{\n   Roo.log('beforeedit');\n   Roo.log(e.record.data);\n   var key = e.record.data.name;\n   var val = e.record.data.value;\n   // source code edit..\n   if (key.match(/^\\|/) || key.match(/^\\!/)) {\n        Pman.Dialog.BuilderSourceEdit.show( { value :  val }, function(d) {\n            // perhaps we should eval it..\n        \n            _this.grid.currentNode.elConfig[key] = d.value;\n            _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);\n            _this.grid.fireEvent('propertychange', \n                Pman.Tab.BuilderProps.grid, key, d.value, false\n            );\n        });\n        e.cancel = true;\n        return;\n   }\n}",
19                         "propertychange": "function (grid, id, v, oldval)\n{\n    if (v == 'false') {\n        v = false;\n    }\n    if (v == 'true') {\n        v = true;\n    }\n    _this.grid.currentNode.elConfig[id] = v;\n    _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);\n    \n    var bp = Pman.Tab.BuilderView.panel;\n    bp.redraw.defer(100,bp, [true]);\n    _this.grid.currentNode.setText(\n        Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)\n    );\n}",
20                         "click": "function (e)\n{\n\n}",
21                         "contextmenu": "function (e)\n{\n    // should we check e..??\n    _this.panel.menu2 = Roo.factory(_this.panel.menu2);\n    \n    _this.panel.menu2.show(e.getTarget(), 'tr');\n}"
22                     },
23                     "*prop": "grid",
24                     "xtype": "PropertyGrid",
25                     "|setCurrrentNode": "function(node) {\n   \n    \n    this.view.el.unmask();\n    \n    if (!node || !node.elConfig) {\n        this.currentNode = false;\n        this.setSourceFromNode({});\n        this.view.el.mask('select a node');\n    } else {\n        this.currentNode = node;\n        this.setSourceFromNode(this.currentNode.elConfig);\n        \n    }\n    \n}\n",
26                     "|setSourceFromNode": "function(config) {\n   \n        \n    var cfg = {};\n    for (var k in config) {\n        //if (k.charAt(0) == '*') {\n        //    continue; // dont show props..\n        //}\n        \n        if (k  == 'listeners') {\n            for (var kk in config[k]) {\n                cfg['!' + kk ] = config[k][kk];\n            }\n            \n            continue;\n        }\n        if (k  == 'items') {\n            continue;\n        }\n        \n        if (typeof config[k] == 'object') {\n            \n            try {\n                var ec = Roo.encode(config[k]);\n                cfg[k] = ec;\n            } catch(e) {}\n            continue;\n        }\n        cfg[k] = config[k];\n    }\n    \n    if (!cfg.xtype) {\n        return;\n    }\n\n    this.setSource(cfg);\n\n    \n      \n}\n",
27                     "|xns": "Roo.grid"
28                 },
29                 {
30                     "|xns": "Roo.menu",
31                     "xtype": "Menu",
32                     "*prop": "menu",
33                     "items": [
34                         {
35                             "listeners": {
36                                 "click": "function (_self, e)\n{\n \n     var rc = _this.grid.getSelectionModel().getSelectedCell();\n     var n = _this.grid.getDataSource().getAt(rc[0]).data.name;\n     if (n == 'xtype') {\n        return;\n    }\n    if (n[0] == '!') {\n        delete _this.grid.currentNode.elConfig.listeners[n.substring(1)];\n    } else {\n        delete _this.grid.currentNode.elConfig[n];\n    }\n    // reloads      \n    _this.grid.setCurrrentNode(_this.grid.currentNode);\n    var bp = Pman.Tab.BuilderView.panel;\n    bp.redraw.defer(100,bp, [true]);\n    // update the tree's  text\n    _this.grid.currentNode.setText(\n        Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)\n    );\n}"
37                             },
38                             "text": "Delete Property / Event",
39                             "xtype": "Item",
40                             "|xns": "Roo.menu"
41                         }
42                     ]
43                 },
44                 {
45                     "*prop": "menu2",
46                     "xtype": "Menu",
47                     "|xns": "Roo.menu",
48                     "items": [
49                         {
50                             "listeners": {
51                                 "click": "function (_self, e)\n{\n \n    // show a dialog to select property??\n    // or should we add a line and get clever with pulldowns..\n}"
52                             },
53                             "text": "Add Property",
54                             "xtype": "Item",
55                             "|xns": "Roo.menu"
56                         },
57                         {
58                             "listeners": {
59                                 "click": "function (_self, e)\n{\n \n    // show a dialog to select property??\n    // or should we add a line and get clever with pulldowns..\n}"
60                             },
61                             "text": "Add Property",
62                             "xtype": "Item",
63                             "|xns": "Roo.menu"
64                         }
65                     ]
66                 }
67             ]
68         }
69     ],
70     "permname": "",
71     "modOrder": "001"
72 }