CApplicationManager.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** BI and PM: qs
  5. **
  6. ** (C) Copyright IBM Corp. 2001, 2015
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or
  9. ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *****************************************************************/
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
  12. // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
  13. var APPLICATION_PUSH_FAILED = -1;
  14. var APPLICATION_POP_FAILED = -2;
  15. function CApplicationManager()
  16. {
  17. this.m_oFormMgr = null;
  18. this.m_oFeatureMgr = null;
  19. this.m_oWindowMgr = null;
  20. this.m_oMiniQueryMgr = null;
  21. this.m_oReportMgr = null;
  22. this.m_oFeatureRegistry = null;
  23. this.m_oUserPreferenceManager = null;
  24. };
  25. CApplicationManager.prototype = new CDictionary();
  26. CApplicationManager.prototype.init = function ()
  27. {
  28. this.add("productLocale", "en");
  29. this.add("contentLocale", "en-us");
  30. this.add("numRows", 20);
  31. this.add("scriptEngine", "");
  32. this.add("paperOrientation", "Portrait");
  33. this.add("paperSize", "Letter");
  34. this.add("scaleToPage", true);
  35. };
  36. CApplicationManager.prototype.getFormManager = function ()
  37. {
  38. if (this.m_oFormMgr === null && typeof CFormManager == "function")
  39. {
  40. this.m_oFormMgr = new CFormManager();
  41. }
  42. return this.m_oFormMgr;
  43. };
  44. CApplicationManager.prototype.getFeatureManager = function ()
  45. {
  46. if (this.m_oFeatureMgr === null && typeof CFeatureManager == "function")
  47. {
  48. this.m_oFeatureMgr = new CFeatureManager();
  49. }
  50. return this.m_oFeatureMgr;
  51. };
  52. CApplicationManager.prototype.getUserPreferenceManager = function ()
  53. {
  54. if (this.m_oUserPreferenceManager === null && typeof CUserPreferenceManager == "function")
  55. {
  56. this.m_oUserPreferenceManager = new CUserPreferenceManager();
  57. }
  58. return this.m_oUserPreferenceManager;
  59. };
  60. CApplicationManager.prototype.getWindowManager = function ()
  61. {
  62. if (this.m_oWindowMgr === null && typeof CWindowManager == "function")
  63. {
  64. this.m_oWindowMgr = new CWindowManager();
  65. }
  66. return this.m_oWindowMgr;
  67. };
  68. CApplicationManager.prototype.getMiniQueryManager = function ()
  69. {
  70. if (this.m_oMiniQueryMgr === null && typeof CMiniQueryManager == "function")
  71. {
  72. this.m_oMiniQueryMgr = new CMiniQueryManager();
  73. this.m_oMiniQueryMgr.init();
  74. }
  75. return this.m_oMiniQueryMgr;
  76. };
  77. CApplicationManager.prototype.getReportManager = function ()
  78. {
  79. if (this.m_oReportMgr === null && typeof CReportManager == "function")
  80. {
  81. this.m_oReportMgr = new CReportManager();
  82. this.m_oReportMgr.init();
  83. }
  84. return this.m_oReportMgr;
  85. };
  86. CApplicationManager.prototype.getFeatureRegistry = function ()
  87. {
  88. if (this.m_oFeatureRegistry === null)
  89. {
  90. this.m_oFeatureRegistry = this.getFeatureManager().getFeatureRegistry();
  91. }
  92. return this.m_oFeatureRegistry;
  93. };
  94. CApplicationManager.prototype.getSelectionController = function ()
  95. {
  96. return this.getReportManager().getCVSelectionController();
  97. };
  98. CApplicationManager.prototype.getApplicationFrame = function ()
  99. {
  100. return this.getWindowManager().getApplicationFrame();
  101. };
  102. CApplicationManager.prototype.getDialogFrame = function ()
  103. {
  104. return this.getWindowManager().getDialogFrame();
  105. };
  106. CApplicationManager.prototype.getReportFrame = function ()
  107. {
  108. return this.getWindowManager().getReportFrame();
  109. };
  110. CApplicationManager.prototype.push = function (sKey, oValue)
  111. {
  112. var aValues = this.get(sKey);
  113. if (aValues instanceof Array)
  114. {
  115. aValues[aValues.length] = oValue;
  116. }
  117. else if (typeof aValues == "undefined")
  118. {
  119. aValues = new Array();
  120. aValues[0] = oValue;
  121. }
  122. else
  123. {
  124. return APPLICATION_PUSH_FAILED;
  125. }
  126. this.add(sKey, aValues);
  127. };
  128. CApplicationManager.prototype.pop = function (sKey)
  129. {
  130. var aKeys = this.get(sKey);
  131. var oValue = null;
  132. if (aKeys instanceof Array && aKeys.length > 0)
  133. {
  134. oValue = aKeys[aKeys.length - 1];
  135. deleteArrayEntry(aKeys, oValue);
  136. }
  137. else
  138. {
  139. return APPLICATION_POP_FAILED;
  140. }
  141. if (aKeys instanceof Array && aKeys.length > 0)
  142. {
  143. this.add(sKey, aKeys);
  144. }
  145. else
  146. {
  147. this.remove(sKey);
  148. }
  149. return oValue;
  150. };
  151. CApplicationManager.prototype.clearMenus = function()
  152. {
  153. var arMenus = new Array();
  154. if (typeof gQsContextMenu == "object") arMenus.push(gQsContextMenu);
  155. if (typeof gQsChartContextMenu == "object") arMenus.push(gQsChartContextMenu);
  156. if (typeof gQsFiltersContextMenu == "object") arMenus.push(gQsFiltersContextMenu);
  157. if (typeof gQsFilterIconContextMenu == "object") arMenus.push(gQsFilterIconContextMenu);
  158. if (typeof gQsMetadataTreeContextMenu == "object") arMenus.push(gQsMetadataTreeContextMenu);
  159. if (typeof gQsSortsContextMenu == "object") arMenus.push(gQsSortsContextMenu);
  160. if (typeof gQsSortIconContextMenu == "object") arMenus.push(gQsSortIconContextMenu);
  161. if (typeof gQsSuppressContextMenu == "object") arMenus.push(gQsSuppressContextMenu);
  162. if (typeof gQsSuppressIconContextMenu == "object") arMenus.push(gQsSuppressIconContextMenu);
  163. for (var i = 0; i < arMenus.length; i++)
  164. {
  165. if (typeof arMenus[i].hide == "function")
  166. {
  167. arMenus[i].hide();
  168. }
  169. }
  170. var arToolbars = new Array();
  171. if (typeof gQsToolbar == "object") arToolbars.push(gQsToolbar);
  172. if (typeof gTopToolbar == "object") arToolbars.push(gTopToolbar);
  173. if (typeof gTopToolbarLogon == "object") arToolbars.push(gTopToolbarLogon);
  174. for (var i = 0; i < arToolbars.length; i++)
  175. {
  176. if (arToolbars[i] && typeof arToolbars[i].closeMenus == "function")
  177. {
  178. arToolbars[i].closeMenus();
  179. }
  180. }
  181. hidePickers();
  182. };
  183. var goApplicationManager = new CApplicationManager();
  184. goApplicationManager.init();