Use an injection loop to produce all methods that simply forward from Palette to root Component.

This commit is contained in:
Jürg Lehni 2014-10-05 00:23:16 +02:00
parent 5456f1a595
commit 6e4c2ebc64

View file

@ -73,29 +73,13 @@
return this._values;
},
getTitle: function() {
return this._root.getTitle();
},
setTitle: function(title) {
return this._root.setTitle(title);
},
getEnabled: function() {
return this._root.getEnabled();
},
setEnabled: function(enabled) {
return this._root.setEnabled(enabled);
},
/**
* @name Palette#reset()
* @function
*
* Resets the values of the components to their
* {@link Component#defaultValue}.
*/
reset: function() {
this._root.reset();
},
remove: function() {
DomElement.remove(this._element);
@ -106,4 +90,11 @@
palettes.splice(index, 1);
return remove;
}
});
}, Base.each(['getTitle', 'setTitle', 'getEnabled', 'setEnabled', 'reset'],
function(name) {
this[name] = function() {
var root = this._root;
return root[name].apply(root, arguments);
}
}, {})
);