Engine is responsible for injection of component attributes. The injection requires component constructor provide the corresponding getter and setter method.
<?xml version="1.0" encoding="UTF-8"?> <PageFormatter> <Page id="page1"> <Row draggable="1" id="row_b1223959791733" title="html_service"/> </Page> </PageFormatter>
function BTTRow(){} BTTRow.prototype= { title: null, draggable: null, getTitle: function(){ return this.title; }, setTitle: function(title){ this.title = title; }, getDraggable:function(){ return this.draggable; }, setDraggable:function(draggable){ this.draggable=draggable } }; BTTRow.extend (BTTComponentBase); //let BTTRow inherit BTTComponentBase
In fact, besides injection of attribute which is provided with getter and setter methods, the engine also do some other injections. For example, if you don't specify the id of one component, the engine will generate a unique number and assign it to id attribute of this component instance.
The infrastructure of IOC engine is shown as follows.