forked from maqetta/maqetta
-
Notifications
You must be signed in to change notification settings - Fork 0
Notes on application states
JonFerraiolo edited this page Apr 4, 2012
·
3 revisions
When changing color on an HTML button, here is the stack trace upon entering davinci.ve._Widget.js:setStyleValues():
****[6] declare.setStyleValues (_Widget.js:559)
****[5] declare.execute (StyleCommand.js:69)
dojo.withDoc (window.js:107)
declare.execute (CommandStack.js:24)
****[4] declare._stylePropertiesChange (VisualEditor.js:260)
****[3] declare._stylePropertiesChange (PageEditor.js:150)
hitch (lang.js:155)
target.(anonymous function) (aspect.js:181)
on.emit (on.js:261)
on.emit (on.js:297)
Evented.emit (Evented.js:28)
publish (topic.js:21)
connect.publish (connect.js:193)
****[2] declare._changeValue (Cascade.js:302)
innerChangeValueFunc (Cascade.js:188)
****[1] declare._onFieldChange (Cascade.js:257)
hitch (lang.js:153)
target.(anonymous function) (aspect.js:181)
declare._onChange (ColorPicker.js:190)
hitch (lang.js:153)
target.(anonymous function) (aspect.js:181)
(anonymous function) (_FormWidgetMixin.js:191)
hitch (lang.js:155)
Explanation about what's going on:
- [1] The input text field on the Properties palette has been changed, triggering on onChange event, which ultimately takes us into _onFieldChange within davinci.ve.widgets.Cascade.js
- [2] Ultimately, function _changeValue is invoked. This routine causes the "model" and the onscreen canvas to get updated with the new style property value, which is accomplished by publishing a "/davinci/ui/styleValuesChange" event using dojo.publish() that tells the rest of the product to "go change style values)
- [3] davinci.ve.PageEditor.js has established a dojo.subscribe to listen for the "/davinci/ui/styleValuesChange" event. This routine simply invokes davinci.ve.VisualEditor.js:_stylePropertiesChange().
- [4] davinci.ve.VisualEditor.js:_stylePropertiesChange() creates an appropriate StyleCommand and then flushes the command stack.
- [5] davinci.ve.commmands.StyleCommand.js:execute() actually causes the model and the onscreen canvas to change in the context of the undo stack. But the actual change to the model and onscreen canvas happens with...
- [6] davinci.ve._Widget.js:setStyleValues(), which updates the model and onscreen canvas (see below).
setStyleValues: function( values) {
if(!values) {
return;
}
var styleDomNode = this.getStyleNode();
var v = this._sortStyleValues(values);
var text = this._styleText(v);
/* reset the style attribute */
dojo.attr(styleDomNode, "style", text);
if (this.dijitWidget)
this.dijitWidget.style = text;
if (text.length>0)
this._srcElement.addAttribute("style",text);
else
this._srcElement.removeAttribute("style");
},