1// Name: MutuallyExclusiveCheckBox.MutuallyExclusiveCheckBoxBehavior.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 3.5.7.1213 4// FileVersion: 3.5.7.1213 5// (c) 2010 CodePlex Foundation 6 7 8 9/// <reference name="MicrosoftAjax.debug.js" /> 10/// <reference path="../ExtenderBase/BaseScripts.js" /> 11/// <reference path="../Common/Common.js" /> 12 13(function() { 14var scriptName = "ExtendedMutuallyExclusiveCheckBox"; 15 16function execute() { 17 18Type.registerNamespace('Sys.Extended.UI'); 19 20Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior = function(element) { 21 /// <summary> 22 /// The MutuallyExclusiveCheckBoxBehavior allows only one checkbox in 23 /// a group with the same Key to be checked at a time 24 /// </summary> 25 /// <param name="element" type="Sys.UI.DomElement" domElement="true"> 26 /// The DOM Element the behavior is associated with 27 /// </param> 28 Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.initializeBase(this, [element]); 29 30 this._key = ""; 31 this._clickHandler = Function.createDelegate(this, this._onclick); 32} 33Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.prototype = { 34 initialize : function() { 35 /// <summary> 36 /// Initialize the behavior 37 /// </summary> 38 Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.callBaseMethod(this, 'initialize'); 39 $addHandler(this.get_element(), "click", this._clickHandler); 40 }, 41 42 dispose : function() { 43 /// <summary> 44 /// Dispose the behavior 45 /// </summary> 46 if (this._key) { 47 var keys = Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.Keys; 48 var ar = keys[this._key]; 49 Array.remove(ar, this); 50 this._key = null; 51 } 52 if (this._clickHandler) { 53 $removeHandler(this.get_element(), "click", this._clickHandler); 54 this._clickHandler = null; 55 } 56 Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.callBaseMethod(this, 'dispose'); 57 }, 58 59 get_Key : function() { 60 /// <value type="String"> 61 /// The unique key to use to associate checkboxes. This key does not respect INamingContainer renaming. 62 /// </value> 63 return this._key; 64 }, 65 set_Key : function(value) { 66 var keys = Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.Keys; 67 if(value != this._key) { 68 if(this._key) { 69 var ar = keys[this._key]; 70 Array.remove(ar, this._key); 71 } 72 this._key = value; 73 if(value) { 74 var ar = keys[this._key]; 75 if(ar == null) { 76 ar = keys[this._key] = []; 77 } 78 Array.add(ar, this); 79 } 80 } 81 }, 82 83 _onclick : function() { 84 /// <summary> 85 /// Click handler used to ensure only one checkbox in its key is checked 86 /// </summary> 87 var element = this.get_element(); 88 var keys = Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.Keys; 89 if(this._key && element.checked) { 90 var ar = keys[this._key]; 91 var t = this; 92 Array.forEach(ar, function(b) { 93 /// <summary> 94 /// Uncheck all other checkboxes in the same key group 95 /// </summary> 96 /// <param name="b" type="Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior"> 97 /// Checkbox in the same key group 98 /// </param> 99 if(b != t) { 100 b.get_element().checked = false; 101 $common.tryFireEvent(b.get_element(), "change"); 102 } 103 }); 104 } 105 106 this.raiseChecked(new Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs(element, this._key)); 107 }, 108 109 add_checked : function(handler) { 110 /// <summary> 111 /// Add an event handler for the checked event 112 /// </summary> 113 /// <param name="handler" type="Function" mayBeNull="false"> 114 /// Event handler 115 /// </param> 116 /// <returns /> 117 this.get_events().addHandler('checked', handler); 118 }, 119 remove_checked : function(handler) { 120 /// <summary> 121 /// Remove an event handler from the checked event 122 /// </summary> 123 /// <param name="handler" type="Function" mayBeNull="false"> 124 /// Event handler 125 /// </param> 126 /// <returns /> 127 this.get_events().removeHandler('checked', handler); 128 }, 129 raiseChecked : function(eventArgs) { 130 /// <summary> 131 /// Raise the checked event 132 /// </summary> 133 /// <param name="eventArgs" type="Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs" mayBeNull="false"> 134 /// Event arguments for the checked event 135 /// </param> 136 /// <returns /> 137 138 var handler = this.get_events().getHandler('checked'); 139 if (handler) { 140 handler(this, eventArgs); 141 } 142 } 143} 144Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.registerClass('Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior', Sys.Extended.UI.BehaviorBase); 145Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior.Keys = {}; 146Sys.registerComponent(Sys.Extended.UI.MutuallyExclusiveCheckBoxBehavior, { name: "mutuallyExclusiveCheckBox", parameters: ["Key"] }); 147 148Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs = function(checkbox, key) { 149 /// <summary> 150 /// Event arguments used when the checked event is raised 151 /// </summary> 152 /// <param name="checkbox" type="Sys.UI.DomElement" mayBeNull="False" isDomElement="true"> 153 /// Checkbox that was checked or unchecked 154 /// </param> 155 /// <param name="key" type="String" mayBeNull="False"> 156 /// The unique key used to associate checkboxes 157 /// </param> 158 Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs.initializeBase(this); 159 160 this._key = key; 161 this._checkbox = checkbox; 162} 163Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs.prototype = { 164 get_checkbox : function() { 165 /// <value type="Sys.UI.DomElement" mayBeNull="False"> 166 /// Checkbox that was checked or unchecked 167 /// </value> 168 return this._checkbox; 169 }, 170 171 get_key : function() { 172 /// <value type="String" mayBeNull="False"> 173 /// The unique key used to associate checkboxes 174 /// </value> 175 return this._key; 176 } 177} 178Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs.registerClass('Sys.Extended.UI.MutuallyExclusiveCheckBoxEventArgs', Sys.EventArgs); 179 180} // execute 181 182if (window.Sys && Sys.loader) { 183 Sys.loader.registerScript(scriptName, ["ExtendedBase", "ExtendedCommon"], execute); 184} 185else { 186 execute(); 187} 188 189})();
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.