dl
Version:
DreamLab Libs
46 lines (33 loc) • 1.27 kB
JavaScript
var CdfBlock = require('./CdfBlock.js').CdfBlock,
CdfTemplate = require('./CdfTemplate.js').CdfTemplate;
var CdfComponent = function (data) {
CdfBlock.call(this);
this.cache = CdfBlock.Cache.Label.NONE;
this.onError = CdfBlock.onError.PROPAGATE;
if (data) {
this.token = data;
this._parse();
}
this._defaultTemplate = new CdfTemplate();
this._defaultTemplate.name = "blockLayout";
this._defaultTemplate.role = "blockLayout";
this._defaultTemplate.kind = "mobileLayouts";
this._defaultTemplate.cache = CdfBlock.Cache.Label.NONE;
};
CdfComponent.prototype = Object.create(CdfBlock.prototype);
CdfComponent.prototype.setDefaultTemplate = function (tpl) {
var childrens = this._defaultTemplate.children;
this._defaultTemplate = tpl;
this._defaultTemplate.children = childrens;
};
CdfComponent.prototype.addChild = function (cdfTemplate) {
this._defaultTemplate.addChild(cdfTemplate);
};
CdfComponent.prototype.getChild = function (name) {
return this._defaultTemplate.getChild(name);
};
CdfComponent.prototype.toString = function () {
this.setBody(this._defaultTemplate.toString());
return CdfBlock.prototype.toString.call(this);
};
exports.CdfComponent = CdfComponent;