1 /**
  2  * An object encompassing a set of tools.  Tools are stored in sequence in an array.
  3  * @author Andrew
  4  */
  5 
  6 Monk.component.Toolset = function(config) {
  7     
  8     this.initialConfig = config;
  9     this.tools = this.initialConfig.tools || new Ext.util.MixedCollection(); // the list of tools
 10     this.pathToIcon = this.initialConfig.pathToIcon || Ext.BLANK_IMAGE_URL;
 11     this.id = this.initialConfig.id || 'default-id';
 12     this.label = this.initialConfig.label || "Toolset";
 13     this.description = this.initialConfig.description || "Toolset";
 14     this.worksetId = this.initialConfig.worksetId || null;
 15     this.shareable = this.initialConfig.shareable != null ? this.initialConfig.shareable : true;
 16 
 17 }
 18     
 19 /**
 20  * Returns the total amount of tool steps
 21  */
 22 Monk.component.Toolset.prototype.getToolsCount = function() {
 23     return this.tools.getCount();
 24 }
 25     
 26 /**
 27  * Get the tool at a specific point in the toolset.
 28  * @param {String/Integer} key The key or index at which to retrieve the tool
 29  * @return {Array} returns array of components
 30  */
 31 Monk.component.Toolset.prototype.getToolAt = function(key) {
 32     return this.tools.get(key).components;
 33 }
 34     
 35 /**
 36  * Get the label for a specific tool.
 37  * @param {String/Integer} key The key or index at which to retrieve the label
 38  * @return {String} returns the label
 39  */
 40 Monk.component.Toolset.prototype.getLabelAt = function(key) {
 41     return this.tools.get(key).label;
 42 }
 43 
 44 /**
 45  * Store the window layouts for a tool
 46  * @param {String} key The key or index for the tool
 47  * @param {Array} windowLayouts An array of window coordinates
 48  */
 49 Monk.component.Toolset.prototype.setWindowLayouts = function(key, windowLayouts) {
 50     this.tools.get(key).layouts = windowLayouts;
 51 }
 52 
 53 /**
 54  * Get the window layouts for a tool
 55  * @param {String} key The key or index for the tool
 56  * @return {Array} The array of window layouts
 57  */
 58 Monk.component.Toolset.prototype.getWindowLayouts = function(key) {
 59     return this.tools.get(key).layouts;
 60 }
 61 
 62 
 63 /**
 64  * Sets the workset ID associated with this toolset
 65  * @param {String} key The key or index for the tool
 66  */
 67 Monk.component.Toolset.prototype.setWorksetId = function(worksetId) {
 68     this.worksetId = worksetId;
 69 }
 70 
 71 /**
 72  * Gets the workset ID associated with this toolset
 73  */
 74 Monk.component.Toolset.prototype.getWorksetId = function() {
 75     return this.worksetId;
 76 }