diff options
Diffstat (limited to 'vendor/oojs/oojs-ui/src/ToolGroupFactory.js')
-rw-r--r-- | vendor/oojs/oojs-ui/src/ToolGroupFactory.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/oojs/oojs-ui/src/ToolGroupFactory.js b/vendor/oojs/oojs-ui/src/ToolGroupFactory.js new file mode 100644 index 00000000..109b86e8 --- /dev/null +++ b/vendor/oojs/oojs-ui/src/ToolGroupFactory.js @@ -0,0 +1,38 @@ +/** + * Factory for tool groups. + * + * @class + * @extends OO.Factory + * @constructor + */ +OO.ui.ToolGroupFactory = function OoUiToolGroupFactory() { + // Parent constructor + OO.Factory.call( this ); + + var i, l, + defaultClasses = this.constructor.static.getDefaultClasses(); + + // Register default toolgroups + for ( i = 0, l = defaultClasses.length; i < l; i++ ) { + this.register( defaultClasses[ i ] ); + } +}; + +/* Setup */ + +OO.inheritClass( OO.ui.ToolGroupFactory, OO.Factory ); + +/* Static Methods */ + +/** + * Get a default set of classes to be registered on construction + * + * @return {Function[]} Default classes + */ +OO.ui.ToolGroupFactory.static.getDefaultClasses = function () { + return [ + OO.ui.BarToolGroup, + OO.ui.ListToolGroup, + OO.ui.MenuToolGroup + ]; +}; |