Pman.Tab.BuilderTree.bjs
authorAlan Knowles <alan@akbkhome.com>
Tue, 25 Oct 2011 07:28:42 +0000 (15:28 +0800)
committerAlan Knowles <alan@akbkhome.com>
Tue, 25 Oct 2011 07:28:42 +0000 (15:28 +0800)
Pman.Tab.BuilderTree.bjs
Pman.Tab.BuilderTree.js
Pman.Tab.BuilderTree.js

Pman.Tab.BuilderTree.bjs
Pman.Tab.BuilderTree.js

index 9d598eb..3b3fef4 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\n        var xar = data.name.split('.');\n\n        var cfg = {\n            'xtype' : xar.pop(),\n            '|xns' : xar.join('.')\n            \n        };\n        if (_this.dragProp.length > 1) {\n            cfg['*prop'] = _this.dragProp;\n        }\n        // at this point it should of a set of options...\n        \n        Pman.Dialog.BuilderAdd.show( cfg , function(fdata ) {\n\n        \n            this.appendNode(e.target, cfg, e.point);\n             Pman.Tab.BuilderView.panel.redraw();\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\n        var xar = data.name.split('.');\n\n        var cfg = {\n            'xtype' : xar.pop(),\n            '|xns' : xar.join('.')\n            \n        };\n        if (_this.dragProp.length > 1) {\n            cfg['*prop'] = _this.dragProp;\n        }\n        // at this point it should of a set of options...\n         var cls = cfg['|ns'] + '.' + cfg['xtype'];\n            \n\n        if (typeof(Pman.Builder[cls]) != 'undefined') {\n            Pman.Dialog.BuilderAdd.show( cfg , function(fdata ) {\n\n            \n                this.appendNode(e.target, cfg, e.point);\n                 Pman.Tab.BuilderView.panel.redraw();\n             })\n         } else {\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    \n        \n\n}",
                                         "contextmenu": "function (node, e)\n{\n    e.stopEvent();\n        \n        this.getSelectionModel().select(node);\n         this.setCurrentNode(node);\n         \n              _this.menu = Roo.factory(_this.menu);\n    \n            _this.menu.show(node.ui.textNode, 'tr');\n         return;\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}",
index 5fddc2e..9622d28 100644 (file)
@@ -96,13 +96,19 @@ Pman.Tab.BuilderTree = new Roo.util.Observable({
                                             cfg['*prop'] = _this.dragProp;
                                         }
                                         // at this point it should of a set of options...
-                                        
-                                        Pman.Dialog.BuilderAdd.show( cfg , function(fdata ) {
+                                         var cls = cfg['|ns'] + '.' + cfg['xtype'];
+                                            
                                 
-                                        
-                                            this.appendNode(e.target, cfg, e.point);
-                                             Pman.Tab.BuilderView.panel.redraw();
-                                         })
+                                        if (typeof(Pman.Builder[cls]) != 'undefined') {
+                                            Pman.Dialog.BuilderAdd.show( cfg , function(fdata ) {
+                                
+                                            
+                                                this.appendNode(e.target, cfg, e.point);
+                                                 Pman.Tab.BuilderView.panel.redraw();
+                                             })
+                                         } else {
+                                             this.appendNode(e.target, cfg, e.point);
+                                         }
                                         return; // fixme drop of elements from palete..
                                     }