php7 fixes
[Pman.Builder] / Pman.Tab.BuilderProps.bjs
index fd93295..c234013 100644 (file)
@@ -1,9 +1,9 @@
 {
-    "id": "roo-file-164",
+    "id": "roo-file-197",
     "name": "Pman.Tab.BuilderProps",
     "parent": "Pman.Tab.BuilderTree",
     "title": "Pman.Tab.BuilderProps",
-    "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderProps.bjs",
+    "path": "/home/edward/gitlive/Pman.Builder/Pman.Tab.BuilderProps.bjs",
     "items": [
         {
             "region": "south",
                     "listeners": {
                         "render": "function (grid)\n{\n    _this.grid = grid;\n}",
                         "afteredit": "function (e)\n{\n   // change this..\n   //this.currentNode.elConfig\n   \n   \n}",
-                        "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    _this.panel.menu.show(e.getTarget(), 'tr');\n}",
-                        "beforeedit": "function (e)\n{\n   Roo.log('beforeedit');\n   var key = e.record.data.name;\n   var val = e.record.data.value;\n   if (key.match(/^\\|/) || key.match(/^\\!/)) {\n        Pman.Dialog.BuilderSourceEdit.show( { value :  val }, function(d) {\n            _this.grid.currentNode.elConfig[key] = val;\n            _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);\n            _this.grid.fireEvent('propertychange', \n                Pman.Tab.BuilderProps.grid, false, val, false\n            );\n        });\n        e.cancel = true;\n        return;\n   }\n}",
-                        "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    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}"
+                        "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}",
+                        "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}",
+                        "propertychange": "function (grid, id, v, oldval)\n{\n    if (v == 'false') {\n        v = false;\n    }\n    if (v == 'true') {\n        v = true;\n    }\n    var ec = _this.grid.currentNode.elConfig;\n    \n    if (id[0] == '!') {\n        ec.listeners = ec.listeners || {};\n        ec.listeners[id.substring(1)] = v;\n        if (typeof(ec[id]) != 'undefined') {\n            delete ec[id];\n        }\n    } else { \n       ec[id] = v;\n    }\n\n    _this.grid.setSourceFromNode(ec);\n    \n    var bp = Pman.Tab.BuilderView.panel;\n    bp.redraw.defer(100,bp, [true]);\n    _this.grid.currentNode.setText(\n        Pman.Builder.Tree.configToText(ec)\n    );\n}",
+                        "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());\n    e.stopEvent()\n\n}"
                     },
                     "*prop": "grid",
                     "xtype": "PropertyGrid",
                     "items": [
                         {
                             "listeners": {
-                                "click": "function (_self, e)\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.currentNode);\n    var bp = Pman.Tab.BuilderView.panel;\n    bp.redraw.defer(100,bp, [true]);\n    // update the tree's  text\n    _this.currentNode.setText(\n        Pman.Tab.BuilderTree.tree.configToText(_this.currentNode.elConfig)\n    );\n}"
+                                "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        Roo.MesssageBox.alert(\"Error\", \"Error, you can not do this to listeners\");\n        return;\n    }\n     if (n[0] == '|') {\n        var val =  _this.grid.currentNode.elConfig[n];\n        delete _this.grid.currentNode.elConfig[n];\n        _this.grid.currentNode.elConfig[ n.substring(1)] = val;\n         \n     } else {\n        var val =  _this.grid.currentNode.elConfig[n];\n        delete _this.grid.currentNode.elConfig[n];\n        _this.grid.currentNode.elConfig['|'+ n] = val;\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.Builder.Tree.configToText(_this.grid.currentNode.elConfig)\n    );\n}"
+                            },
+                            "text": "Toggle property as Javascript",
+                            "xtype": "Item",
+                            "|xns": "Roo.menu"
+                        },
+                        {
+                            "|xns": "Roo.menu",
+                            "xtype": "Separator"
+                        },
+                        {
+                            "listeners": {
+                                "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        try{\n            delete _this.grid.currentNode.elConfig.listeners[n.substring(1)]; \n        }catch(err){\n            delete _this.grid.currentNode.elConfig[n];\n            Roo.log(err);\n        }\n        \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.Builder.Tree.configToText(_this.grid.currentNode.elConfig)\n    );\n}"
                             },
                             "text": "Delete Property / Event",
                             "xtype": "Item",
                             "|xns": "Roo.menu"
                         }
                     ]
+                },
+                {
+                    "*prop": "menu2",
+                    "xtype": "Menu",
+                    "|xns": "Roo.menu",
+                    "items": [
+                        {
+                            "listeners": {
+                                "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    var ec = _this.grid.currentNode.elConfig;\n\n    Pman.Dialog.BuilderProp.show({\n            xtype : ec.xtype  || '',\n            xns: ec['|xns'] || '',\n            list: 'props'\n    }, function (n,val) {\n        ec[n] = val || '';\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.Builder.Tree.configToText(_this.grid.currentNode.elConfig)\n        );\n    });\n}"
+                            },
+                            "text": "Add Property",
+                            "xtype": "Item",
+                            "|xns": "Roo.menu"
+                        },
+                        {
+                            "listeners": {
+                                "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    var ec = _this.grid.currentNode.elConfig;\n    Pman.Dialog.BuilderProp.show({\n            xtype : ec.xtype  || '',\n            xns: ec['|xns'] || '',\n            list: 'events'\n    }, function (n,val) {\n        n = '!|' + n;\n        ec[n] = val || \"function () {\\n\\n}\";\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.Builder.Tree.configToText(_this.grid.currentNode.elConfig)\n        );\n    });\n}"
+                            },
+                            "text": "Add Event Handler",
+                            "xtype": "Item",
+                            "|xns": "Roo.menu"
+                        },
+                        {
+                            "|xns": "Roo.menu",
+                            "xtype": "Separator"
+                        },
+                        {
+                            "listeners": {
+                                "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}"
+                            },
+                            "text": "Add User Defined Property",
+                            "xtype": "Item",
+                            "|xns": "Roo.menu"
+                        }
+                    ]
                 }
             ]
         }