1// Name: ReorderList.DraggableListItemBehavior.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.1.7.1213 4// FileVersion: 4.1.7.1213 5 6 7 8/// <reference name="MicrosoftAjax.debug.js" /> 9/// <reference name="MicrosoftAjaxTimer.debug.js" /> 10/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 11/// <reference path="../ExtenderBase/BaseScripts.js" /> 12/// <reference path="../Common/Common.js" /> 13 14 15Type.registerNamespace('Sys.Extended.UI'); 16 17Sys.Extended.UI.DraggableListItem = function(e) { 18 Sys.Extended.UI.DraggableListItem.initializeBase(this, [e]); 19 20 this._data = null; 21 22 this._handle = null; 23 this._dragVisualTemplate = null; 24 this._dragVisualTemplateInstance = null; 25 this._mouseDownHandler = null; 26} 27Sys.Extended.UI.DraggableListItem.prototype = { 28 29 30 31 dispose : function() { 32 /// <summary> 33 /// Dispose the behavior 34 /// </summary> 35 var e = this.get_element(); 36 37 38 this.set_handle(null); 39 40 Sys.Extended.UI.DraggableListItem.callBaseMethod(this, 'dispose'); 41 }, 42 43 get_data : function() { 44 if (this._data == null) { 45 var dragSource = this._findDragSource(); 46 if (dragSource != null && Sys.Extended.UI.DragDropList.IsValidDataType(dragSource.get_dragDataType())) { 47 return this.get_element(); 48 } 49 } 50 51 return this._data; 52 }, 53 54 set_data : function(value) { 55 if (this._data != value) { 56 this._data = value; 57 this.raisePropertyChanged('data'); 58 } 59 }, 60 61 get_handle : function() { 62 return this._handle; 63 }, 64 65 set_handle : function(value) { 66 if (this._handle != null) { 67 $removeHandler(this._handle, "mousedown", this.get_mouseDownHandler()); 68 this._handle.__draggableBehavior = null; 69 } 70 71 72 if (value) { 73 if (value.element) { 74 value = value.element; 75 } 76 this._handle = value; 77 this.raisePropertyChanged('handle'); 78 this._handle.__draggableBehavior = this; 79 80 $addHandler(this._handle, "mousedown", this.get_mouseDownHandler()); 81 this._handle.__draggableBehavior = this; 82 } 83 else { 84 this._handle = null; 85 } 86 }, 87 88 get_mouseDownHandler : function() { 89 if (this._mouseDownHandler == null) { 90 this._mouseDownHandler = Function.createDelegate(this, this._onMouseDown); 91 } 92 return this._mouseDownHandler; 93 }, 94 95 get_dragVisualTemplate : function() { 96 return this._dragVisualTemplate; 97 }, 98 99 set_dragVisualTemplate : function(value) { 100 if (this._dragVisualTemplate != value) { 101 this._dragVisualTemplate = value; 102 this.raisePropertyChanged('dragVisualTemplate'); 103 } 104 }, 105 106 107 _onMouseDown : function(ev) { 108 window._event = ev.rawEvent; 109 this._handle.__draggableBehavior._mouseDownHandlerInternal(ev); 110 }, 111 112 _mouseDownHandlerInternal : function(ev) { 113 var ev = window.testEvent ? window.testEvent : ev; 114 if (ev.button <= 1) { 115 var dragSource = this._findDragSource(); 116 if (dragSource != null) { 117 118 var dragVisual = this._createDragVisual(); 119 dragSource.startDragDrop(this.get_element(), this.get_data(), dragVisual); 120 ev.returnValue = false; 121 } 122 else { 123 124 } 125 } 126 else { 127 128 } 129 }, 130 131 _createDragVisual : function() { 132 var ev = window.testEvent ? window.testEvent : window.event; 133 if (this._dragVisualTemplate != null) { 134 if (this._dragVisualTemplateInstance == null) { 135 this._dragVisualTemplateInstance = this._dragVisualTemplate.cloneElement(); 136 } 137 else if (!Sys.UI.DragDropManager._getInstance().hasParent(this._dragVisualTemplateInstance)) {
138 this.get_element().appendChild(this._dragVisualTemplateInstance); 139 } 140 141 var location = { x: ev.clientX, y: ev.clientY }; 142 location = Sys.UI.DragDropManager._getInstance().addPoints(location, Sys.UI.DragDropManager._getInstance().getScrollOffset(document.body, true)); 143 $common.setLocation(this._dragVisualTemplateInstance, location); 144 } 145 return this._dragVisualTemplateInstance; 146 }, 147 148 _findDragSource : function() { 149 var element = this.get_element(); 150 while (element != null) { 151 if (element.__dragDropList != null) { 152 return element.__dragDropList; 153 } 154 element = element.parentNode; 155 } 156 return null; 157 } 158} 159Sys.Extended.UI.DraggableListItem.registerClass('Sys.Extended.UI.DraggableListItem', Sys.Extended.UI.BehaviorBase);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.