forked from extnet/Ext.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFieldSet.cs
More file actions
315 lines (292 loc) · 11 KB
/
FieldSet.cs
File metadata and controls
315 lines (292 loc) · 11 KB
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
/********
* @version : 2.1.1 - Ext.NET Pro License
* @author : Ext.NET, Inc. http://www.ext.net/
* @date : 2012-12-10
* @copyright : Copyright (c) 2007-2012, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
* @license : See license.txt and http://www.ext.net/license/.
********/
using System.ComponentModel;
using System.Drawing;
using System.Web.UI;
namespace Ext.Net
{
/// <summary>
/// A container for grouping sets of fields, rendered as a HTML fieldset element. The title config will be rendered as the fieldset's legend.
///
/// While FieldSets commonly contain simple groups of fields, they are general Containers and may therefore contain any type of components in their items, including other nested containers. The default layout for the FieldSet's items is 'anchor', but it can be configured to use any other layout type.
///
/// FieldSets may also be collapsed if configured to do so; this can be done in two ways:
///
/// Set the collapsible config to true; this will result in a collapse button being rendered next to the legend title, or:
/// Set the checkboxToggle config to true; this is similar to using collapsible but renders a checkbox in place of the toggle button. The fieldset will be expanded when the checkbox is checked and collapsed when it is unchecked. The checkbox will also be included in the form submit parameters using the checkboxName as its parameter name.
/// </summary>
[Meta]
[ToolboxData("<{0}:FieldSet runat=\"server\"><Items></Items></{0}:FieldSet>")]
[DefaultEvent("Width")]
[ToolboxBitmap(typeof(FieldSet), "Build.ToolboxIcons.FieldSet.bmp")]
[Description("Standard content Container used for grouping form fields.")]
public partial class FieldSet : AbstractContainer
{
/// <summary>
///
/// </summary>
[Description("")]
public FieldSet() { }
/// <summary>
///
/// </summary>
[Category("0. About")]
[Description("")]
public override string XType
{
get
{
return "fieldset";
}
}
/// <summary>
///
/// </summary>
[Category("0. About")]
[Description("")]
public override string InstanceOf
{
get
{
return "Ext.form.FieldSet";
}
}
/// <summary>
///
/// </summary>
protected override string DefaultLayout
{
get
{
return "anchor";
}
}
/// <summary>
/// The Ext.container.Container.layout for the form panel's immediate child items. Defaults to 'anchor'.
/// </summary>
[Category("5. Container")]
[DefaultValue("anchor")]
[TypeConverter(typeof(LayoutConverter))]
[Description("The Ext.container.Container.layout for the form panel's immediate child items. Defaults to 'anchor'.")]
public override string Layout
{
get
{
return this.State.Get<string>("Layout", "anchor");
}
set
{
this.State.Set("Layout", value);
}
}
/// <summary>
/// The name to assign to the fieldset's checkbox if checkboxToggle = true (defaults to '[fieldset id]-checkbox').
/// </summary>
[Meta]
[ConfigOption]
[Category("7. FieldSet")]
[DefaultValue("")]
[Description("The name to assign to the fieldset's checkbox if checkboxToggle = true (defaults to '[fieldset id]-checkbox').")]
public virtual string CheckboxName
{
get
{
return this.State.Get<string>("CheckboxName", "");
}
set
{
this.State.Set("CheckboxName", value);
}
}
/// <summary>
/// Set to true to render a checkbox into the fieldset frame just in front of the legend to expand/collapse the fieldset when the checkbox is toggled. (defaults to false). This checkbox will be included in form submits using the checkboxName.
/// </summary>
[Meta]
[ConfigOption]
[Category("7. FieldSet")]
[DefaultValue(false)]
[Description("Set to true to render a checkbox into the fieldset frame just in front of the legend to expand/collapse the fieldset when the checkbox is toggled. (defaults to false). This checkbox will be included in form submits using the checkboxName.")]
public virtual bool CheckboxToggle
{
get
{
return this.State.Get<bool>("CheckboxToggle", false);
}
set
{
this.State.Set("CheckboxToggle", value);
}
}
/// <summary>
/// Set to true to render the fieldset as collapsed by default. If checkboxToggle is specified, the checkbox will also be unchecked by default.
/// </summary>
[Meta]
[DirectEventUpdate(MethodName="SetCollapsed")]
[ConfigOption]
[Category("7. FieldSet")]
[DefaultValue(false)]
[Description("Set to true to render the fieldset as collapsed by default. If checkboxToggle is specified, the checkbox will also be unchecked by default.")]
public virtual bool Collapsed
{
get
{
return this.State.Get<bool>("Collapsed", false);
}
set
{
this.State.Set("Collapsed", value);
}
}
/// <summary>
/// Set to true to make the fieldset collapsible and have the expand/collapse toggle button automatically rendered into the legend element, false to keep the fieldset statically sized with no collapse button (defaults to false). Another option is to configure checkboxToggle. Use the collapsed config to collapse the fieldset by default.
/// </summary>
[Meta]
[ConfigOption]
[Category("7. FieldSet")]
[DefaultValue(false)]
[Description("Set to true to make the fieldset collapsible and have the expand/collapse toggle button automatically rendered into the legend element, false to keep the fieldset statically sized with no collapse button (defaults to false). Another option is to configure checkboxToggle. Use the collapsed config to collapse the fieldset by default.")]
public virtual bool Collapsible
{
get
{
return this.State.Get<bool>("Collapsible", false);
}
set
{
this.State.Set("Collapsible", value);
}
}
/// <summary>
/// A title to be displayed in the fieldset's legend. May contain HTML markup.
/// </summary>
[Meta]
[DirectEventUpdate(MethodName="SetTitle")]
[ConfigOption]
[Category("7. FieldSet")]
[DefaultValue("")]
[Description("A title to be displayed in the fieldset's legend. May contain HTML markup.")]
public virtual string Title
{
get
{
return this.State.Get<string>("Title", "");
}
set
{
this.State.Set("Title", value);
}
}
/// <summary>
/// Set to true will add a listener to the titleCmp property for the click event which will execute the toggle method. This option is only used when the collapsible property is set to true. Defaults to: true
/// </summary>
[Meta]
[ConfigOption]
[Category("7. FieldSet")]
[DefaultValue(true)]
[Description("Set to true will add a listener to the titleCmp property for the click event which will execute the toggle method. This option is only used when the collapsible property is set to true. Defaults to: true")]
public virtual bool ToggleOnTitleClick
{
get
{
return this.State.Get<bool>("ToggleOnTitleClick", true);
}
set
{
this.State.Set("ToggleOnTitleClick", value);
}
}
private FieldSetListeners listeners;
/// <summary>
/// Client-side JavaScript Event Handlers
/// </summary>
[Meta]
[ConfigOption("listeners", JsonMode.Object)]
[Category("2. Observable")]
[NotifyParentProperty(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Description("Client-side JavaScript Event Handlers")]
public FieldSetListeners Listeners
{
get
{
if (this.listeners == null)
{
this.listeners = new FieldSetListeners();
}
return this.listeners;
}
}
private FieldSetDirectEvents directEvents;
/// <summary>
/// Server-side Ajax Event Handlers
/// </summary>
[Meta]
[Category("2. Observable")]
[NotifyParentProperty(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[ConfigOption("directEvents", JsonMode.Object)]
[Description("Server-side Ajax Event Handlers")]
public FieldSetDirectEvents DirectEvents
{
get
{
if (this.directEvents == null)
{
this.directEvents = new FieldSetDirectEvents(this);
}
return this.directEvents;
}
}
/// <summary>
///
/// </summary>
/// <param name="collapsed"></param>
protected void SetCollapsed(bool collapsed)
{
if (collapsed)
{
this.Collapse();
}
else
{
this.Expand();
}
}
/// <summary>
/// Expands the fieldset.
/// </summary>
public void Expand()
{
this.Call("expand");
}
/// <summary>
/// Collapses the fieldset.
/// </summary>
public void Collapse()
{
this.Call("collapse");
}
/// <summary>
/// Toggle the fieldset's collapsed state to the opposite of what it is currently
/// </summary>
public void Toggle()
{
this.Call("toggle");
}
/// <summary>
/// Sets the title of this fieldset
/// </summary>
/// <param name="title">The new title</param>
protected void SetTitle(string title)
{
this.Call("setTitle", title);
}
}
}