'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2013, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * * VisController * The VisController object is a collection of methods that use the visModel and modify it. * */ define(['underscore', './VisActionHelper', './VisRenderSequence', '../../lib/@waca/core-client/js/core-client/ui/core/Events'], function (_, VisActionHelper, VisRenderSequence, Events) { 'use strict'; var VisController = null; // class declaration VisController = Events.extend({ init: function init(attributes) { VisController.inherited('init', this, [attributes]); this._visModel = attributes.visModel; //TODO: Deprecate this! this._visAPI = attributes.visAPI; this._ownerWidget = attributes.ownerWidget; this._visRenderSequence = new VisRenderSequence(attributes); this._visSelectionController = attributes.selectionController; this._visActionHelper = new VisActionHelper(_.extend(attributes, { selectionController: this._visSelectionController, content: this._ownerWidget.content })); attributes.cbGetActionsForFilter = this._visActionHelper.getActionsForLocalFilter.bind(this._visActionHelper); attributes.getNewFilterActionForContextColumn = this._visActionHelper.getNewFilterActionForContextColumn; //CONTROLLER SUB-INTERFACE METHODS /** * SELECTIONCONTROLLER API METHODS.....(selection controller methods exposed via visController directly). */ var sc = this._visSelectionController; //Main selection API's this.select = sc.select.bind(sc); this.getItemKeys = sc.getItemKeys.bind(sc); //Single column selection API's this.isItemSelected = sc.isItemSelected.bind(sc); this.isValueSelected = sc.isValueSelected.bind(sc); this.getSelectedValues = sc.getSelectedValues.bind(sc); this.getSelectedTuples = sc.getSelectedTuples.bind(sc); }, getAPI: function getAPI() { // Expose the controller as a deprecated feature for nwo return this; }, destroy: function destroy() { if (this._visSelectionController) { this._visSelectionController.remove(); this._visSelectionController = null; } if (this._visActionHelper) { this._visActionHelper.remove(); delete this._visActionHelper; } if (this._visRenderSequence) { this._visRenderSequence.remove(); delete this._visRenderSequence; } }, /** * @returns an object that handles 'actions' such as those that appear on the contextual toolbar * like filter and sort changes */ getActionHelper: function getActionHelper() { return this._visActionHelper; }, /** * @returns The render sequence object which controls the flow of rendering for all visualization types. */ getRenderSequence: function getRenderSequence() { return this._visRenderSequence; } }); return VisController; }); //# sourceMappingURL=VisController.js.map