hedera-web/js/htk/component.js

57 lines
1014 B
JavaScript

var Widget = require ('./widget');
module.exports = new Class
({
Extends: Widget
,builder: null
,builderInit: function (path)
{
var builder = new Vn.Builder ();
builder.signalData = this;
builder.loadXml (path, this.doc);
this.builderResultInit (builder);
}
,builderInitString: function (xmlString)
{
var builder = new Vn.Builder ();
builder.signalData = this;
builder.loadFromString (xmlString, this.doc);
this.builderResultInit (builder);
}
,builderResultInit: function (builder)
{
var res = this.builder = builder.load ();
this._node = res.$('main');
res.link ();
return res;
}
/**
* Gets an object from the builder associated to this component.
*
* @param {string} objectId The object identifier
* @return {Object} The object, or %null if not found
*/
,$: function (id)
{
if (this.builder)
return this.builder.getById (id);
return null;
}
,_destroy: function ()
{
if (this.builder)
this.builder.unref ();
this.parent ();
}
});