-
Notifications
You must be signed in to change notification settings - Fork 0
/
JsDocument.cs
318 lines (272 loc) · 8.53 KB
/
JsDocument.cs
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
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.IO;
namespace ClockWork.JavaScriptBuilder
{
/// <summary>
/// Summary description for JsDocument
/// </summary>
public class JsDocument : ScriptDocument
{
public JsDocument()
{
}
//private JsVariableFactory _VariableFactory;
//public JsVariableFactory VariableFactory
//{
// get
// {
// if (_VariableFactory == null)
// _VariableFactory = new JsVariableFactory();
// return _VariableFactory;
// }
// set { _VariableFactory = value; }
//}
private JsMultiLine _Content;
public JsMultiLine Content
{
get {
if (_Content==null)
_Content = new JsMultiLine(this);
return _Content;
}
}
public void Render(ScriptWriter writer)
{
Content.Render(writer);
}
public JsQuote QS(string text)
{
return CreateQuoteSingle(text);
}
public JsQuote CreateQuoteSingle(string text)
{
return new JsQuote(this, text, false);
}
public JsQuote QD(object text)
{
return CreateQuoteDouble(text);
}
public JsQuote CreateQuoteDouble(object text)
{
return new JsQuote(this,text, true);
}
public JsCall CreateNewCall(JsFormat format, string className, params object[] items)
{
JsCall c = new JsCall(this, className, items);
c.New = true;
c.SetFormat(format);
return c;
}
public JsCall CreateNewCall(string className, params object[] items)
{
return CreateNewCall(JsFormat.None, className, items);
}
public JsCall N(JsFormat format, string className, params object[] items)
{
return CreateNewCall(format, className, items);
}
public JsCall N(string className, params object[] items)
{
return CreateNewCall(className, items);
}
public JsObject CreateObject(JsFormat format, params object[] properties)
{
JsObject o = new JsObject(this, properties);
o.SetFormat(format);
return o;
}
public JsObject CreateObject(params object[] properties)
{
return CreateObject(JsFormat.None, properties);
}
public JsObject O(JsFormat format, params object[] properties)
{
return CreateObject(format, properties);
}
public JsObject O(params object[] properties)
{
return CreateObject(properties);
}
public JsProperty CreateProperty(JsFormat format, string name, object value)
{
JsProperty p = new JsProperty(this, name, value);
p.SetFormat(format);
return p;
}
public JsProperty CreateProperty(string name, object value)
{
return CreateProperty(JsFormat.None, name, value);
}
public JsProperty P(JsFormat format, string name, object value)
{
return CreateProperty(format, name, value);
}
public JsProperty P(string name, object value)
{
return CreateProperty(name, value);
}
public JsArray CreateArray(JsFormat format, params object[] list)
{
JsArray a = new JsArray(this, list);
a.SetFormat(format);
return a;
}
public JsArray CreateArray(params object[] list)
{
return CreateArray(JsFormat.None, list);
}
public JsArray A(JsFormat format, params object[] list)
{
return CreateArray(format, list);
}
public JsArray A(params object[] list)
{
return CreateArray(list);
}
public JsMultiLine CreateMultiLine(JsFormat format, params object[] lines)
{
JsMultiLine m = new JsMultiLine(this, lines);
m.SetFormat(format);
return m;
}
public JsMultiLine CreateMultiLine(params object[] lines)
{
return CreateMultiLine(JsFormat.None, lines);
}
public JsMultiLine ML(JsFormat format, params object[] lines)
{
return CreateMultiLine(format, lines);
}
public JsMultiLine ML(params object[] lines)
{
return CreateMultiLine(lines);
}
public JsBlock CreateBlock(JsFormat format, params object[] lines)
{
JsBlock m = new JsBlock(this, lines);
m.SetFormat(format);
return m;
}
public JsBlock CreateBlock(params object[] lines)
{
return CreateBlock(JsFormat.None, lines);
}
public JsBlock B(JsFormat format, params object[] lines)
{
return CreateBlock(format, lines);
}
public JsBlock B(params object[] lines)
{
return CreateBlock(lines);
}
public JsFunction CreateFunction(JsFormat format, JsList parameters, JsMultiLine commands)
{
JsFunction f = new JsFunction(this, parameters, commands);
f.SetFormat(format);
return f;
}
public JsFunction CreateFunction(JsList parameters, JsMultiLine commands)
{
return CreateFunction(JsFormat.None, parameters, commands);
}
public JsFunction F(JsFormat format, JsList parameters, JsMultiLine commands)
{
return CreateFunction(format, parameters, commands);
}
public JsFunction F(JsList parameters, JsMultiLine commands)
{
return CreateFunction(parameters, commands);
}
public JsFunction CreateFunction(JsFormat format, JsMultiLine commands)
{
JsFunction f = new JsFunction(this, commands);
f.SetFormat(format);
return f;
}
public JsFunction CreateFunction(JsMultiLine commands)
{
return CreateFunction(JsFormat.None, commands);
}
public JsFunction F(JsFormat format, JsMultiLine commands)
{
return CreateFunction(format, commands);
}
public JsFunction F(JsMultiLine commands)
{
return CreateFunction(commands);
}
public JsCall CreateCall(JsFormat format, string function, params object[] items)
{
JsCall c = new JsCall(this, function, items);
c.SetFormat(format);
return c;
}
public JsCall CreateCall(string function, params object[] items)
{
return CreateCall(JsFormat.None, function, items);
}
public JsCall C(JsFormat format, string function, params object[] items)
{
return CreateCall(format, function, items);
}
public JsCall C(string function, params object[] items)
{
return CreateCall(function, items);
}
public JsList CreateList(JsFormat format, params object[] items)
{
JsList l = new JsList(this, items);
l.SetFormat(format);
return l;
}
public JsList CreateList(params object[] items)
{
return CreateList(JsFormat.None, items);
}
public JsList L(JsFormat format, params object[] items)
{
return CreateList(format, items);
}
public JsList L(params object[] items)
{
return CreateList(items);
}
public JsJoin CreateJoin(JsFormat format, params object[] items)
{
JsJoin j = new JsJoin(this, items);
j.SetFormat(format);
return j;
}
public JsJoin CreateJoin(params object[] items)
{
return CreateJoin(JsFormat.None, items);
}
public JsJoin J(JsFormat format, params object[] items)
{
return CreateJoin(format, items);
}
public JsJoin J(params object[] items)
{
return CreateJoin(items);
}
//public JsVariable CreateVariable(string name, string shortName)
//{
// return new JsVariable(name, shortName);
//}
//public JsVariable V(string name, string shortName)
//{
// return CreateVariable(name, shortName);
//}
public JsIf If(object test, object trueValue, object falseValue)
{
return new JsIf(this, test, trueValue, falseValue);
}
public JsIf If(object test, object trueValue)
{
return If(test, trueValue, null);
}
}
}