summaryrefslogtreecommitdiff
path: root/framework/TODO.txt
blob: 0bfaab263460f1d44ff1f07196b62184f06860a0 (plain)
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

think more about encoding/decoding
<%@ MasterClass="Pages.MasterPage" %>
THtmlTextWriter::addStyleAttribute(), also change how TStyle renders its content.


callback

http://www.xisc.com/index.php?page=homepage

Features to be implemented later:
- SmartNavigation: TForm, TPage
- DefaultButton: TForm, TClientScriptManager

Main Problems:
1. How to solve viewstate ID mapping problems? What if a control has changed its ID before saving viewstate?
5. What if in a getter, it needs to address a sibling or child control?
6. learn more details about WebParts
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_sp2003_ta/html/sharepoint_northwindwebparts.asp

When a page is requested, asp.net 2.0 does the following
- application creates the page instance by new operator
- application invokes page.processrequest
- page.frameworkinitialize is invoked
- ... ControlBuilder.InitObject(page)
- ... ... set SkinID
- ... ... apply stylesheet skin
- ... ... init simple properties (basic property types)
- ... ... init complex proprerties (e.g. Font-Name), may need to call InitObject on Font
- ... ... init data bindings
- ... ... call BuildChildren if item implements IParserAccessor (Control implements it)
- ... ... ... for each body item
- ... ... ... ... get the control builder for the control class
- ... ... ... ... call ControlBuilder.BuildObject
- ... ... ... ... ... call InitObject
- ... ... ... ... if it is user control (control with template)
- ... ... ... ... ... call UserControl.InitializeAsUserControl(page)
- ... ... ... ... ... ... call frameworkinitialize (won't call InitObject anymore)
- ... ... ... ... call control.AddParsedSubObject(item)
- ... ... init template properties (should be a property with template type, will use TemplateBuilder to build the object)
- ... ... bind field to control (pass some fields from TemplateControl to the new control)

How is a UserControl initialized if created dynamically?
- ... InitializeAsUserControl invoked in OnInit (which will be caught up if the control is dynamically created)




Findings:


Control lifecycles:

const CS_CONSTRUCTED=0;				// after constructor
const CS_FRAMEWORK_INITIALIZED=1;	// after children created and properties set
const CS_CHILDREN_INITIALIZED=2;	// right before OnInit (also before applySkin, but after children OnInit)
const CS_INITIALIZED=3;				// right after OnInit
const CS_STATE_LOADED=4;			// right after loading state
const CS_LOADED=5;					// right after loaded
const CS_PRERENDERED=6;				// right after prerender

stylesheet is applied before setting control properties (after skinID is set)
skin is applied right before OnInit



ControlBuilder is responsible to call AddParsedSubObject
Its BuildChildren is

My understanding of lifecycles:

Page constructed (using new operator)
Page.ProcessRequest
  Page.FrameworkInitialize
    Page.InitializeStyleSheet
  Page.determinePostBackMode
  Page.loadScrollPosition
  Page.performPreInit
  Page.initRecursive
  Page.onInitComplete
  Page.loadAllState
  Page.processPostData
  Page.onPreLoad
  Page.loadRecursive
  Page.processPostData
  Page.raiseChangedEvents
  Page.raisePostBackEvent
  Page.onLoadComplete
  Page.raiseCallBackEvent -> exit
  Page.preRenderRecursive
  Page.performPreRenderComplete
  Page.saveAllState
  Page.onSaveStateComplete
  Page.renderControl
  Page.unloadRecursive


Possible solution for SkinID: setting SkinID will cause skin change immediately.
With control hierarchy storing:


Page constructed (template parsed but not instantiated)
Page.loadAllState <---- page state totally restored
Page.loadRecursive
Page.processPostData
Page.raiseChangedEvents
Page.raisePostBackEvent  or Page.raiseCallBackEvent
Page.preRenderRecursive
Page.saveAllState
Page.renderControl
Page.unloadRecursive



Page constructed
Page.frameworkInitialize (instantiating template)
Page.initRecursive
Page.saveAllState
Page.renderControl
Page.unloadRecursive




edit distance.
(UIUC) Jiawei Han: graph similarity mining

module service?
page service?


index.php?page=path.to.page


TODOs

renderer??
Dispose
-->> viewstate id-based or index-based, structure keeping?? <<--
HttpContext, url/path
template path
adapter
parser


class metadata attributes:
e.g. the body content of a control can be parsed as child controls, or property values
or list items

Imagine a usecase (hmmm...could have problem....) How to specify two list properties for a single control?
<com:TListBox>
<ID>abc</ID>
<Items>
  <ListItem Value="yyy">xxx</ListItem>
  <ListItem>yyy</ListItem>
</Items>
</com:TListBox>


how to define a control with template??
TemplateControl.LoadControl  or LoadTemplate is used for controls that allows taking template contents for their attributes.


UserControl! starting from the template instead of class



idNotCalculated = 1;
marked = 2;
disableViewState = 4;
controlsCreated = 8;
invisible = 0x10;
visibleDirty = 0x20;
idNotRequired = 0x40;
isNamingContainer = 0x80;
creatingControls = 0x100;
notVisibleOnPage = 0x200;
themeApplied = 0x400;
mustRenderID = 0x800;
disableTheming = 0x1000;
enableThemingSet = 0x2000;
styleSheetApplied = 0x4000;
controlAdapterResolved = 0x8000;
designMode = 0x10000;
designModeChecked = 0x20000;
disableChildControlState = 0x40000;
isWebControlDisabled = 0x80000;
controlStateApplied = 0x100000;
useGeneratedID = 0x200000;

TODO:

clean up ID, namingcontainer things:

A control can be added into page hierarchy in the following ways
- newly created in template
  - manual ID
  - need automatic ID
- dynamically created in code
  - manual ID
  - need automatic ID
- a previously removed control
  - manual ID
  - need automatic ID
When a control changes its ID, the following things are necessary:
- If it is a namingContainer
  - all its descendant must update their unique ID
- If it is a normal control, nothing needs to be done
- In both cases, the namingContainer's nametable has to be updated
When a control changes its page, ...?
- All its children have to change the page too
When a control changes its parent, ...?
-  This is like remvoedControl + addedControl.
When a control changes its namingcontainer ...?
- All its child controls have to change namingcontainer recursively
  The old namingContainer nametable must also be changed recursively.
When a control changes its templateControl...??
- Nothing to be done.



ControlState
============
Constructed
Initialized
ViewStateLoaded
Loaded
PreRendered



asp.net 2.0 lifecycles
========================
Application: BeginRequest
Application: PreAuthenticateRequest
Application: AuthenticateRequest
Application: PostAuthenticateRequest
Application: PreAuthorizeRequest
Application: AuthorizeRequest
Application: PostAuthorizeRequest
Application: PreResolveRequestCache
Application: ResolveRequestCache
Application: PostResolveRequestCache
Application: PreMapRequestHandler
Page: Construct
Application: PostMapRequestHandler
Application: PreAcquireRequestState
Application: AcquireRequestState
Application: PostAcquireRequestState
Application: PreRequestHandlerExecute
Page: AddParsedSubObject
Page: CreateControlCollection
Page: AddedControl
Page: AddParsedSubObject
Page: AddedControl
Page: ResolveAdapter
Page: DeterminePostBackMode
Page: PreInit
Control: ResolveAdapter
Control: Init
Control: TrackViewState
Page: Init
Page: TrackViewState
Page: InitComplete
Page: LoadPageStateFromPersistenceMedium
Control: LoadViewState
Page: EnsureChildControls
Page: CreateChildControls
Page: PreLoad
Page: Load
Control: DataBind
Control: Load
Page: EnsureChildControls
Page: LoadComplete
Page: EnsureChildControls
Page: PreRender
Control: EnsureChildControls
Control: PreRender
Page: PreRenderComplete
Page: SaveViewState
Control: SaveViewState
Page: SaveViewState
Control: SaveViewState
Page: SavePageStateToPersistenceMedium
Page: SaveStateComplete
Page: CreateHtmlTextWriter
Page: RenderControl
Page: Render
Page: RenderChildren
Control: RenderControl
Page: VerifyRenderingInServerForm
Page: CreateHtmlTextWriter
Control: Unload
Control: Dispose
Page: Unload
Page: Dispose
Application: PostRequestHandlerExecute
Application: PreReleaseRequestState
Application: ReleaseRequestState
Application: PostReleaseRequestState
Application: PreUpdateRequestCache
Application: UpdateRequestCache
Application: PostUpdateRequestCache
Application: EndRequest
Application: PreSendRequestHeaders
Application: PreSendRequestContent