3 <title>The source code</title>
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7 <body onload="prettyPrint();">
8 <pre class="prettyprint lang-js">/*!
10 * Copyright(c) 2006-2009 Ext JS, LLC
12 * http://www.extjs.com/license
14 <div id="cls-Ext.tree.TreeDragZone"></div>/**
\r
15 * @class Ext.tree.TreeDragZone
\r
16 * @extends Ext.dd.DragZone
\r
18 * @param {String/HTMLElement/Element} tree The {@link Ext.tree.TreePanel} for which to enable dragging
\r
19 * @param {Object} config
\r
21 if(Ext.dd.DragZone){
\r
22 Ext.tree.TreeDragZone = function(tree, config){
\r
23 Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.innerCt, config);
\r
24 <div id="prop-Ext.tree.TreeDragZone-tree"></div>/**
\r
25 * The TreePanel for this drag zone
\r
26 * @type Ext.tree.TreePanel
\r
32 Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {
\r
33 <div id="cfg-Ext.tree.TreeDragZone-ddGroup"></div>/**
\r
34 * @cfg {String} ddGroup
\r
35 * A named drag drop group to which this object belongs. If a group is specified, then this object will only
\r
36 * interact with other drag drop objects in the same group (defaults to 'TreeDD').
\r
41 onBeforeDrag : function(data, e){
\r
43 return n && n.draggable && !n.disabled;
\r
47 onInitDrag : function(e){
\r
48 var data = this.dragData;
\r
49 this.tree.getSelectionModel().select(data.node);
\r
50 this.tree.eventModel.disable();
\r
51 this.proxy.update("");
\r
52 data.node.ui.appendDDGhost(this.proxy.ghost.dom);
\r
53 this.tree.fireEvent("startdrag", this.tree, data.node, e);
\r
57 getRepairXY : function(e, data){
\r
58 return data.node.ui.getDDRepairXY();
\r
62 onEndDrag : function(data, e){
\r
63 this.tree.eventModel.enable.defer(100, this.tree.eventModel);
\r
64 this.tree.fireEvent("enddrag", this.tree, data.node, e);
\r
68 onValidDrop : function(dd, e, id){
\r
69 this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);
\r
74 beforeInvalidDrop : function(e, id){
\r
75 // this scrolls the original position back into view
\r
76 var sm = this.tree.getSelectionModel();
\r
77 sm.clearSelections();
\r
78 sm.select(this.dragData.node);
\r
82 afterRepair : function(){
\r
83 if (Ext.enableFx && this.tree.hlDrop) {
\r
84 Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");
\r
86 this.dragging = false;
\r