Pman.Tab.BuilderTree.bjs
authorAlan Knowles <alan@akbkhome.com>
Thu, 10 Feb 2011 15:10:13 +0000 (23:10 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 10 Feb 2011 15:10:13 +0000 (23:10 +0800)
Pman.Tab.BuilderTree.bjs

index 31158a1..ba650b6 100644 (file)
@@ -37,7 +37,7 @@
                             "items": [
                                 {
                                     "listeners": {
-                                        "beforenodedrop": "function (e)\n{\n    // nodedragover handles the allow/disallow..\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    var np = e.point == 'append' ? e.target : e.target.parentNode ; // new parent\n      \n    if (!e.tree || !e.dropNode) {\n    \n        // form palete...\n        var data  = e.source.dragData.selections[0].data;\n        var nar = data.name.split(':')\n        var xar = nar[0].split('.');\n\n        var cfg = {\n            '|xns' : xar.pop(),\n            'xtype' : xar.join('.')\n        };\n        if (nar.length > 1) {\n            cfg['*prop'] = nar[1];\n        }\n        // at this point it should of a set of options...\n        this.appendNode(e.target, cfg, e.point);\n     \n        return; // fixme drop of elements from palete..\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    // can append has to use palete...\n    // this code should be in nodedragover.\n    \n    Roo.log(\"move checks need moving\");\n    return;\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    Roo.log('can not drop ' + e.dropNode.elConfig.xtype + ' ontop of ' + np.elConfig.xtype);\n    \n    \n    \n    return false;\n                        \n\n}",
+                                        "beforenodedrop": "function (e)\n{\n    // nodedragover handles the allow/disallow..\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    var np = e.point == 'append' ? e.target : e.target.parentNode ; // new parent\n      \n    if (!e.tree || !e.dropNode) {\n    \n        // form palete...\n        var data  = e.source.dragData.selections[0].data;\n        var nar = data.name.split(':')\n        var xar = nar[0].split('.');\n\n        var cfg = {\n            '|xns' : xar.shift(),\n            'xtype' : xar.join('.')\n        };\n        if (nar.length > 1) {\n            cfg['*prop'] = nar[1];\n        }\n        // at this point it should of a set of options...\n        this.appendNode(e.target, cfg, e.point);\n     \n        return; // fixme drop of elements from palete..\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    // can append has to use palete...\n    // this code should be in nodedragover.\n    \n    Roo.log(\"move checks need moving\");\n    return;\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    Roo.log('can not drop ' + e.dropNode.elConfig.xtype + ' ontop of ' + np.elConfig.xtype);\n    \n    \n    \n    return false;\n                        \n\n}",
                                         "nodedrop": "function (e)\n{\n    \n    Roo.log(\"Node Drop\");\n    return;\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}",
                                         "click": "function (node, e)\n{\n      e.preventDefault();\n                       // console.log(e.button);\n        this.setCurrentNode(node);\n\n}",
                                         "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}",