ViewerFindActionConfig.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2013
  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 ViewerFindActionConfig() {
  13. //PUBLIC API - Do not change. Start
  14. this.noMatchFoundCallback = null;
  15. this.findActionCompleteCallback = null;
  16. this.matchBackgroundColor = "yellow";
  17. this.focusBackgroundColor = "red";
  18. //PUBLIC API - Do not change. End
  19. this.updateStyle();
  20. }
  21. ViewerFindActionConfig.BACKGROUND = 'background: ';
  22. ViewerFindActionConfig.prototype.configure = function(configuration) {
  23. applyJSONProperties(this, configuration);
  24. this.updateStyle();
  25. };
  26. ViewerFindActionConfig.prototype.updateStyle = function() {
  27. this.matchBackgroundColor = this.matchBackgroundColor.toUpperCase();
  28. this.focusBackgroundColor = this.focusBackgroundColor.toUpperCase();
  29. this.matchUIStyle = ViewerFindActionConfig.BACKGROUND + this.matchBackgroundColor;
  30. this.focusUIStyle = ViewerFindActionConfig.BACKGROUND + this.focusBackgroundColor;
  31. }
  32. ViewerFindActionConfig.prototype.getNoMatchFoundCallback = function() {
  33. return typeof this.noMatchFoundCallback == "function" ? this.noMatchFoundCallback : this._defaultNoMatchFoundCallback;
  34. };
  35. ViewerFindActionConfig.prototype._defaultNoMatchFoundCallback = function() {
  36. if (console && console.log) {
  37. console.log('invoked _defaultNoMatchFoundCallback!');
  38. }
  39. }
  40. ViewerFindActionConfig.prototype.getFindActionCompleteCallback = function() {
  41. return typeof this.findActionCompleteCallback == "function" ? this.findActionCompleteCallback : this._defaultFindActionCompleteCallback;
  42. };
  43. ViewerFindActionConfig.prototype._defaultFindActionCompleteCallback = function() {
  44. if (console && console.log) {
  45. console.log('invoked _defaultFindActionCompleteCallback!');
  46. }
  47. }
  48. ViewerFindActionConfig.prototype.getMatchUIStyle = function() {
  49. return this.matchUIStyle;
  50. };
  51. ViewerFindActionConfig.prototype.getFocusUIStyle = function() {
  52. return this.focusUIStyle;
  53. };
  54. ViewerFindActionConfig.prototype.getMatchColor = function() {
  55. return this.matchBackgroundColor;
  56. };
  57. ViewerFindActionConfig.prototype.getFocusColor = function() {
  58. return this.focusBackgroundColor;
  59. };
  60. ViewerFindActionConfig.prototype.isFocusColorSameAsMatch = function() {
  61. return (this.focusBackgroundColor === this.matchBackgroundColor)
  62. };