4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
14 Roo.tree.TreeDragZone = function(tree, config){
15 Roo.tree.TreeDragZone.superclass.constructor.call(this, tree.getTreeEl(), config);
19 Roo.extend(Roo.tree.TreeDragZone, Roo.dd.DragZone, {
21 scroller : false, // 't' or 'b'
23 onBeforeDrag : function(data, e){
25 return n && n.draggable && !n.disabled;
28 onDragOut : function(e, id)
30 var ret = Roo.tree.TreeDragZone.superclass.constructor.prototype.onDragOut.call(this, e, id);
32 // if it's gone off top and bottom, start the scroller
36 if (this.scroller === false) {
37 Roo.log('start interval');
38 this.scroller = window.setInterval(
39 this.scrollAct.createDelegate(this),
48 onDragEnter : function(e, id)
50 var ret = Roo.tree.TreeDragZone.superclass.constructor.prototype.onDragEnter.call(this, e, id);
52 if (this.scroller !== false) {
53 window.clearInterval(this.scroller);
58 Roo.log('ondrageneter');
69 if (this.scrollDir === false) {
73 this.el.scroll(this.scrollDir, 1, false);
78 onInitDrag : function(e){
79 var data = this.dragData;
80 this.tree.getSelectionModel().select(data.node);
81 this.proxy.update("");
82 data.node.ui.appendDDGhost(this.proxy.ghost.dom);
83 this.tree.fireEvent("startdrag", this.tree, data.node, e);
86 getRepairXY : function(e, data){
87 return data.node.ui.getDDRepairXY();
90 onEndDrag : function(data, e){
91 this.tree.fireEvent("enddrag", this.tree, data.node, e);
94 onValidDrop : function(dd, e, id){
95 this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);
99 beforeInvalidDrop : function(e, id){
100 // this scrolls the original position back into view
101 var sm = this.tree.getSelectionModel();
102 sm.clearSelections();
103 sm.select(this.dragData.node);