C_QanEPNode_PropPane.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /****************************************************************************************************************************
  2. Licensed Materials - Property of IBM
  3. BI and PM: QFW
  4. © Copyright IBM Corp. 2005, 2010
  5. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. *****************************************************************************************************************************/
  7. function C_QanEPNode_PropPane( divNodeDetailsContainer )
  8. {
  9. this.m_divContainer = divNodeDetailsContainer;
  10. };
  11. C_QanEPNode_PropPane.prototype.F_Init = function()
  12. {
  13. if (!this.m_divContainer)
  14. return;
  15. var v_divHeader = this.m_divContainer.document.createElement( "div" );
  16. v_divHeader.className = "planDetailHeader";
  17. this.m_divContainer.appendChild( v_divHeader );
  18. var v_tblPropTitles = this.m_divContainer.document.createElement("table");
  19. v_tblPropTitles.className = "planPropTable";
  20. v_tblPropTitles.cellPadding = 0;
  21. v_tblPropTitles.cellSpacing = 0;
  22. v_tblPropTitles.width = "100%";
  23. v_divHeader.appendChild( v_tblPropTitles );
  24. this.m_trPropTitles = v_tblPropTitles.insertRow();
  25. this.m_divValueContainer = this.m_divContainer.document.createElement( "div" );
  26. this.m_divValueContainer.className = "planPropValue";
  27. this.m_divContainer.appendChild( this.m_divValueContainer );
  28. this.m_divValueContainer.innerText = " <Click on a node to show its properties> ";
  29. };
  30. C_QanEPNode_PropPane.prototype.F_SetProperties4Node = function( oPlanNode )
  31. {
  32. for( ; this.m_trPropTitles.cells.length > 0; this.m_trPropTitles.deleteCell() );
  33. if (!oPlanNode)
  34. return;
  35. //this.m_sNodeType = oPlanNode.F_GetCommandType();
  36. this.m_sNodeType = oPlanNode.F_GetOperationName();
  37. var v_tdType = this.m_trPropTitles.insertCell();
  38. v_tdType.className = "planNodeType";
  39. v_tdType.noWrap = "true";
  40. v_tdType.innerText = (this.m_sNodeType)? this.m_sNodeType: " ";
  41. var v_oParser = new C_QanParser();
  42. this.m_aPropName2Value = [];
  43. if( oPlanNode.F_GetNativeCommand() )
  44. {
  45. var v_tdSpacer = this.m_trPropTitles.insertCell();
  46. v_tdSpacer.innerText = " ";
  47. v_tdSpacer.width = "3px";
  48. var v_tdProp = this.m_trPropTitles.insertCell();
  49. v_tdProp.innerText = "native";
  50. // this.m_aPropName2Value["native"] = oPlanNode.F_GetNativeCommand();
  51. this.m_aPropName2Value["native"] =
  52. '<div class="formatted">' +
  53. v_oParser.F_TransformToHTML(
  54. v_oParser.F_TransformToXML( oPlanNode.F_GetNativeCommand(), this.m_sNodeType ) );
  55. '</div>';
  56. v_tdProp.onclick = this.f_title_onclick.F_CreateMethodCallback( this );
  57. }
  58. if( oPlanNode.F_GetCognosCommand() )
  59. {
  60. var v_tdSpacer = this.m_trPropTitles.insertCell();
  61. v_tdSpacer.innerText = " ";
  62. v_tdSpacer.width = "3px";
  63. var v_tdProp = this.m_trPropTitles.insertCell();
  64. v_tdProp.innerText = "Cognos";
  65. // this.m_aPropName2Value["Cognos"] = oPlanNode.F_GetCognosCommand();
  66. this.m_aPropName2Value["Cognos"] =
  67. '<div class="formatted">' +
  68. v_oParser.F_TransformToHTML(
  69. v_oParser.F_TransformToXML( oPlanNode.F_GetCognosCommand() ) );
  70. '</div>';
  71. v_tdProp.onclick = this.f_title_onclick.F_CreateMethodCallback( this );
  72. }
  73. var v_tdRemainder = this.m_trPropTitles.insertCell();
  74. v_tdRemainder.width = "100%";
  75. v_tdRemainder.innerText = " ";
  76. if( this.m_trPropTitles.children.length > 3 )
  77. this.f_showPropertyValue( this.m_trPropTitles.children[2], oPlanNode.F_GetName() );
  78. else
  79. this.m_divValueContainer.innerHTML = " No properties to show ";
  80. }
  81. C_QanEPNode_PropPane.prototype.f_showPropertyValue = function( tdProp, sNodeName )
  82. {
  83. var v_sPropName = tdProp.innerText;
  84. tdProp.className = "planActiveProperty";
  85. for( var i = 2; i < this.m_trPropTitles.children.length - 1; i += 2 )
  86. if( this.m_trPropTitles.children[i] != tdProp )
  87. this.m_trPropTitles.children[i].className = "planProperty";
  88. var v_divPropValue;
  89. var v_sPropKey = sNodeName + v_sPropName;
  90. var v_divChild = this.m_divValueContainer.firstChild;
  91. if( v_divChild.nodeType == 3 )
  92. this.m_divValueContainer.removeChild( v_divChild );
  93. for( v_divChild = this.m_divValueContainer.firstChild;
  94. v_divChild; v_divChild = v_divChild.nextSibling )
  95. {
  96. if( v_divChild.property == v_sPropKey )
  97. v_divPropValue = v_divChild;;
  98. if( !v_divChild.style )
  99. continue;
  100. v_divChild.style.display = "none";
  101. }
  102. if( !v_divPropValue )
  103. {
  104. var v_divPropValue = this.m_divContainer.document.createElement( "div" );
  105. this.m_divValueContainer.appendChild( v_divPropValue );
  106. v_divPropValue.property = v_sPropKey;
  107. v_divPropValue.innerHTML = this.m_aPropName2Value[ v_sPropName ];
  108. }
  109. else
  110. v_divPropValue.style.display = "block";
  111. this.m_divValueContainer.onclick =
  112. this.f_selectBlockTitle_onclick.F_CreateMethodCallback( this );
  113. }
  114. C_QanEPNode_PropPane.prototype.f_title_onclick = function()
  115. {
  116. this.f_showPropertyValue( G_QanApp.F_GetLoggingView().event.srcElement );
  117. }
  118. C_QanEPNode_PropPane.prototype.f_selectBlockTitle_onclick = function()
  119. {
  120. G_QanPrettyPrint.F_OnClick( G_QanApp.F_GetLoggingView().event.srcElement, null, this.m_sNodeType );
  121. }