PageSourceSearch

https://atomium.be/DXR.axd?r=1_188-SfFRl

js atomium.be collected 2026-10-02 03:00:28 UTC 12,667 bytes, 347 lines download raw bytes

1(function() {
2var CheckBoxValidStateMode = {
3 Checked: "Checked",
4 CheckedAndUnchecked: "CheckedAndUnchecked"
5};
6var CheckBoxRequiredValidationPattern = ASPx.CreateClass(ASPx.ValidationPattern, {
7 constructor: function(checkBox, errorText) {
8  this.constructor.prototype.constructor.call(this, errorText);
9  this.checkBox = checkBox;
10 },
11 EvaluateIsValid: function(value) {
12  var checkState = this.checkBox.GetCheckState();
13  if(this.checkBox.validStateMode === CheckBoxValidStateMode.Checked)
14   return checkState === ASPx.CheckBoxCheckState.Checked;
15  else
16   return checkState !== ASPx.CheckBoxCheckState.Indeterminate;
17 },
18});
19var ASPxClientCheckBox = ASPx.CreateClass(ASPxClientEdit, {
20 constructor: function(name) {
21  this.constructor.prototype.constructor.call(this, name);
22  this.isASPxClientCheckEdit = true;
23  this.valueChecked = true;
24  this.valueUnchecked = false;
25  this.valueGrayed = null;
26  this.allowGrayed = false;
27  this.isNative = false;
28  this.stateController = null;
29  this.imageProperties = null;
30  this.allowGrayedByClick = true;
31  this.displaySwitch = false;
32  this.internalCheckBox = null;
33  this.icbFocusedStyle = [];
34  this.sizingConfig.allowSetWidth = false;
35  this.sizingConfig.allowSetHeight = false;
36  this.isRequiredCheckBox = false;
37  this.requiredCheckBoxErrorText = "*";
38  this.validStateMode = CheckBoxValidStateMode.Checked;
39  this.CheckedChanged = new ASPxClientEvent();
40 },
41 InlineInitialize: function() {
42  this.isNative = !this.imageProperties;
43  this.allowGrayed = this.IsGrayedAllowed();
44  this.stateController = ASPx.CheckableElementStateController.Create(this.imageProperties, this.valueChecked,  this.valueUnchecked, this.valueGrayed, this.allowGrayed);
45  if(!this.isNative)
46   this.CreateInternalCheckBox();
47  if(this.isRequiredCheckBox)
48   this.validationPatterns.push(new CheckBoxRequiredValidationPattern(this, this.requiredCheckBoxErrorText));
49  ASPxClientEdit.prototype.InlineInitialize.call(this);
50 },
51 Initialize: function() {
52  ASPxClientEdit.prototype.Initialize.call(this);
53  if(!ASPx.IsExistsElement(this.GetMainElement()))
54   return;
55  if(!this.isNative) {
56   this.previousValue = this.GetStateInput().value;
57   if(this.GetValue() !== null)
58    this.UpdateInternalCheckState(); 
59   this.SetValue(this.GetValue());
60  }
61  else
62   this.previousValue = this.GetInputElement().checked;
63 },
64 UpdateInternalCheckState: function() {
65  var stateInput = this.GetStateInput();
66  stateInput.value = this.stateController.GetInputKeyByValue(true);
67  stateInput.value = this.stateController.GetInputKeyByValue(false);
68  var checkState = this.stateController.GetCheckStateByInputKey(this.previousValue);
69  this.SetCheckState(checkState);
70 },
71 GetInputElement: function() {
72  if(this.isNative)
73   return ASPxClientEdit.prototype.GetInputElement.call(this);
74  else
75   return this.GetStateInput();
76 },
77 CreateInternalCheckBox: function() {
78  var instance = this;
79  this.internalCheckBox = new ASPx.CheckBoxInternal(this.GetStateInput(), this.stateController, this.allowGrayed, this.allowGrayedByClick, 
80   ASPx.CheckEditElementHelper.Instance, this.GetMainElement(), true, undefined, undefined, this.accessibilityCompliant, this.displaySwitch);
81  this.internalCheckBox.CreateFocusDecoration(this.icbFocusedStyle);
82  this.internalCheckBox.SetValue(this.GetValue(), true); 
83  this.internalCheckBox.SetEnabled(this.GetEnabled());
84  this.internalCheckBox.GetReadOnly = this.GetReadOnly.bind(this);
85  this.internalCheckBox.CheckedChanged.AddHandler(function(s, e) { instance.OnClick(e); });
86  this.internalCheckBox.Focus.AddHandler(function() { instance.OnFocus(); });
87  this.internalCheckBox.LostFocus.AddHandler(function() { instance.OnLostFocus(); });
88  if(ASPx.Browser.WebKitFamily) 
89   ASPx.Evt.AttachEventToElement(this.internalCheckBox.mainElement.parentNode, "selectstart", ASPx.Evt.PreventEventAndBubble);
90 },
91 FindInputElement: function() {
92  var element = this.GetMainElement();
93  if(ASPx.IsExistsElement(element) && element.tagName != "INPUT")
94   element = this.GetChildElement("I");
95  return element;
96 },
97 GetFocusableInputElement: function() {
98  return this.accessibilityCompliant ? this.GetICBMainElement() : this.GetInputElement();
99 },
100 IsGrayedAllowed: function() {
101  for(var propertyKey in this.imageProperties)
102   if(this.imageProperties[propertyKey].length === 3)
103    return true;
104  return false;
105 },
106 RaiseValueChangedEvent: function() {
107  var processOnServer = ASPxClientEdit.prototype.RaiseValueChangedEvent.call(this);
108  processOnServer = this.RaiseCheckedChanged(processOnServer);
109  return processOnServer;
110 }, 
111 OnClick: function() {
112  if(this.ToogleCheckState() && !this.focused)
113   this.SetFocus();
114 },  
115 ToogleCheckState: function() {
116  if(!this.GetEnabled() || this.GetReadOnly())
117   return false;
118  var value = this.GetCorrectValue(this.previousValue);
119  value = this.stateController.GetNextCheckBoxValue(value, this.allowGrayedByClick && this.allowGrayed);    
120  this.SetValue(value);
121  this.OnValueChanged();
122  return true;
123 },
124 IsElementBelongToInputElement: function(element) {
125  return false; 
126 },
127 ForceRefocusEditor: function() {
128  if(this.isNative)
129   ASPxClientEdit.prototype.ForceRefocusEditor.call(this);
130 },
131 GetValue: function() {
132  var value = this.stateController.GetValueByInputKey(this.GetStateInput().value);
133  if(value === "" && this.convertEmptyStringToNull)
134   value = null;     
135  return value;
136 },  
137 SetValue: function(value) {
138  this.previousValue = value;
139  value = this.GetCorrectValue(value);
140  if(this.isNative)
141   this.GetInputElement().checked = (this.previousValue == this.valueChecked);
142  else
143   this.internalCheckBox.SetValue(value);
144  this.GetStateInput().value = this.stateController.GetInputKeyByValue(value);
145  if(this.accessibilityCompliant) {
146   var state = this.GetCheckState();
147   var mainElement = this.GetICBMainElement();
148   this.stateController.SetAriaCheckedSelectedAttributes(mainElement, state);
149  }
150  this.OnValueSet();
151 },
152 GetICBMainElement: function() {
153  return ASPx.CheckableElementHelper.Instance.GetICBMainElementByInput(this.GetStateInput());
154 },
155 GetLabelElement: function() {
156  return ASPx.CheckEditElementHelper.Instance.GetLabelElement(this.GetMainElement());
157 },
158 GetStateInput: function() {
159  return this.GetChildElement("S");
160 },
161 GetAccessibilityActiveElements: function() {
162  return [this.GetFocusableInputElement()];
163 },
164 GetCorrectValue: function(value) {
165  var stateIsExist = typeof(this.stateController.GetInputKeyByValue(value)) != "undefined";
166  if(!stateIsExist)
167   return this.allowGrayed ? this.valueGrayed : this.valueUnchecked; 
168  return value;
169 },
170 OnValueSet: function() {},
171 RaiseCheckedChanged: function(processOnServer) {
172  if(!this.CheckedChanged.IsEmpty()) {
173   var args = new ASPxClientProcessingModeEventArgs(processOnServer);
174   this.CheckedChanged.FireEvent(this, args);
175   processOnServer = args.processOnServer;
176  }
177  return processOnServer;
178 },
179 SetEnabled: function(enabled) {
180  ASPxClientEdit.prototype.SetEnabled.call(this, enabled);
181  if(!this.isNative) 
182    this.internalCheckBox.SetEnabled(enabled);
183 },
184 GetChecked: function() {
185  return this.stateController.GetCheckStateByInputKey(this.GetStateInput().value) == ASPx.CheckBoxCheckState.Checked;
186 },
187 SetChecked: function(isChecked) {
188  this.SetCheckState(isChecked ? ASPx.CheckBoxCheckState.Checked : ASPx.CheckBoxCheckState.Unchecked);
189 },
190 GetText: function() {
191  var labelElement = this.GetLabelElement();
192  return (labelElement != null) ? labelElement.innerHTML : "";
193 },
194 GetCheckState: function() {
195  var internalCheckeState = this.stateController.GetCheckStateByInputKey(this.GetStateInput().value);
196  if(internalCheckeState != ASPx.CheckBoxCheckState.Indeterminate || this.allowGrayed)
197   return internalCheckeState;
198  else 
199   return ASPx.CheckBoxCheckState.Unchecked;
200 },
201 SetCheckState: function(checkState) {
202  if(checkState != ASPx.CheckBoxCheckState.Indeterminate || this.allowGrayed) {
203   var value = this.stateController.GetValueByCheckState(checkState);
204   this.SetValue(value);
205  }
206 },
207 SetText: function(text) {
208  var labelElement = this.GetLabelElement();
209  if(labelElement != null) 
210   ASPx.SetInnerHtml(labelElement, text);
211 },
212 ChangeEnabledAttributes: function(enabled){
213  if(this.isNative) {
214   this.ChangeInputEnabledAttributes(this.GetInputElement(), ASPx.Attr.ChangeAttributesMethod(enabled));
215   this.GetInputElement().disabled = !enabled;
216  } else
217   this.internalCheckBox.SetEnabled(enabled);
218 },
219 ChangeEnabledStateItems: function(enabled){
220  ASPx.GetStateController().SetElementEnabled(this.GetMainElement(), enabled);
221  this.GetStateInput().disabled = !enabled;
222 },
223 ChangeInputEnabledAttributes: function(element, method){
224  method(element, "onclick");
225 }
226});
227ASPxClientCheckBox.Cast = ASPxClientControl.Cast;
228var ASPxClientRadioButton = ASPx.CreateClass(ASPxClientCheckBox, {
229 constructor: function(name) {
230  this.constructor.prototype.constructor.call(this, name);
231  this.isASPxClientRadioButton = true;
232  this.groupName = "";
233 },
234 Initialize: function() {
235  ASPxClientCheckBox.prototype.Initialize.call(this);
236  if(this.accessibilityCompliant && this.groupName)
237   this.setAccessibilityGroupAttributes();
238 },
239 setAccessibilityGroupAttributes: function() {
240  var members = this.GetGroupMembers();
241  var currentIndex = members.indexOf(this);
242  var focusableElement = this.GetFocusableInputElement();
243  ASPx.Attr.SetAttribute(focusableElement, "aria-setsize", members.length);
244  ASPx.Attr.SetAttribute(focusableElement, "aria-posinset", currentIndex + 1);
245 },
246 OnValueSet: function() {
247  if(this.previousValue === true) 
248   this.UncheckOtherGroupMembers(true );
249 },
250 OnClick: function() {
251  if(!this.previousValue) {
252   this.UncheckOtherGroupMembers();
253   ASPxClientCheckBox.prototype.OnClick.call(this);
254  } else {
255   if(!this.focused)
256    this.SetFocus();
257  }
258 },
259 CreateInternalCheckBox: function() {
260  ASPxClientCheckBox.prototype.CreateInternalCheckBox.call(this);
261  this.internalCheckBox.autoSwitchEnabled = false;
262 },
263 UncheckOtherGroupMembers: function(suppressEvents) {
264  var members = this.GetGroupMembers();
265  for(var i = 0; i < members.length; i++) {
266   var radioButton = members[i];
267   if(!ASPx.IsExistsElement(radioButton.GetMainElement()))
268    members[i] = null;
269   else {
270    if(radioButton != this && radioButton.GetValue()){
271     radioButton.SetValue(false);
272     if(!suppressEvents)
273      radioButton.RaiseValueChangedEvent();
274    }
275   }
276  }
277 },
278 OnReadonlyClick: function() {
279  if(!this.previousValue) {   
280   var members = this.GetGroupMembers();   
281   for(var i = 0; i < members.length; i++) {
282    var radioButton = members[i];
283    radioButton.SetValue(radioButton.GetValue());
284   }
285  }
286 },
287 GetGroupName: function() {
288  if(!this.isNative)
289   return this.groupName;
290  var inputElement = this.GetInputElement();
291  if (!ASPx.IsExistsElement(inputElement))
292   return null;
293  var name = inputElement.name;
294  if(!name.length)
295   name = "";
296  return name;
297 },
298 GetGroupMembers: function() {
299  var result = [ ];
300  var groupName = this.GetGroupName();
301  if(groupName.length > 0) {
302   ASPx.GetControlCollection().ForEachControl(function(control) {
303    if(ASPx.Ident.IsASPxClientRadioButton(control)) {
304     var controlGroupName = control.GetGroupName();
305     if (controlGroupName != null && controlGroupName == groupName)
306      result.push(control);
307    }
308   });
309  } else {
310   result.push(this);
311  }
312  return result;  
313 },
314 GetChecked: function() {
315  return this.GetValue() == true;
316 },
317 SetChecked: function(isChecked) {
318  this.SetValue(isChecked);
319 }
320});
321ASPxClientRadioButton.Cast = ASPxClientControl.Cast;
322ASPx.Ident.IsASPxClientCheckEdit = function(obj) {
323 return !!obj.isASPxClientCheckEdit;
324};
325ASPx.Ident.IsASPxClientRadioButton = function(obj) {
326 return !!obj.isASPxClientRadioButton;
327};
328ASPx.Ident.IsASPxClientCheckBox = function(obj) {
329 return ASPx.Ident.IsASPxClientCheckEdit(obj) && !ASPx.Ident.IsASPxClientRadioButton(obj);
330};
331ASPx.ChkOnClick = function(name) {
332 var edit = ASPx.GetControlCollection().Get(name);
333 if(edit) {
334  if(edit.isNative && edit.GetReadOnly())
335   return false;
336  edit.OnClick();
337 }
338};
339ASPx.ERBOnReadonlyClick = function(name) {
340 var rb = ASPx.GetControlCollection().Get(name);
341 if(rb)
342  rb.OnReadonlyClick();
343};
344window.ASPxClientCheckBox = ASPxClientCheckBox;
345window.ASPxClientRadioButton = ASPxClientRadioButton;
346})();
347

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.