29
edits
(decision) |
(Revised thoughts) |
||
(One intermediate revision by the same user not shown) | |||
Line 25: | Line 25: | ||
# The action | # The action | ||
# The event ''and'' the action | # The event ''and'' the action | ||
The specification _hints_ at the former, but I think something speaks for the latter: The connection between cause and effect. If only the action is deferred, there is a "lag" between sending the event and the action being performed. This means that any action listening for the event are performed on a model state different from when the action will be performed. The could for example be a decision to cancel the event (and thus the action). | The specification _hints_ at the former, but I think something speaks for the latter: The connection between cause and effect. If only the action is deferred, there is a "lag" between sending the event and the action being performed. This means that any action listening for the event are performed on a model state different from when the action will be performed. The could for example be a decision to cancel the event (and thus the action). | ||
Line 34: | Line 32: | ||
== Deferring What and When == | == Deferring What and When == | ||
Choosing to defer events and their actions, is one step closer. Problem is which events we should defer in this way? Naturally we should defer further ''value changed sequences'', but only those three events triggered by a value changed? How about a "rogue" recalculate request during the value changed handling? Should that be deferred too? | Choosing to defer events and their actions, is one step closer. Problem is which events we should defer in this way? Naturally we should defer further ''value changed sequences'', but only those three events triggered by a value changed? How about a "rogue" recalculate request during the value changed handling? Should that be deferred too? | ||
Line 42: | Line 38: | ||
# should any event handling in the model defer concurrent events? | # should any event handling in the model defer concurrent events? | ||
# how about "rogue" events, coming from script, etc.? | # how about "rogue" events, coming from script, etc.? | ||
# | # also defer rebuild? | ||
"Instance data changes performed by a set of actions do not result in | |||
immediate computation dependency rebuilding, recalculation, revalidate and | |||
form control refreshing until the termination of the outermost action handler" | |||
[http://www.w3.org/TR/2006/REC-xforms-20060314/slice10.html#action-action Deferred Actions in the Spec] | |||
Based on that, I believe: | |||
# we should defer rebuild too | |||
# both "deferred events from action" and value-changes should be deferred | |||
== The Event-Dispatch Queue == | == The Event-Dispatch Queue == | ||
The conclusion of the above is that the | The conclusion of the above is that the _model_ should | ||
# be asked to perform requests for controls directly, not through events | # be asked to perform requests for controls directly, not through events | ||
# be responsible for dispatching events on itself | # be responsible for dispatching events on itself | ||
Line 58: | Line 62: | ||
The nsIModelPrivateElement should expose: | The nsIModelPrivateElement should expose: | ||
<pre> | <pre> | ||
requestRecalculate( | requestRebuild(); | ||
requestRevalidate( | requestRecalculate(); | ||
requestRefresh( | requestRevalidate(); | ||
requestRefresh(); | |||
</pre> | </pre> | ||
On a call to any of these functions the following should happen | On a call to any of these functions the following should happen | ||
<pre> | <pre> | ||
request...() { | |||
if (gDefer) { | if (gDefer) { | ||
eventQ.pushBack( | eventQ.pushBack(the_request); | ||
return; | return; | ||
} | } | ||
gDefer = true; | gDefer = true; | ||
dispatchEventFor(the_request); | |||
// Empty the queue | |||
req = eventQ.popFront(); | |||
while (req) { | |||
dispatchEventFor(req); | |||
} | } | ||
gDefer = false; | gDefer = false; | ||
Line 83: | Line 88: | ||
</pre> | </pre> | ||
<recalculate> and its friends and scripts call the functions directly (exposed in nsIXFormsModelElement), which bypasses both events and the queue. | |||
[[User:Beaufour|Beaufour]] | [[User:Beaufour|Beaufour]] 02:10, 16 May 2006 (PDT) |
edits