CSelectionFilterStyles.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2014
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. function CSelectionFilterStyles( selectionController )
  13. {
  14. this.m_selectionController = selectionController;
  15. this.m_primarySelectionColor = this.m_primarySelectionFilterColor = '#44BFDD';
  16. this.m_primarySelectionFilterColorForMeasure = null;
  17. this.m_secondarySelectionColor = null;
  18. this.m_highContrastBorderStyle = "dotted";
  19. this.m_secondarySelectionIsDisabled = true;
  20. };
  21. CSelectionFilterStyles.prototype = new CSelectionDefaultStyles( );
  22. CSelectionFilterStyles.prototype.getPrimarySelectionColor = function(contextIds)
  23. {
  24. return this.m_primarySelectionColor;
  25. };
  26. CSelectionFilterStyles.prototype.getSecondarySelectionColor = function()
  27. {
  28. return this.m_secondarySelectionColor;
  29. };
  30. CSelectionFilterStyles.prototype.getHighContrastBorderStyle = function()
  31. {
  32. return this.m_highContrastBorderStyle;
  33. };
  34. CSelectionFilterStyles.prototype.secondarySelectionIsDisabled = function()
  35. {
  36. return this.m_secondarySelectionIsDisabled;
  37. };
  38. CSelectionFilterStyles.prototype.canApplyToSelection = function( contextIds )
  39. {
  40. return !this.selectionHasOnlyMeasure( contextIds );
  41. };
  42. CSelectionFilterStyles.prototype.selectionHasOnlyMeasure = function( contextIds )
  43. {
  44. return ( contextIds.length === 1 && contextIds[0].length === 1 && this.m_selectionController.isMeasure(contextIds[0][0]) );
  45. };
  46. /**
  47. * Should be called just before applying styles to selection
  48. */
  49. CSelectionFilterStyles.prototype.setStyleForSelection = function( contextIds )
  50. {
  51. this.m_primarySelectionColor = ( this.selectionHasOnlyMeasure( contextIds)) ? null : this.m_primarySelectionFilterColor;
  52. };