forked from verdnatura/hedera-web
60 lines
1.2 KiB
JavaScript
Executable File
60 lines
1.2 KiB
JavaScript
Executable File
|
|
Vn.Module = new Class
|
|
({
|
|
initialize: function (gui, formInfo)
|
|
{
|
|
this.gui = gui;
|
|
this.conn = gui.conn;
|
|
this.hash = gui.hash;
|
|
this.formInfo = formInfo;
|
|
|
|
this.builder = new Vn.Builder ();
|
|
this.builder.signalData = this;
|
|
this.builder.loadXml (Vn.getXml ('forms/'+ formInfo.path +'/ui.xml'));
|
|
this.node = this.builder.get ('form');
|
|
|
|
var models = this.builder.getObjects ('db-model');
|
|
|
|
for (var i = 0; i < models.length; i++)
|
|
models[i].conn = this.conn;
|
|
|
|
var queries = this.builder.getObjects ('db-query');
|
|
|
|
for (var i = 0; i < queries.length; i++)
|
|
queries[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.node);
|
|
}
|
|
|
|
/**
|
|
* Gets an object from the builder associated to this form.
|
|
*
|
|
* @param {string} objectId The object identifier
|
|
* @return {Object} The object, or %null if not found
|
|
**/
|
|
,$: function (objectId)
|
|
{
|
|
return this.builder.get (objectId);
|
|
}
|
|
|
|
/**
|
|
* Called when the form is opened.
|
|
**/
|
|
,activate: function () {}
|
|
|
|
/**
|
|
* Called when the form is closed.
|
|
**/
|
|
,close: function ()
|
|
{
|
|
Vn.Node.remove (this.node);
|
|
this.builder.destroy ();
|
|
}
|
|
});
|
|
|