forked from verdnatura/hedera-web
53 lines
1.0 KiB
JavaScript
53 lines
1.0 KiB
JavaScript
|
|
||
|
Vn.Module = new Class
|
||
|
({
|
||
|
initialize: function (gui, module)
|
||
|
{
|
||
|
this.gui = gui;
|
||
|
this.conn = gui.conn;
|
||
|
this.hash = gui.hash;
|
||
|
this.module = module;
|
||
|
|
||
|
this.builder = new Vn.Builder ();
|
||
|
this.html = this.builder.addFromXml (module.xml.responseXML);
|
||
|
|
||
|
var models = this.builder.getObjects ('db-model');
|
||
|
|
||
|
for (var i = 0; i < models.length; i++)
|
||
|
models[i].conn = this.conn;
|
||
|
|
||
|
var hashLinks = this.builder.getObjects ('vn-hash-link');
|
||
|
|
||
|
for (var i = 0; i < hashLinks.length; i++)
|
||
|
hashLinks[i].hash = this.hash;
|
||
|
|
||
|
gui.formHolder.appendChild (this.html);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Gets an object from the builder associated to this module.
|
||
|
*
|
||
|
* @param {string} objectId The object identifier
|
||
|
* @return {Object} The object, or %null if not found
|
||
|
**/
|
||
|
,get: function (objectId)
|
||
|
{
|
||
|
return this.builder.get (objectId);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Called when the module is opened.
|
||
|
**/
|
||
|
,activate: function () {}
|
||
|
|
||
|
/**
|
||
|
* Called when the module is closed.
|
||
|
**/
|
||
|
,close: function ()
|
||
|
{
|
||
|
Vn.Node.remove (this.html);
|
||
|
this.builder.destroy ();
|
||
|
}
|
||
|
});
|
||
|
|