PropertyManager.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** IBM Cognos Products: mdsrv
  5. **
  6. ** (C) Copyright IBM Corp. 2008, 2010
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *****************************************************************/
  10. //***********************************************************************************************
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  12. // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  13. //
  14. // Component: Property pane of the Technical view
  15. // Comment: class CPropertyMgr contains all the functionality of the property pane
  16. // used in the Technical view
  17. //***********************************************************************************************
  18. var g_bStandalone = typeof MDSRV_techView_StringManager == "undefined";
  19. function PropertyPair( prop_name, prop_value )
  20. {
  21. this.name = prop_name;
  22. this.value = prop_value;
  23. }
  24. function CPropertyPane( id_prop_table )
  25. {
  26. this.id = id_prop_table;
  27. this.modelObject = null;
  28. this.tableAPI = new CPropertyTable ( id_prop_table );
  29. this.loadProperties = function( propTableId )
  30. {
  31. // var Page = document.getElementById( "id_property_pane" );
  32. var Table = document.getElementById( this.id );
  33. Table.style.display = "";
  34. }
  35. this.show = function( bShow )
  36. {
  37. var cssHelper = new CElementStyleHelper ( this.id );
  38. cssHelper.show ( bShow );
  39. }
  40. this.updateObject = function( modelObject )
  41. {
  42. this.modelObject = modelObject;
  43. this.show( this.modelObject ? true : false );
  44. }
  45. CPropertyPane.prototype.clearContents = function( )
  46. {
  47. this.tableAPI.Clear();
  48. }
  49. CPropertyPane.prototype.refreshContents = function()
  50. {
  51. this.clearContents();
  52. if ( this.modelObject )
  53. {
  54. this.tableAPI.AppendObjPropList ( this.modelObject );
  55. /*
  56. for ( var i in this.modelObject.propertyList )
  57. {
  58. var propPair = new PropertyPair( this.modelObject.getPropertyDisplayName(i), this.modelObject.getPropertyValue(i) );
  59. this.appendRow( propPair );
  60. }
  61. */
  62. }
  63. }
  64. CPropertyPane.prototype.appendRow = function( propertyPair )
  65. {
  66. this.tableAPI.AppendRow( propertyPair );
  67. }
  68. }
  69. //----------------------------------------------------------------------------
  70. // CPropertyMgr
  71. //----------------------------------------------------------------------------
  72. function CPropertyMgr ( propertyPaneQuery, propertyPaneItem )
  73. {
  74. this.m_propertyPaneQuery = propertyPaneQuery;
  75. this.m_propertyPaneItem = propertyPaneItem;
  76. this.m_modelSQ = null;
  77. this.m_modelQI = null;
  78. this.updateObjects = function( modelSQ, modelQI )
  79. {
  80. this.m_modelSQ = modelSQ;
  81. this.m_modelQI = modelQI;
  82. // Update Property Caption
  83. var elemObjectName = document.getElementById( "id_property_table_caption_object" );
  84. if ( elemObjectName )
  85. {
  86. var dispName = this.m_modelQI ? this.m_modelQI.getName() : ( this.m_modelSQ ? this.m_modelSQ.getName() : "" );
  87. //we need to convert any < > symbols in the string to their html entities, the former formatting to convert &apos to ' was unnecessary as innerHTML processes these entities
  88. var escapedDispName = escapeHTML ( dispName );
  89. if ( ! g_bStandalone )
  90. {
  91. var lblDispName = MDSRV_techView_StringManager.stringLookup( 'properties_for', escapedDispName );
  92. elemObjectName.innerHTML = lblDispName;
  93. }
  94. else
  95. {
  96. elemObjectName.innerHTML = "Properties for " + escapedDispName;
  97. }
  98. }
  99. // Update Property Panes
  100. if ( this.m_propertyPaneQuery )
  101. {
  102. this.m_propertyPaneQuery.updateObject( this.m_modelSQ );
  103. this.m_propertyPaneQuery.refreshContents();
  104. }
  105. if ( this.m_propertyPaneItem )
  106. {
  107. this.m_propertyPaneItem.updateObject( this.m_modelQI );
  108. this.m_propertyPaneItem.refreshContents();
  109. }
  110. }
  111. }