2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
Vn.Module = new Class
|
|
|
|
({
|
2015-01-31 01:05:12 +00:00
|
|
|
initialize: function (gui, formInfo)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
|
|
|
this.gui = gui;
|
|
|
|
this.conn = gui.conn;
|
|
|
|
this.hash = gui.hash;
|
2015-01-31 01:05:12 +00:00
|
|
|
this.formInfo = formInfo;
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
this.builder = new Vn.Builder ();
|
2015-03-06 23:33:54 +00:00
|
|
|
this.builder.loadXml (Vn.getXml ('forms/'+ formInfo.path +'/ui.xml'));
|
|
|
|
this.node = this.builder.get ('form');
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
gui.formHolder.appendChild (this.node);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-01-31 01:05:12 +00:00
|
|
|
* Gets an object from the builder associated to this form.
|
2015-01-23 13:09:30 +00:00
|
|
|
*
|
|
|
|
* @param {string} objectId The object identifier
|
|
|
|
* @return {Object} The object, or %null if not found
|
|
|
|
**/
|
2015-03-06 23:33:54 +00:00
|
|
|
,$: function (objectId)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
|
|
|
return this.builder.get (objectId);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-01-31 01:05:12 +00:00
|
|
|
* Called when the form is opened.
|
2015-01-23 13:09:30 +00:00
|
|
|
**/
|
|
|
|
,activate: function () {}
|
|
|
|
|
|
|
|
/**
|
2015-01-31 01:05:12 +00:00
|
|
|
* Called when the form is closed.
|
2015-01-23 13:09:30 +00:00
|
|
|
**/
|
|
|
|
,close: function ()
|
|
|
|
{
|
2015-03-06 23:33:54 +00:00
|
|
|
Vn.Node.remove (this.node);
|
2015-01-23 13:09:30 +00:00
|
|
|
this.builder.destroy ();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|