X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=blobdiff_plain;f=src%2Fmkws-widget.js;h=4cace293c2025351d227161f2968715517153d08;hp=33c977fe86ba6d141ecf74d868dc7deb0be90dc3;hb=058ce4a204a9ce4d63b2d319037f60cd9f94ff1b;hpb=d239fb9425b458b7d8f7a72029e7677801dbbe3b diff --git a/src/mkws-widget.js b/src/mkws-widget.js index 33c977f..4cace29 100644 --- a/src/mkws-widget.js +++ b/src/mkws-widget.js @@ -1,5 +1,5 @@ // Factory function for widget objects. -function widget($, team, type, node) { +mkws.makeWidget = function($, team, type, node) { // Static register of attributes that do not contribute to config var ignoreAttrs = { id:1, 'class':1, style:1, name:1, action:1, type:1, size:1, @@ -10,13 +10,15 @@ function widget($, team, type, node) { team: team, type: type, node: $(node), - config: mkws.objectInheritingFrom(team.config()) + config: mkws.objectInheritingFrom(team.config) }; - function log(s) { - team.log(s); - } - that.log = log; + that.trace = team.trace; + that.debug = team.debug; + that.info = team.info; + that.warn = team.warn; + that.error = team.error; + that.fatal = team.fatal; that.toString = function() { return '[Widget ' + team.name() + ':' + type + ']'; @@ -38,26 +40,26 @@ function widget($, team, type, node) { for (var name in this.config) { if (this.config.hasOwnProperty(name)) { attrs[name] = this.config[name]; - log(this + " copied property " + name + "='" + attrs[name] + "' to " + type + " subwidget"); + this.info(this + " copied property " + name + "='" + attrs[name] + "' to " + type + " subwidget"); } } for (var name in overrides) { + this.info(this + " overrode property " + name + "='" + overrides[name] + "' (was '" + attrs[name] + "') for " + type + " subwidget"); attrs[name] = overrides[name]; - log(this + " overrode property " + name + "='" + attrs[name] + "' for " + type + " subwidget"); } if (defaults) { for (var name in defaults) { if (!attrs[name]) { attrs[name] = defaults[name]; - log(this + " fell back to default property " + name + "='" + attrs[name] + "' for " + type + " subwidget"); + this.info(this + " fell back to default property " + name + "='" + attrs[name] + "' for " + type + " subwidget"); } } } var s = []; - s.push('