2016-09-26 09:28:47 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
var NodeBuilder = require('./node-builder');
|
2016-10-16 14:16:08 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
module.exports = new Class({
|
2016-10-16 14:16:08 +00:00
|
|
|
Extends: NodeBuilder
|
2015-03-06 23:33:54 +00:00
|
|
|
,Properties:
|
|
|
|
{
|
2016-10-16 14:16:08 +00:00
|
|
|
/**
|
|
|
|
* Main HTML node that represents the widget
|
2022-05-24 21:11:12 +00:00
|
|
|
*/
|
|
|
|
node: {
|
2016-10-14 10:58:35 +00:00
|
|
|
type: Object
|
2022-05-24 21:11:12 +00:00
|
|
|
,get: function() {
|
|
|
|
this.renderBase();
|
2016-10-14 10:58:35 +00:00
|
|
|
return this._node;
|
|
|
|
}
|
|
|
|
},
|
2016-10-16 14:16:08 +00:00
|
|
|
/**
|
|
|
|
* CSS classes to be appendend to the node classes.
|
2022-05-24 21:11:12 +00:00
|
|
|
*/
|
|
|
|
class: {
|
2015-03-06 23:33:54 +00:00
|
|
|
type: String
|
2022-05-24 21:11:12 +00:00
|
|
|
,set: function(x) {
|
2016-05-02 13:05:49 +00:00
|
|
|
this._cssClass = x;
|
2022-05-24 21:11:12 +00:00
|
|
|
this._refreshClass();
|
2015-03-06 23:33:54 +00:00
|
|
|
}
|
2022-05-24 21:11:12 +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
|
|
|
|
2016-10-14 10:58:35 +00:00
|
|
|
,_node: null
|
2015-03-06 23:33:54 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
,initialize: function(props) {
|
2016-10-16 14:16:08 +00:00
|
|
|
this.doc = document;
|
2022-05-24 21:11:12 +00:00
|
|
|
this.renderBase();
|
|
|
|
this.parent(props);
|
2016-09-26 09:28:47 +00:00
|
|
|
}
|
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
,createRoot: function(tagName) {
|
|
|
|
return this._node = this.createElement(tagName);
|
2016-09-26 09:28:47 +00:00
|
|
|
}
|
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
,renderBase: function() {
|
2016-10-16 14:16:08 +00:00
|
|
|
if (this._node)
|
|
|
|
return;
|
2016-05-02 13:05:49 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
this.render();
|
|
|
|
this._refreshClass();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
2016-05-02 13:05:49 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
,_refreshClass: function() {
|
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-15 12:44:57 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
,remove: function() {
|
|
|
|
Vn.Node.remove(this._node);
|
2015-03-15 12:44:57 +00:00
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
});
|
2016-09-26 09:28:47 +00:00
|
|
|
|