1// Name: UpdatePanelAnimation.UpdatePanelAnimationBehavior.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 4.1.7.1213 4// FileVersion: 4.1.7.1213 5// (c) 2010 CodePlex Foundation 6 7 8 9/// <reference name="MicrosoftAjax.debug.js" /> 10/// <reference name="MicrosoftAjaxTimer.debug.js" /> 11/// <reference name="MicrosoftAjaxWebForms.debug.js" /> 12/// <reference path="../ExtenderBase/BaseScripts.js" /> 13/// <reference path="../Compat/Timer/Timer.js" /> 14/// <reference path="../Common/Common.js" /> 15/// <reference path="../Animation/Animations.js" /> 16/// <reference path="../Animation/AnimationBehavior.js" /> 17 18 19Type.registerNamespace('Sys.Extended.UI.Animation'); 20 21Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior = function (element) { 22 /// <summary> 23 /// Play animations just before and just after an UpdatePanel updates 24 /// </summary> 25 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 26 /// UpdatePanel associated with the behavior 27 /// </param> 28 Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.initializeBase(this, [element]); 29 30 this._onUpdating = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 31 this._onUpdated = new Sys.Extended.UI.Animation.GenericAnimationBehavior(element); 32 33 this._postBackPending = null; 34 this._pageLoadedHandler = null; 35 this._AlwaysFinishOnUpdatingAnimation = null; 36}; 37Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.prototype = { 38 initialize: function () { 39 /// <summary> 40 /// Initialize the behavior 41 /// </summary> 42 Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this, 'initialize'); 43 44 var element = this.get_element(); 45 var parentDiv = document.createElement(element.tagName); 46 element.parentNode.insertBefore(parentDiv, element); 47 parentDiv.appendChild(element); 48 49 Array.remove(element._behaviors, this); 50 Array.remove(element._behaviors, this._onUpdating); 51 Array.remove(element._behaviors, this._onUpdated); 52 if (parentDiv._behaviors) { 53 Array.add(parentDiv._behaviors, this); 54 Array.add(parentDiv._behaviors, this._onUpdating); 55 Array.add(parentDiv._behaviors, this._onUpdated); 56 } else { 57 parentDiv._behaviors = [this, this._onUpdating, this._onUpdated]; 58 } 59 this._element = this._onUpdating._element = this._onUpdated._element = parentDiv; 60 61 this._onUpdating.initialize(); 62 this._onUpdated.initialize(); 63 64 this.registerPartialUpdateEvents(); 65 this._pageLoadedHandler = Function.createDelegate(this, this._pageLoaded); 66 this._pageRequestManager.add_pageLoaded(this._pageLoadedHandler); 67 }, 68 69 dispose: function () { 70 /// <summary> 71 /// Dispose the behavior 72 /// </summary> 73 74 if (this._pageRequestManager && this._pageLoadedHandler) { 75 this._pageRequestManager.remove_pageLoaded(this._pageLoadedHandler); 76 this._pageLoadedHandler = null; 77 } 78 79 Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this, 'dispose'); 80 }, 81 82 _partialUpdateBeginRequest: function (sender, beginRequestEventArgs) { 83 /// <summary> 84 /// Method that will be called when a partial update (via an UpdatePanel) begins, 85 /// if registerPartialUpdateEvents() has been called. 86 /// </summary> 87 /// <param name="sender" type="Object"> 88 /// Sender 89 /// </param> 90 /// <param name="beginRequestEventArgs" type="Sys.WebForms.BeginRequestEventArgs"> 91 /// Event arguments 92 /// </param> 93 Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.callBaseMethod(this, '_partialUpdateBeginRequest', [sender, beginRequestEventArgs]); 94 95 if (!this._postBackPending) { 96 this._postBackPending = true; 97 this._onUpdated.quit(); 98 this._onUpdating.play(); 99 } 100 }, 101 102 _pageLoaded: function (sender, args) { 103 /// <summary> 104 /// Method that will be called when a partial update (via an UpdatePanel) finishes 105 /// </summary> 106 /// <param name="sender" type="Object"> 107 /// Sender 108 /// </param> 109 /// <param name="args" type="Sys.WebForms.PageLoadedEventArgs"> 110 /// Event arguments 111 /// </param> 112 113 if (this._postBackPending) { 114 this._postBackPending = false; 115
116 var element = this.get_element(); 117 var panels = args.get_panelsUpdated(); 118 for (var i = 0; i < panels.length; i++) { 119 if (panels[i].parentNode == element) { 120 if (this._AlwaysFinishOnUpdatingAnimation) { 121 this._tryAndStopOnUpdating(); 122 } 123 else { 124 this._onUpdating.quit(); 125 this._onUpdated.play(); 126 } 127 break; 128 } 129 } 130 } 131 }, 132 133 _tryAndStopOnUpdating: function () { 134 if (this._onUpdating.get_animation().get_isPlaying()) { 135 var context = this; 136 window.setTimeout(function () { context._tryAndStopOnUpdating.apply(context); }, 200); 137 } 138 else { 139 this._onUpdating.quit(); 140 this._onUpdated.play(); 141 } 142 }, 143 144 get_OnUpdating: function () { 145 /// <value type="String"> 146 /// Generic OnUpdating Animation's JSON definition 147 /// </value> 148 return this._onUpdating.get_json(); 149 }, 150 set_OnUpdating: function (value) { 151 this._onUpdating.set_json(value); 152 this.raisePropertyChanged('OnUpdating'); 153 }, 154 155 get_OnUpdatingBehavior: function () { 156 /// <value type="Sys.Extended.UI.Animation.GenericAnimationBehavior"> 157 /// Generic OnUpdating Animation's behavior 158 /// </value> 159 return this._onUpdating; 160 }, 161 162 163 get_OnUpdated: function () { 164 /// <value type="String"> 165 /// Generic OnUpdated Animation's JSON definition 166 /// </value> 167 return this._onUpdated.get_json(); 168 }, 169 set_OnUpdated: function (value) { 170 this._onUpdated.set_json(value); 171 this.raisePropertyChanged('OnUpdated'); 172 }, 173 174 get_OnUpdatedBehavior: function () { 175 /// <value type="Sys.Extended.UI.Animation.GenericAnimationBehavior"> 176 /// Generic OnUpdated Animation's behavior 177 /// </value> 178 return this._onUpdated; 179 }, 180 181 get_AlwaysFinishOnUpdatingAnimation: function () { 182 /// <value type="Boolean"> 183 /// Indicates whether to always finish play the OnUpating animation before the 184 /// OnUpdated animation starts. 185 /// </value> 186 return this._AlwaysFinishOnUpdatingAnimation; 187 }, 188 set_AlwaysFinishOnUpdatingAnimation: function (value) { 189 if (this._AlwaysFinishOnUpdatingAnimation != value) { 190 this._AlwaysFinishOnUpdatingAnimation = value; 191 this.raisePropertyChanged('AlwaysFinishOnUpdatingAnimation'); 192 } 193 } 194}; 195Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior.registerClass('Sys.Extended.UI.Animation.UpdatePanelAnimationBehavior', 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.