Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
669 lines (584 loc) · 20.1 KB

File metadata and controls

669 lines (584 loc) · 20.1 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
/********
* This file is part of Ext.NET.
*
* Ext.NET is free software: you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Ext.NET is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with Ext.NET. If not, see <http://www.gnu.org/licenses/>.
*
*
* @version : 2.0.0.beta - Community Edition (AGPLv3 License)
* @author : Ext.NET, Inc. http://www.ext.net/
* @date : 2012-03-07
* @copyright : Copyright (c) 2007-2012, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
* @license : GNU AFFERO GENERAL PUBLIC LICENSE (AGPL) 3.0.
* See license.txt and http://www.ext.net/license/.
* See AGPL License at http://www.gnu.org/licenses/agpl-3.0.txt
********/
using System;
using System.ComponentModel;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Serialization;
using Ext.Net.Utilities;
using Newtonsoft.Json;
namespace Ext.Net
{
[Designer(typeof(ExtControlDesigner))]
public abstract partial class BaseControl : WebControl, ICompositeControlDesignerAccessor, IXObject, IBase
{
/* About
-----------------------------------------------------------------------------------------------*/
/// <summary>
/// The product name
/// </summary>
[Category("0. About")]
public string ProductName
{
get { return "Ext.NET"; }
}
/// <summary>
/// The version name
/// </summary>
[Category("0. About")]
public string VersionName
{
get { return "Pro"; }
}
internal string Stamp
{
get
{
if (this.DesignMode)
{
return "";
}
return "{0} [{1}]. Version {2}.".FormatWith(this.ProductName, this.VersionName, this.Version);
}
}
/// <summary>
/// The Version number of this build
/// </summary>
[Category("0. About")]
public virtual string Version
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
internal bool IsPro
{
get
{
return false;
}
}
/* Overrides
-----------------------------------------------------------------------------------------------*/
private string dynamicID;
public static string GenerateId()
{
long i = 1;
foreach (byte b in Guid.NewGuid().ToByteArray())
{
i *= ((int)b + 1);
}
return string.Format("id{0:x}", i - DateTime.Now.Ticks);
}
/// <summary>
///
/// </summary>
[Description("")]
protected string DynamicID
{
get
{
if (this.dynamicID.IsEmpty())
{
this.dynamicID = BaseControl.GenerateId();
}
return this.dynamicID;
}
}
private bool isDynamicIDSet;
internal void EnsureDynamicID()
{
if (!this.isDynamicIDSet && (this.IsSelfRender || this.IsPageSelfRender || this.IsDynamic) && this.IsGeneratedID)
{
this.isDynamicIDSet = true;
this.ID = this.DynamicID;
this.IsGeneratedID = true;
}
}
/// <summary>
/// The unique id of this component instance (defaults to an auto-assigned id).
/// Components created with an id may be accessed globally using Ext.getCmp.
/// You can use the itemId config, and ComponentQuery which provides selector-based searching for Sencha Components analogous to DOM querying. The Container class contains shortcut methods to query its descendant Components by selector.
/// Note that this id will also be used as the element id for the containing HTML element that is rendered to the page for this component. This allows you to write id-based CSS rules to style the specific instance of this component uniquely, and also to select sub-elements using this component's id as the parent.
/// Note: to avoid complications imposed by a unique id also see itemId.
/// Note: to access the container of a AbstractComponent see ownerCt.
/// </summary>
[Category("0. About")]
public override string ID
{
get
{
if ((this.IsSelfRender || this.IsPageSelfRender || this.IsDynamic) && this.IsGeneratedID)
{
this.EnsureDynamicID();
return this.DynamicID;
}
return base.ID;
}
set
{
if (this.IsGeneratedID && base.ID != value)
{
this.IsGeneratedID = false;
}
base.ID = value;
}
}
/// <summary>
///
/// </summary>
[Description("")]
public override string ClientID
{
get
{
this.EnsureDynamicID();
if (this.ClientNamespace.IsNotEmpty() && this.ItemID.IsNotEmpty())
{
return this.AddNamespaceToID(this.ItemID);
}
return this.AddNamespaceToID(this.ConfigID);
}
}
/// <summary>
/// An itemId can be used as an alternative way to get a reference to a component when no object reference is available. Instead of using an id with Ext.getCmp, use itemId with Ext.container.Container.getComponent which will retrieve itemId's or id's. Since itemId's are an index to the container's internal MixedCollection, the itemId is scoped locally to the container -- avoiding potential conflicts with Ext.ComponentMgr which requires a unique id
/// </summary>
[Meta]
[ConfigOption("itemId")]
[DefaultValue("")]
[Category("3. AbstractComponent")]
[Description("An itemId can be used as an alternative way to get a reference to a component when no object reference is available.")]
public virtual string ItemID
{
get
{
return this.State.Get<string>("ItemID", "");
}
set
{
this.State.Set("ItemID", value);
}
}
/// <summary>
///
/// </summary>
[Description("")]
public virtual string ConfigID
{
get
{
this.EnsureDynamicID();
switch (this.IDMode)
{
case IDMode.Static:
return this.ID;
case IDMode.Explicit:
return this.BaseClientID;
case IDMode.Predictable:
Control parent = this.NamingContainer;
return parent != null ? string.Format("{0}_{1}", parent.ID, this.ID) : this.ID;
case IDMode.Parent:
string id2 = "";
Control nc = this.NamingContainer;
if (nc != null)
{
Control nc_parent = nc.Parent;
if (nc_parent != null)
{
Control nc_parent_parent = nc_parent.Parent;
bool isCmp = nc_parent is AbstractComponent;
string parentID = isCmp ? ((BaseControl)nc_parent).ConfigID : nc_parent.ID;
id2 = (nc_parent_parent != null && nc_parent_parent is IContent) ? ((BaseControl)nc_parent_parent).ConfigID : parentID;
}
}
return !string.IsNullOrEmpty(id2) ? string.Format("{0}_{1}", id2, this.ID) : this.ID;
default:
return this.BaseClientID;
}
}
}
/// <summary>
/// The base .ClientID property derived from .NET Framework
/// </summary>
[Description("The base .ClientID property derived from .NET Framework")]
public virtual string BaseClientID
{
get
{
return base.ClientID;
}
}
/* Public Properties
-----------------------------------------------------------------------------------------------*/
/// <summary>
///
/// </summary>
[ConfigOption("id")]
[DefaultValue("")]
protected virtual string ConfigIDProxy
{
get
{
if (this.IsDynamic && this.IsGeneratedID && !this.TopDynamicControl)
{
return "";
}
if (this.IDMode == IDMode.Ignore)
{
return "";
}
if (!this.IsIdRequired && ((this.IDMode == IDMode.Explicit || this.IDMode == IDMode.Client || this.IDMode == IDMode.Static) && this.IsGeneratedID))
{
return "";
}
if (this.ConfigID == null)
{
return "";
}
return this.ConfigID;
}
}
/// <summary>
///
/// </summary>
public bool HasOwnIDMode
{
get
{
return this.State["IDMode"] != null;
}
}
/// <summary>
/// Options for controlling how the .ClientID property is rendered in the client.
/// </summary>
[Category("1. XControl")]
[DefaultValue(IDMode.Inherit)]
[NotifyParentProperty(true)]
[Description("Options for controlling how the .ClientID property is rendered in the client.")]
public virtual IDMode IDMode
{
get
{
object obj = this.State["IDMode"];
IDMode mode = IDMode.Inherit;
if (obj != null)
{
mode = (IDMode)obj;
}
else if (!this.StopIDModeInheritance)
{
BaseControl control = this.ParentWebControl;
if (control != null)
{
mode = control.IDMode;
}
}
if (mode == IDMode.Inherit && this.SafeResourceManager != null)
{
mode = this.ResourceManager.IDMode;
}
return mode;
}
set
{
this.State.Set("IDMode", value);
}
}
/// <summary>
///
/// </summary>
[DefaultValue(false)]
public virtual bool StopIDModeInheritance
{
get;
set;
}
/// <summary>
/// Options for controlling how the lazy control is instantiated in the client.
/// </summary>
[Category("1. XControl")]
[DefaultValue(LazyMode.Inherit)]
[NotifyParentProperty(true)]
[Description("Options for controlling how the lazy control is instantiated in the client.")]
public virtual LazyMode LazyMode
{
get
{
object obj = this.State["LazyMode"];
LazyMode mode = LazyMode.Inherit;
if (obj != null)
{
mode = (LazyMode)obj;
}
else
{
BaseControl control = this.ParentWebControl;
if (control != null)
{
mode = control.LazyMode;
}
}
if (mode == LazyMode.Inherit && this.SafeResourceManager != null)
{
mode = this.ResourceManager.LazyMode;
}
return mode;
}
set
{
this.State.Set("LazyMode", value);
}
}
/// <summary>
///
/// </summary>
public bool HasOwnNamespace
{
get
{
return this.State.Get<string>("Namespace", "").IsNotEmpty();
}
}
/// <summary>
///
/// </summary>
/// <param name="parseDot"></param>
/// <returns></returns>
protected virtual string GetNamespace(bool parseDot)
{
object obj = this.State["Namespace"];
BaseControl control;
string ns = "";
if (obj != null)
{
ns = (string)obj;
if (ns.IsEmpty())
{
return "";
}
if (parseDot && ns.IsNotEmpty() && ns.StartsWith("."))
{
control = this.ParentWebControl;
string parentNS;
if (control != null)
{
parentNS = control.ClientNamespace;
}
else
{
try
{
parentNS = this.SafeResourceManager != null ? this.SafeResourceManager.NormalizedNamespace : "";
}
catch (Exception)
{
parentNS = "";
}
}
if (parentNS.IsNotEmpty())
{
ns = parentNS + ns;
}
else
{
ns = ns.Remove(0, 1);
}
}
}
else
{
control = this.ParentWebControl;
if (control != null)
{
ns = control.ClientNamespace;
}
}
if (ns.IsEmpty() && this.SafeResourceManager != null)
{
ns = this.SafeResourceManager.NormalizedNamespace;
}
return ns;
}
/// <summary>
///
/// </summary>
[DefaultValue("")]
public virtual string ClientNamespace
{
get
{
return this.GetNamespace(true);
}
}
/// <summary>
///
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
protected virtual string AddNamespaceToID(string id)
{
string ns = this.ClientNamespace;
if (ns.IsNotEmpty())
{
return ns + "." + id;
}
return id;
}
/// <summary>
///
/// </summary>
[Category("1. XControl")]
[DefaultValue("")]
[NotifyParentProperty(true)]
[Description("")]
public virtual string Namespace
{
get
{
return this.GetNamespace(false);
}
set
{
this.State.Set("Namespace", value);
}
}
/// <summary>
///
/// </summary>
[ConfigOption("ns")]
[DefaultValue("")]
protected virtual string ClientNamespaceProxy
{
get
{
string ns = this.GetNamespace(true);
return this.SafeResourceManager != null && ns == this.SafeResourceManager.NormalizedNamespace ? "" : ns;
}
}
/// <summary>
/// This AbstractComponent's initial configuration specification. Read-only.
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("This AbstractComponent's initial configuration specification. Read-only.")]
public virtual string InitialConfig
{
get
{
if (this is Observable)
{
return (this.DesignMode) ? "" : new ClientConfig().Serialize(this);
}
return "";
}
}
private bool autoDataBind;
/// <summary>
///
/// </summary>
[Category("1. XControl")]
[DefaultValue(false)]
[Description("")]
public virtual bool AutoDataBind
{
get
{
return this.autoDataBind;
}
set
{
this.autoDataBind = value;
}
}
/// <summary>
///
/// </summary>
[Description("")]
protected internal virtual string ClientInitID
{
get
{
return this.ClientID.ConcatWith("_ClientInit");
}
}
/// <summary>
///
/// </summary>
[XmlIgnore]
[JsonIgnore]
[Description("")]
public virtual ConfigOptionsCollection ConfigOptions
{
get
{
ConfigOptionsCollection list = new ConfigOptionsCollection();
list.Add("configIDProxy", new ConfigOption("configIDProxy", new SerializationOptions("id"), "", this.ConfigIDProxy));
list.Add("itemID", new ConfigOption("itemID", new SerializationOptions("itemId"), "", this.ItemID));
list.Add("clientNamespaceProxy", new ConfigOption("clientNamespaceProxy", new SerializationOptions("ns"), "", this.ClientNamespaceProxy));
list.Add("postBackConfig", new ConfigOption("postBackConfig", new SerializationOptions("postback", JsonMode.Raw), "", this.PostBackConfig));
return list;
}
}
/// <summary>
///
/// </summary>
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[XmlIgnore]
[JsonIgnore]
public virtual ConfigOptionsExtraction ConfigOptionsExtraction
{
get
{
return ConfigOptionsExtraction.List;
}
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="config"></param>
/// <returns></returns>
[Description("")]
public T Apply<T>(IApply config) where T : IComponent
{
return (T)this.Apply(config);
}
/// <summary>
///
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
[Description("")]
public object Apply(IApply config)
{
return ObjectUtils.Apply(this, config);
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.