1Sys.Extended.UI.FloatingBehavior = function(element) { 2 Sys.Extended.UI.FloatingBehavior.initializeBase(this, [element]); 3 4 var _handle, 5 _location, 6 _dragStartLocation, 7 _profileProperty, 8 _profileComponent; 9 10 var _mouseDownHandler = Function.createDelegate(this, mouseDownHandler); 11 12 ///<summary> 13 /// Move event handler. 14 ///</summary> 15 ///<member name="cE:AjaxControlToolkit.DragPanelExtender.move" /> 16 ///<event add="add_move" remove="remove_move" /> 17 this.add_move = function(handler) { 18 this.get_events().addHandler('move', handler); 19 } 20 this.remove_move = function(handler) { 21 this.get_events().removeHandler('move', handler); 22 } 23 24 ///<summary> 25 /// Handles to drag the panel around. 26 ///</summary> 27 ///<getter>get_handle</getter> 28 ///<setter>set_handle</setter> 29 ///<member name="cP:AjaxControlToolkit.DragPanelExtender.handle" /> 30 this.get_handle = function() { 31 return _handle; 32 } 33 this.set_handle = function(value) { 34 if(_handle != null) 35 $removeHandler(_handle, "mousedown", _mouseDownHandler); 36 37 _handle = value; 38 $addHandler(_handle, "mousedown", _mouseDownHandler); 39 } 40 41 this.get_profileProperty = function() { 42 return _profileProperty; 43 } 44 this.set_profileProperty = function(value) { 45 _profileProperty = value; 46 } 47 48 this.get_profileComponent = function() { 49 return _profileComponent; 50 } 51 this.set_profileComponent = function(value) { 52 _profileComponent = value; 53 } 54 55 ///<summary> 56 /// Defines the location of an element being dragged. 57 ///</summary> 58 ///<getter>get_location</getter> 59 ///<setter>set_location</setter> 60 ///<member name="cP:AjaxControlToolkit.DragPanelExtender.location" /> 61 this.get_location = function() { 62 return _location; 63 } 64 this.set_location = function(value) { 65 if(_location != value) { 66 _location = value; 67 68 if(this.get_isInitialized()) 69 $common.setLocation(this.get_element(), _location); 70 71 this.raisePropertyChanged('location'); 72 } 73 } 74 75 this.initialize = function() { 76 Sys.Extended.UI.FloatingBehavior.callBaseMethod(this, 'initialize'); 77 Sys.Extended.UI.DragDropManager.registerDropTarget(this); 78 79 var el = this.get_element(); 80 81 if(!_location) 82 _location = $common.getLocation(el); 83 84 el.style.position = "fixed"; 85 $common.setLocation(el, _location); 86 } 87 88 this.dispose = function() { 89 Sys.Extended.UI.DragDropManager.unregisterDropTarget(this); 90 if(_handle && _mouseDownHandler) 91 $removeHandler(_handle, "mousedown", _mouseDownHandler); 92 93 _mouseDownHandler = null; 94 Sys.Extended.UI.FloatingBehavior.callBaseMethod(this, 'dispose'); 95 } 96 97 this.checkCanDrag = function(element) { 98 var undraggableTagNames = ["input", "button", "select", "textarea", "label"], 99 tagName = element.tagName; 100 101 if((tagName.toLowerCase() == "a") && (element.href != null) && (element.href.length > 0)) 102 return false; 103 104 if(Array.indexOf(undraggableTagNames, tagName.toLowerCase()) > -1) 105 return false; 106 107 return true; 108 } 109 110 function mouseDownHandler(ev) { 111 window._event = ev; 112 var el = this.get_element(); 113 114 if(this.checkCanDrag(ev.target)) { 115 _dragStartLocation = $common.getLocation(el); 116 117 ev.preventDefault(); 118 119 this.startDragDrop(el); 120 } 121 } 122 123 // Type get_dataType() 124 this.get_dragDataType = function() { 125 return "_floatingObject"; 126 } 127 128 // Object get_data(Context) 129 this.getDragData = function(context) { 130 return null; 131 } 132 133 // DragMode get_dragMode() 134 this.get_dragMode = function() { 135 return Sys.Extended.UI.DragMode.Move; 136 } 137 138 // void onDragStart() 139 this.onDragStart = function() { } 140 141 // void onDrag() 142 this.onDrag = function() { } 143 144 this.onDragEnd = function(canceled) { 145 if(!canceled) { 146 var handler = this.get_events().getHandler('move'); 147 148 if(handler) { 149 var cancelArgs = new Sys.CancelEventArgs(); 150 151 handler(this, cancelArgs); 152 canceled = cancelArgs.get_cancel(); 153 } 154 } 155
156 var el = this.get_element(); 157 if(canceled) { 158 // Restore the position of the control. 159 $common.setLocation(el, _dragStartLocation); 160 } else { 161 _location = $common.getLocation(el); 162 this.raisePropertyChanged('location'); 163 } 164 } 165 166 this.startDragDrop = function(dragVisual) { 167 Sys.Extended.UI.DragDropManager.startDragDrop(this, dragVisual, null); 168 } 169 170 this.get_dropTargetElement = function() { 171 return document.body; 172 } 173 174 // bool canDrop(DragMode, DataType, Data) 175 this.canDrop = function(dragMode, dataType, data) { 176 return (dataType == "_floatingObject"); 177 } 178 179 // void drop(DragMode, DataType, Data) 180 this.drop = function(dragMode, dataType, data) { } 181 182 // void onDragEnterTarget(DragMode, DataType, Data) 183 this.onDragEnterTarget = function(dragMode, dataType, data) { } 184 185 // void onDragLeaveTarget(DragMode, DataType, Data) 186 this.onDragLeaveTarget = function(dragMode, dataType, data) { } 187 188 // void onDragInTarget(DragMode, DataType, Data) 189 this.onDragInTarget = function(dragMode, dataType, data) { } 190} 191 192Sys.Extended.UI.FloatingBehavior.registerClass('Sys.Extended.UI.FloatingBehavior', Sys.Extended.UI.BehaviorBase, Sys.Extended.UI.IDragSource, Sys.Extended.UI.IDropTarget, Sys.IDisposable);
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.