Engine is responsible for the injection of component attributes. The injection requires component constructor to 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 } }; BTTUtil.extend(BTTRow, BTTComponentBase); //let BTTRow inherit BTTComponentBase
In fact, besides injection of attributes, which are provided with getter and setter methods, the engine also do some other injections. For example, if you do not specify the id of one component, the engine will generate a unique number and assign it to the attribute ID of this component instance.
The infrastructure of IOC engine is shown as follows.