[imp] switched to nivjs
bzr revid: nicolas.vanhoren@openerp.com-20120223161041-mymbna11fsp3bo9m
This commit is contained in:
parent
2b73fb4a6a
commit
fa510462f4
|
@ -36,6 +36,7 @@
|
|||
"static/lib/underscore/underscore.string.js",
|
||||
"static/lib/labjs/LAB.src.js",
|
||||
"static/lib/py.parse/lib/py.js",
|
||||
"static/lib/nivjs/src/niv.js",
|
||||
"static/src/js/boot.js",
|
||||
"static/src/js/core.js",
|
||||
"static/src/js/dates.js",
|
||||
|
|
|
@ -24,7 +24,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
|
||||
niv = (function() {
|
||||
var niv = {};
|
||||
var lib = {};
|
||||
|
||||
/*
|
||||
* Simple JavaScript Inheritance By John Resig http://ejohn.org/ MIT
|
||||
|
@ -32,9 +32,12 @@ niv = (function() {
|
|||
*/
|
||||
// Inspired by base2 and Prototype
|
||||
(function() {
|
||||
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
var initializing = false, fnTest = /xyz/.test(function() {
|
||||
xyz;
|
||||
}) ? /\b_super\b/ : /.*/;
|
||||
// The base Class implementation (does nothing)
|
||||
this.Class = function(){};
|
||||
this.Class = function() {
|
||||
};
|
||||
|
||||
// Create a new Class that inherits from this class
|
||||
this.Class.extend = function(prop) {
|
||||
|
@ -49,9 +52,9 @@ niv = (function() {
|
|||
// Copy the properties over onto the new prototype
|
||||
for ( var name in prop) {
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function(name, fn){
|
||||
prototype[name] = typeof prop[name] == "function"
|
||||
&& typeof _super[name] == "function"
|
||||
&& fnTest.test(prop[name]) ? (function(name, fn) {
|
||||
return function() {
|
||||
var tmp = this._super;
|
||||
|
||||
|
@ -66,8 +69,7 @@ niv = (function() {
|
|||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
})(name, prop[name]) : prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
|
@ -88,41 +90,43 @@ niv = (function() {
|
|||
|
||||
return Class;
|
||||
};
|
||||
}).call(niv);
|
||||
}).call(lib);
|
||||
|
||||
niv.ParentedMixin = {
|
||||
lib.ParentedMixin = {
|
||||
__parented_mixin : true,
|
||||
setParent : function(parent) {
|
||||
if (this.getParent()) {
|
||||
if (this.getParent().__parented_mixin) {
|
||||
this.getParent().__parented_children = _.without(this.getParent().getChildren(), this);
|
||||
this.getParent().__parented_children = _.without(this
|
||||
.getParent().getChildren(), this);
|
||||
}
|
||||
this.__parented_parent = undefined;
|
||||
}
|
||||
this.__parented_parent = parent;
|
||||
if (parent && parent.__parented_mixin) {
|
||||
if (!parent.getChildren())
|
||||
if (!parent.__parented_children)
|
||||
parent.__parented_children = [];
|
||||
parent.getChildren().push(this);
|
||||
parent.__parented_children.push(this);
|
||||
}
|
||||
},
|
||||
getParent : function() {
|
||||
return this.__parented_parent;
|
||||
},
|
||||
getChildren : function() {
|
||||
return this.__parented_children ? _.clone(this.__parented_children) : [];
|
||||
return this.__parented_children ? _.clone(this.__parented_children)
|
||||
: [];
|
||||
},
|
||||
isDestroyed : function() {
|
||||
return this.__parented_stopped;
|
||||
return this.__parented_destroyed;
|
||||
},
|
||||
destroy : function() {
|
||||
_.each(this.getChildren(), function(el) {
|
||||
el.destroy();
|
||||
});
|
||||
this.setParent(undefined);
|
||||
this.__parented_stopped = true;
|
||||
},
|
||||
this.__parented_destroyed = true;
|
||||
}
|
||||
};
|
||||
|
||||
return niv;
|
||||
return lib;
|
||||
})();
|
||||
|
|
|
@ -925,40 +925,6 @@ openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.
|
|||
}
|
||||
});
|
||||
|
||||
openerp.web.ParentedMixin = {
|
||||
__parented_mixin: true,
|
||||
setParent: function(parent) {
|
||||
if(this.getParent()) {
|
||||
if (this.getParent().__parented_mixin) {
|
||||
this.getParent().__parented_children = _.without(this.getParent().getChildren(), this);
|
||||
}
|
||||
this.__parented_parent = undefined;
|
||||
}
|
||||
this.__parented_parent = parent;
|
||||
if(parent && parent.__parented_mixin) {
|
||||
if (!parent.__parented_children)
|
||||
parent.__parented_children = [];
|
||||
parent.__parented_children.push(this);
|
||||
}
|
||||
},
|
||||
getParent: function() {
|
||||
return this.__parented_parent;
|
||||
},
|
||||
getChildren: function() {
|
||||
return this.__parented_children ? _.clone(this.__parented_children) : [];
|
||||
},
|
||||
isDestroyed: function() {
|
||||
return this.__parented_destroyed;
|
||||
},
|
||||
destroy: function() {
|
||||
_.each(this.getChildren(), function(el) {
|
||||
el.destroy();
|
||||
});
|
||||
this.setParent(undefined);
|
||||
this.__parented_destroyed = true;
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for all visual components. Provides a lot of functionalities helpful
|
||||
* for the management of a part of the DOM.
|
||||
|
@ -1007,7 +973,7 @@ openerp.web.ParentedMixin = {
|
|||
*
|
||||
* That will kill the widget in a clean way and erase its content from the dom.
|
||||
*/
|
||||
openerp.web.Widget = openerp.web.CallbackEnabled.extend(openerp.web.ParentedMixin).extend(/** @lends openerp.web.Widget# */{
|
||||
openerp.web.Widget = openerp.web.CallbackEnabled.extend(niv.ParentedMixin).extend(/** @lends openerp.web.Widget# */{
|
||||
/**
|
||||
* The name of the QWeb template that will be used for rendering. Must be
|
||||
* redefined in subclasses or the default render() method can not be used.
|
||||
|
|
Loading…
Reference in New Issue