2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
module.exports = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
|
|
|
Extends: Vn.Object
|
2015-03-06 23:33:54 +00:00
|
|
|
,Properties:
|
|
|
|
{
|
2016-10-14 10:58:35 +00:00
|
|
|
node:
|
|
|
|
{
|
|
|
|
type: Object
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._node;
|
|
|
|
}
|
|
|
|
},
|
2015-03-06 23:33:54 +00:00
|
|
|
class:
|
|
|
|
{
|
|
|
|
type: String
|
|
|
|
,set: function (x)
|
|
|
|
{
|
2016-05-02 13:05:49 +00:00
|
|
|
this._cssClass = x;
|
|
|
|
this._refreshClass ();
|
2015-03-06 23:33:54 +00:00
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
2016-10-14 10:58:35 +00:00
|
|
|
return this._node.className;
|
2015-03-06 23:33:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
/** Main HTML node that represents the widget **/
|
2016-10-14 10:58:35 +00:00
|
|
|
,_node: null
|
2015-03-06 23:33:54 +00:00
|
|
|
,builder: null
|
|
|
|
|
|
|
|
,builderInit: function (path)
|
|
|
|
{
|
2015-11-09 08:14:33 +00:00
|
|
|
var builder = new Vn.Builder ();
|
|
|
|
builder.signalData = this;
|
|
|
|
builder.loadXml (path);
|
2016-09-26 09:28:47 +00:00
|
|
|
this.builderResultInit (builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
,builderInitString: function (xmlString)
|
|
|
|
{
|
|
|
|
var builder = new Vn.Builder ();
|
|
|
|
builder.signalData = this;
|
|
|
|
builder.loadFromString (xmlString);
|
|
|
|
this.builderResultInit (builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
,builderResultInit: function (builder)
|
|
|
|
{
|
2015-11-09 08:14:33 +00:00
|
|
|
var res = this.builder = builder.load ();
|
2016-10-14 10:58:35 +00:00
|
|
|
this._node = res.$('main');
|
2015-11-17 10:34:33 +00:00
|
|
|
res.link ();
|
2015-03-06 23:33:54 +00:00
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
,createElement: function (tagName)
|
|
|
|
{
|
2016-10-14 10:58:35 +00:00
|
|
|
this._node = document.createElement (tagName);
|
|
|
|
return this._node;
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,getNode: function ()
|
|
|
|
{
|
2016-10-14 10:58:35 +00:00
|
|
|
if (!this._node)
|
2016-05-02 13:05:49 +00:00
|
|
|
{
|
|
|
|
this._createNode ();
|
|
|
|
this._refreshClass ();
|
|
|
|
}
|
|
|
|
|
2016-10-14 10:58:35 +00:00
|
|
|
return this._node;
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
2016-05-02 13:05:49 +00:00
|
|
|
|
2016-05-06 12:09:15 +00:00
|
|
|
,_createNode: function () {}
|
2016-05-02 13:05:49 +00:00
|
|
|
|
2016-05-06 12:09:15 +00:00
|
|
|
,_refreshClass: function ()
|
2016-05-02 13:05:49 +00:00
|
|
|
{
|
2016-10-14 10:58:35 +00:00
|
|
|
if (this._node && this._cssClass)
|
|
|
|
this._node.className = this._cssClass +' '+ this._node.className;
|
2016-05-02 13:05:49 +00:00
|
|
|
}
|
2015-03-09 08:36:54 +00:00
|
|
|
|
2015-03-06 23:33:54 +00:00
|
|
|
,$: function (id)
|
|
|
|
{
|
|
|
|
if (this.builder)
|
2015-11-09 08:14:33 +00:00
|
|
|
return this.builder.getById (id);
|
2015-03-06 23:33:54 +00:00
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2015-03-15 12:44:57 +00:00
|
|
|
|
|
|
|
,remove: function ()
|
|
|
|
{
|
2016-10-14 10:58:35 +00:00
|
|
|
Vn.Node.remove (this._node);
|
2015-03-15 12:44:57 +00:00
|
|
|
}
|
2015-09-11 09:37:16 +00:00
|
|
|
|
|
|
|
,_destroy: function ()
|
|
|
|
{
|
|
|
|
if (this.builder)
|
|
|
|
this.builder.unref ();
|
|
|
|
|
|
|
|
this.parent ();
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
});
|
2016-09-26 09:28:47 +00:00
|
|
|
|