FeaturesPane.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Cognos Analytics
  5. * Copyright IBM Corp. 2015, 2016
  6. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. */
  8. define(['underscore', 'q', 'bi/admin/nls/StringResource', 'bi/commons/ui/View', 'bi/commons/ui/StandardLayoutView', 'bi/admin/account/slideout/features/FeaturesHeader', 'bi/admin/account/slideout/features/FeaturesBody', 'bi/admin/account/slideout/features/FeaturesFooter'], function (_, Q, StringResource, View, StandardLayoutView, FeaturesHeader, FeaturesBody, FeaturesFooter) {
  9. 'use strict'; //NOSONAR
  10. var FeaturesPane = View.extend({
  11. init: function init(options) {
  12. FeaturesPane.inherited('init', this, arguments);
  13. _.extend(this, options);
  14. this._standardLayoutView = new StandardLayoutView();
  15. this._standardLayoutView.headerView = this._createHeader();
  16. this._standardLayoutView.footerView = this._createFooter();
  17. this._body = this._createBody();
  18. this._body.$el = this._standardLayoutView.$standardBody;
  19. this._standardLayoutView.bodyView = this._body;
  20. this.$el = this._standardLayoutView.$el;
  21. },
  22. _createHeader: function _createHeader() {
  23. return new FeaturesHeader({
  24. 'onFilter': this.filter.bind(this)
  25. });
  26. },
  27. _createFooter: function _createFooter() {
  28. return new FeaturesFooter({
  29. 'onReset': this.reset.bind(this),
  30. 'onApply': this.onApply ? this.onApply.bind(this) : null,
  31. 'isCustomized': this.isCustomized
  32. });
  33. },
  34. setFocus: function setFocus() {
  35. this.$el.find(".standardHeader .propertyUIControl").focus();
  36. },
  37. _createBody: function _createBody() {
  38. return new FeaturesBody({
  39. 'glassContext': this.glassContext,
  40. 'slideout': this.slideout,
  41. 'objectInfo': this.objectInfo,
  42. 'onChange': function (featureId, checked) {
  43. this._standardLayoutView.footerView.setModified(true);
  44. if (this.onChange) {
  45. this.onChange(featureId, checked);
  46. }
  47. }.bind(this),
  48. 'getPerspectives': this.getPerspectives ? this.getPerspectives.bind(this) : null,
  49. 'getExcludeList': this.getExcludeList ? this.getExcludeList.bind(this) : null
  50. });
  51. },
  52. remove: function remove() {
  53. this._standardLayoutView.remove();
  54. },
  55. reset: function reset() {
  56. this._body.reset();
  57. if (this.onReset) {
  58. this.onReset();
  59. if (this.getExcludeList().ids.length === 0) {
  60. this._standardLayoutView.footerView.setModified(false);
  61. }
  62. }
  63. },
  64. render: function render() {
  65. return this._standardLayoutView.render();
  66. },
  67. filter: function filter(value) {
  68. this._body.filter(value);
  69. }
  70. });
  71. return FeaturesPane;
  72. });