PaneManager.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** IBM Cognos Products: mdsrv
  5. **
  6. ** (C) Copyright IBM Corp. 2008, 2015
  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: Pane Manager
  15. //***********************************************************************************************
  16. var g_sExpandStateLabel = 'Less...';
  17. var g_sCollapseStateLabel = 'More...';
  18. var g_sExpandAllStateLabel = '- Hide All Sections';
  19. var g_sCollapseAllStateLabel = '+ Show All Sections';
  20. var g_nArrowWidth = 100;
  21. var g_nUniquePaneIndex = -1;
  22. //-----------------------------------------------------------------------------
  23. // CPaneInfo class
  24. //-----------------------------------------------------------------------------
  25. function CPaneInfo ( paneManager, name, state, widthPercent )
  26. {
  27. // Members
  28. this.m_parent = paneManager;
  29. this.m_name = name;
  30. this.m_nIndex = ++g_nUniquePaneIndex;
  31. this.m_state = state; // expanded or collapsed
  32. this.m_bExpanded = state == "expanded";
  33. this.m_widthPercent = widthPercent; // in percentages
  34. this.m_listNodes = [];
  35. this.m_elemThickArrow = null;
  36. this.m_elemBackground = null;
  37. this.m_elemCaption = null;
  38. this.m_elemExpandBtn = null;
  39. this.m_bCreatedControls = false;
  40. this.m_nWidthOrig = 0;
  41. // API
  42. this.getName = function () { return this.m_name; }
  43. this.getExpandBtnLabel = function () { return ( this.m_bExpanded ? g_sExpandStateLabel : g_sCollapseStateLabel ); }
  44. this.getLeft = function () { return this.x; }
  45. this.getRealLeft = function () { return this.x - this.m_parent.nScrollLeft; }
  46. this.getWidth = function () { return this.width; }
  47. this.getHeight = function () { return this.height; }
  48. this.getCaptionPos = function () { return new CPosition ( this.getRealLeft() + 10, this.y ); }
  49. this.getExpandBtnPos = function () { return new CPosition ( this.getRealLeft() + this.getWidth() - 60, this.y ); }
  50. this.getId = function () { return ( 'id_pane_' + this.m_nIndex ); }
  51. this.getArrowId = function () { return ( this.getId() + '_arrow' ); }
  52. this.getCaptionId = function () { return ( this.getId() + '_caption' ); }
  53. this.getExpandBtnId = function () { return ( this.getId() + '_expand_btn' ); }
  54. this.getBackgroundId = function () { return ( this.getId() + '_background' ); }
  55. this.setHeight = function ( nHeight )
  56. {
  57. this.height = nHeight;
  58. }
  59. this.setWidth = function ( nWidth )
  60. {
  61. this.width = nWidth;
  62. this.m_parent.recalcSize ( this.getName() );
  63. }
  64. this.Init = function ()
  65. {
  66. if ( this.m_elemCaption )
  67. {
  68. var cssHelper = new CElementStyleHelper ( this.m_elemCaption );
  69. cssHelper.setText ( this.getName() );
  70. cssHelper.setTextBold ();
  71. }
  72. }
  73. this.OnScroll = function ( )
  74. {
  75. this.moveControls ();
  76. }
  77. this.OnClickCaption = function ( evt )
  78. {
  79. var evt = (evt) ? evt : ((window.event) ? window.event : null);
  80. var target = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  81. // alert ( 'Event <' + evt.type + '> on element <' + target.id + '>');
  82. if ( evt.type == 'click' )
  83. {
  84. var paneCurr = paneManager.findPane ( name );
  85. if ( target.id == paneCurr.getCaptionId() )
  86. {
  87. alert ( 'You clicked on the ' + paneCurr.m_name + ' caption ! Why ?' );
  88. }
  89. }
  90. }
  91. this.getNumOfColumns = function ()
  92. {
  93. var cColumns = 0;
  94. for ( var i = 0; i < this.m_listNodes.length; i++)
  95. {
  96. var gNode = this.m_listNodes[ i ];
  97. if ( gNode.modelObject.getColumnIndex() >= cColumns )
  98. {
  99. cColumns = gNode.modelObject.getColumnIndex() + 1;
  100. }
  101. }
  102. return cColumns;
  103. }
  104. this.getColumnNodesHeight = function ( nColumnIndex )
  105. {
  106. var nHeight = 0;
  107. for ( var i = 0; i < this.m_listNodes.length; i++)
  108. {
  109. var gNode = this.m_listNodes[ i ];
  110. if ( gNode.modelObject.getColumnIndex() == nColumnIndex )
  111. {
  112. if ( nHeight > 0 )
  113. nHeight += DG.graphDefaults.nNodeOffsetY;
  114. nHeight += gNode.height;
  115. }
  116. }
  117. return nHeight;
  118. }
  119. this.getColumnNodesHeightArray = function ()
  120. {
  121. var arrColumnHeights = [];
  122. var cColumns = this.getNumOfColumns ();
  123. for ( var i = 0; i < cColumns; i++ )
  124. {
  125. arrColumnHeights[ i ] = this.getColumnNodesHeight ( i );
  126. }
  127. return arrColumnHeights;
  128. }
  129. this.getNumOfNodes = function ( nColumnIndex )
  130. {
  131. var nCount = 0;
  132. for ( var i = 0; i < this.m_listNodes.length; i++)
  133. {
  134. var gNode = this.m_listNodes[ i ];
  135. if ( gNode.modelObject.getColumnIndex() == nColumnIndex )
  136. {
  137. ++nCount;
  138. }
  139. }
  140. return nCount;
  141. }
  142. this.getColumnNodesOffset = function ( nColumnIndex )
  143. {
  144. // var nCount = this.getNumOfNodes ( nColumnIndex );
  145. var nHeight = this.getColumnNodesHeight ( nColumnIndex );
  146. // var nVertOffset = ( this.getHeight() - nHeight ) / ( nCount + 1 );
  147. var nVertOffset = nHeight < this.getHeight() - DG.graphDefaults.nNodeOffsetY ?
  148. ( this.getHeight() - nHeight ) / 2 : DG.graphDefaults.nNodeOffsetY;
  149. return nVertOffset;
  150. }
  151. this.getColumnNodesOffsetArray = function ()
  152. {
  153. var arrColumnOffsets = [];
  154. var cColumns = this.getNumOfColumns ();
  155. for ( var i = 0; i < cColumns; i++ )
  156. {
  157. arrColumnOffsets.push ( this.getColumnNodesOffset ( i ) );
  158. }
  159. return arrColumnOffsets;
  160. }
  161. this.setNodesVisibility = function ()
  162. {
  163. // Configure Visible Nodes
  164. for ( var i = 0; i < this.m_listNodes.length; i++)
  165. {
  166. var gNode = this.m_listNodes[ i ];
  167. if ( this.m_bExpanded )
  168. gNode.show ( true );
  169. else
  170. {
  171. if ( gNode.modelObject.isRootObject() )
  172. gNode.show ( true );
  173. else
  174. gNode.show ( false );
  175. }
  176. gNode.bShowConnections = true;
  177. // gNode.bShowConnections = this.m_bExpanded;
  178. }
  179. // Configure corresponding connections
  180. this.m_parent.m_graph.refreshConnections ();
  181. }
  182. this.getNumRootNodes = function ()
  183. {
  184. var cNodes = 0;
  185. for (var i = 0; i < this.m_listNodes.length; i++)// var i in this.m_listNodes )
  186. {
  187. var gNode = this.m_listNodes[ i ];
  188. if ( gNode.modelObject.isRootObject () )
  189. {
  190. cNodes++;
  191. }
  192. }
  193. return cNodes;
  194. }
  195. this.Layout = function ()
  196. {
  197. var nVertHeights = this.getColumnNodesHeightArray();
  198. var nVertOffsets = this.getColumnNodesOffsetArray();
  199. for ( var i = 0; i < this.m_listNodes.length; i++)
  200. {
  201. var gNode = this.m_listNodes[ i ];
  202. var nColumnIndex = gNode.modelObject.getColumnIndex();
  203. var nNodePosX = this.x + DG.graphDefaults.nNodeOffsetX + ( gNode.width + DG.graphDefaults.nNodeOffsetX ) * nColumnIndex;
  204. gNode.SetPosition( nNodePosX, nVertOffsets[ nColumnIndex ] );
  205. nVertOffsets[ nColumnIndex ] += gNode.height + DG.graphDefaults.nNodeOffsetY;
  206. // nVertOffsets[ nColumnIndex ] += gNode.height + nVertOffsets[ nColumnIndex ];
  207. }
  208. }
  209. this.LayoutNodes = function ()
  210. {
  211. this.Layout ();
  212. for ( var i = 0; i < this.m_listNodes.length; i++)
  213. {
  214. this.m_listNodes[ i ].refresh();
  215. }
  216. }
  217. this.expand = function ( bExpand )
  218. {
  219. this.m_bExpanded = bExpand;
  220. if ( this.m_elemExpandBtn )
  221. {
  222. var cssHelper = new CElementStyleHelper ( this.m_elemExpandBtn );
  223. cssHelper.setText ( this.getExpandBtnLabel () );
  224. }
  225. // alert ( "expand: " + this.m_listNodes.length );
  226. this.setNodesVisibility ();
  227. var widthReportPane = this.calcPaneWidth ();
  228. // alert ( 'expand: New Pane Width = ' + widthReportPane );
  229. this.setWidth ( widthReportPane );
  230. this.showThickArrow ();
  231. }
  232. this.OnClickExpandBtn = function ( evt )
  233. {
  234. var evt = (evt) ? evt : ((window.event) ? window.event : null);
  235. var target = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  236. // alert ( 'Event <' + evt.type + '> on element <' + target.id + '>');
  237. var paneCurr = paneManager.findPane ( name );
  238. paneCurr.expand ( ! paneCurr.m_bExpanded );
  239. }
  240. this.createControls = function ( headerId )
  241. {
  242. if ( this.m_bCreatedControls )
  243. return;
  244. try
  245. {
  246. var posCaption = this.getCaptionPos ();
  247. var posExpandBtn = this.getExpandBtnPos ();
  248. var textCaption = this.getName();
  249. var textExpandBtn = this.getExpandBtnLabel();
  250. // this.m_elemCaption = CreateLink ( this.getCaptionId(), headerId, 'headerCaption', textCaption, posCaption.x, posCaption.y, this.OnClickCaption );
  251. this.m_elemCaption = CreateText ( this.getCaptionId(), headerId, 'headerCaption', textCaption, posCaption.x, posCaption.y, 100 );
  252. // alert ( this.m_elemCaption.id );
  253. // 11 Feb 08 - temporarily disabled the Expand / Collapse functionality based on Ralf's decision
  254. // if ( this.m_nIndex < this.m_parent.getPaneCount() - 1 )
  255. // this.m_elemExpandBtn = CreateLink ( this.getExpandBtnId(), headerId, 'headerLink', textExpandBtn, posExpandBtn.x, posExpandBtn.y, this.OnClickExpandBtn );
  256. //----------------------------------------------------------------
  257. // if ( this.m_nIndex != 2 ) // for all panes except right pane
  258. // this.createThickArrow ();
  259. if ( this.m_nIndex == 1 ) // for middle pane only
  260. this.createBackground ();
  261. }
  262. catch ( err )
  263. {
  264. var txt = "createControls: Error " + err.description + "\n\n";
  265. txt += "Click OK to continue.\n\n";
  266. alert ( txt );
  267. }
  268. finally
  269. {
  270. this.m_bCreatedControls = true;
  271. }
  272. }
  273. this.moveControls = function ()
  274. {
  275. if ( ! this.m_bCreatedControls )
  276. return;
  277. // alert ( 'moveControls: ' + this.m_nIndex );
  278. if ( this.m_elemCaption )
  279. {
  280. var cssHelper = new CElementStyleHelper ( this.m_elemCaption );
  281. var posCaption = new CPosition ( this.getCaptionPos().x, this.getCaptionPos().y );
  282. cssHelper.moveToPos ( posCaption );
  283. }
  284. if ( this.m_elemExpandBtn )
  285. {
  286. var cssHelper = new CElementStyleHelper ( this.m_elemExpandBtn );
  287. var posExpandBtn = new CPosition ( this.getExpandBtnPos().x, this.getExpandBtnPos().y );
  288. cssHelper.moveToPos ( posExpandBtn );
  289. }
  290. this.moveBackground ();
  291. this.moveThickArrow ();
  292. }
  293. this.createBackground = function ()
  294. {
  295. this.m_elemBackground = CreateDiv ( this.getBackgroundId(), this.m_parent.m_canvasId, 'classBackground', this.x, this.y, this.getWidth(), this.getHeight() );
  296. ASSERT( this.m_elemBackground, "createBackground: m_elemBackground was NOT created !!!" );
  297. }
  298. this.moveBackground = function ( newX, newY )
  299. {
  300. if ( this.m_elemBackground )
  301. {
  302. var cssHelper = new CElementStyleHelper ( this.m_parent.m_canvasId );
  303. var sizeCanvas = cssHelper.getClientSize ();
  304. var cssHelper = new CElementStyleHelper ( this.m_elemBackground );
  305. var posX = ( newX && newX != -1 ) ? newX : this.x;
  306. var posY = ( newY && newY != -1 ) ? newY : this.y + this.m_parent.nScrollTop;
  307. cssHelper.move ( posX, posY );
  308. // cssHelper.resize ( this.getWidth(), this.getHeight() );
  309. cssHelper.resize ( this.getWidth(), sizeCanvas.height );
  310. }
  311. }
  312. this.createThickArrow = function ()
  313. {
  314. this.m_elemThickArrow = CreateImage(this.getArrowId(), this.m_parent.m_canvasId, DG.graphDefaults.getImagePath() + "thick_arrow_right.jpg", this.x + this.getWidth() - 60, this.getHeight() / 2 - g_nArrowWidth / 2, g_nArrowWidth, 100);
  315. var cssHelper = new CElementStyleHelper ( this.m_elemThickArrow );
  316. cssHelper.setZIndex ( 1 );
  317. cssHelper.setColors ( 'Red', 'Red' );
  318. cssHelper.setOpacity( 10 );
  319. cssHelper.show ( ! this.m_bExpanded );
  320. ASSERT( this.m_elemThickArrow, "createThickArrow: m_elemThickArrow was NOT created !!!" );
  321. }
  322. this.showThickArrow = function ()
  323. {
  324. // Toggle the thick arrow
  325. if ( this.m_elemThickArrow )
  326. {
  327. var cssHelper = new CElementStyleHelper ( this.m_elemThickArrow );
  328. var bShow = ! this.m_bExpanded;
  329. // alert ( bShow ? "Expanded" : "Collapsed" );
  330. cssHelper.show ( bShow );
  331. }
  332. }
  333. this.moveThickArrow = function ()
  334. {
  335. if ( this.m_elemThickArrow )
  336. {
  337. var cssHelper = new CElementStyleHelper ( this.m_elemThickArrow );
  338. if ( ! this.m_bExpanded )
  339. cssHelper.move ( this.x + this.getWidth() - 60, this.getHeight() / 2 - 50 );
  340. }
  341. }
  342. this.calcPaneWidth = function ()
  343. {
  344. var nPaneWidth = 0;
  345. for ( var i = 0; i < this.m_listNodes.length; i++)
  346. {
  347. var gNode = this.m_listNodes[ i ];
  348. if ( gNode.isShown () )
  349. {
  350. if ( nPaneWidth < gNode.x + gNode.width - this.x )
  351. nPaneWidth = gNode.x + gNode.width - this.x;
  352. }
  353. }
  354. nPaneWidth += DG.graphDefaults.nNodeOffsetX;
  355. if ( ! this.m_bExpanded )
  356. nPaneWidth += g_nArrowWidth;
  357. if ( nPaneWidth < this.m_nWidthOrig )
  358. nPaneWidth = this.m_nWidthOrig;
  359. return nPaneWidth;
  360. }
  361. this.fetchNodes = function ( nodeList )
  362. {
  363. for ( var i = 0; i < nodeList.length; i++)
  364. {
  365. var gNode = nodeList[ i ];
  366. if ( gNode.modelObject.getPaneName() == this.m_name )
  367. {
  368. this.m_listNodes.push ( gNode );
  369. }
  370. }
  371. // alert ( "fetchNodes: Pane '" + this.m_name + "' - No. of nodes = " + this.m_listNodes.length );
  372. }
  373. }
  374. CPaneInfo.prototype = new CSize();
  375. //-----------------------------------------------------------------------------
  376. // CPaneManager class
  377. //-----------------------------------------------------------------------------
  378. function CPaneManager ( sCanvasId )
  379. {
  380. // members
  381. var curr_instance = this; // keep the current instance for callbacks to refer to
  382. this.m_canvasId = sCanvasId;
  383. this.m_listPanes = [];
  384. this.m_graph = null;
  385. this.m_headerId = null;
  386. this.m_bPanesExpanded = false;
  387. this.nScrollLeft = 0;
  388. this.nScrollTop = 0;
  389. this.m_elemExpandAllBtn = null;
  390. // API
  391. this.getHeaderId = function () { return this.m_headerId; }
  392. this.getHeaderBackgroundId = function () { return ( this.getHeaderId() + '_background' ); }
  393. this.addPane = function ( pane ) { this.m_listPanes.push ( pane ); }
  394. this.getPane = function ( nIndex ) { return this.m_listPanes[ nIndex ]; }
  395. this.getPaneCount = function () { return this.m_listPanes.length; }
  396. this.findPane = function ( sName )
  397. {
  398. var nPane = this.findPaneNo ( sName );
  399. return nPane != -1 ? this.getPane( nPane ) : null;
  400. }
  401. this.findPaneNo = function ( sName )
  402. {
  403. var paneNo = -1;
  404. for ( var i = 0; i < this.m_listPanes.length; i++ )
  405. {
  406. var pane = this.getPane( i );
  407. if ( pane.m_name == sName )
  408. {
  409. paneNo = i;
  410. break;
  411. }
  412. }
  413. return paneNo;
  414. }
  415. this.splitNodes = function ( nodeList )
  416. {
  417. for ( var i = 0; i < this.m_listPanes.length; i++ )
  418. {
  419. var pane = this.getPane( i );
  420. pane.fetchNodes ( nodeList );
  421. }
  422. }
  423. this.recalcSize = function ( sPaneName )
  424. {
  425. var paneCurrNo = this.findPaneNo ( sPaneName );
  426. if ( paneCurrNo == -1 )
  427. {
  428. alert ( 'recalcSize: the pane ' + sPaneName + ' was NOT found !!!');
  429. return;
  430. }
  431. for ( var i = paneCurrNo; i < this.m_listPanes.length; i++ )
  432. {
  433. var pane = this.getPane( i );
  434. // var paneNext = i < this.m_listPanes.length - 1 ? this.getPane( i+1 ) : null;
  435. var panePrev = i > 0 ? this.getPane( i-1 ) : null;
  436. var paneNewX = panePrev ? panePrev.x + panePrev.width : pane.x;
  437. if ( pane.x != paneNewX )
  438. {
  439. pane.SetPosition ( paneNewX, pane.y, pane.getWidth(), pane.getHeight() );
  440. pane.LayoutNodes ();
  441. }
  442. pane.moveControls ();
  443. }
  444. }
  445. this.updateSize = function ( bResetPanes )
  446. {
  447. var cssHelper = new CElementStyleHelper ( this.m_canvasId );
  448. var sizeCanvas = cssHelper.getClientSize ();
  449. var cPanes = this.m_listPanes.length;
  450. var nPaneY = 0;
  451. for ( var i = 0; i < this.m_listPanes.length; i++)
  452. {
  453. var pane = this.getPane( i );
  454. pane.m_nWidthOrig = sizeCanvas.width * pane.m_widthPercent / 100;
  455. if ( bResetPanes )
  456. {
  457. pane.SetPosition ( nPaneY, sizeCanvas.y, pane.m_nWidthOrig, sizeCanvas.height );
  458. nPaneY += pane.m_nWidthOrig;
  459. }
  460. pane.moveControls ();
  461. }
  462. }
  463. this.ExpandPanes = function ( bExpand )
  464. {
  465. this.m_bPanesExpanded = bExpand;
  466. for ( var i = 0; i < this.m_listPanes.length - 1; i++ )
  467. {
  468. var pane = this.getPane( i );
  469. pane.expand ( this.m_bPanesExpanded );
  470. }
  471. this.m_elemExpandAllBtn = document.getElementById( "id_graph_expand_all_btn" );
  472. if ( this.m_elemExpandAllBtn )
  473. {
  474. var cssHelper = new CElementStyleHelper ( this.m_elemExpandAllBtn );
  475. cssHelper.setText ( this.m_bPanesExpanded ? g_sExpandAllStateLabel : g_sCollapseAllStateLabel );
  476. }
  477. }
  478. this.OnClickExpandAllBtn = function ( evt )
  479. {
  480. var evtObj = new CMouseEvent ( evt );
  481. curr_instance.ExpandPanes ( ! curr_instance.m_bPanesExpanded );
  482. }
  483. this.Init = function ( graph, headerId )
  484. {
  485. this.m_graph = graph;
  486. this.m_headerId = headerId;
  487. // this.createControls ( headerId );
  488. for (var i = 0; i < this.m_listPanes.length; i++)
  489. {
  490. var pane = this.getPane( i );
  491. pane.Init();
  492. }
  493. this.updateSize ( true );
  494. // Hookup event handlers
  495. this.m_elemExpandAllBtn = document.getElementById( "id_graph_expand_all_btn" );
  496. if ( this.m_elemExpandAllBtn )
  497. {
  498. var cssHelper = new CElementStyleHelper ( this.m_elemExpandAllBtn );
  499. cssHelper.addEvent ( 'click', this.OnClickExpandAllBtn, false );
  500. }
  501. }
  502. this.Layout = function ()
  503. {
  504. for ( var i = 0; i < this.m_listPanes.length; i++)
  505. {
  506. var pane = this.getPane( i );
  507. pane.Layout ();
  508. }
  509. }
  510. this.createHeaderBackground = function ()
  511. {
  512. var paneFirst = this.getPane( 0 );
  513. var paneLast = this.getPane( this.m_listPanes.length - 1 );
  514. if ( this.getHeaderId() )
  515. {
  516. var elemHeader = document.getElementById( this.getHeaderId() );
  517. // this.m_elemHeaderBackground = CreateDiv ( this.getHeaderBackgroundId(), this.getHeaderId(), 'classBackground', elemHeader.clientLeft, elemHeader.clientTop, elemHeader.clientWidth, elemHeader.clientHeight );
  518. // var cssHelper = new CElementStyleHelper ( this.m_elemHeaderBackground );
  519. // cssHelper.setZIndex ( 1 );
  520. // cssHelper.setOpacity( 10 );
  521. }
  522. }
  523. this.moveHeaderBackground = function ( newX, newY, newWidth )
  524. {
  525. if ( this.m_elemHeaderBackground )
  526. {
  527. var cssHelper = new CElementStyleHelper ( this.m_elemHeaderBackground );
  528. var posX = newX ? newX : this.x;
  529. var posY = newY ? newY : this.y;
  530. cssHelper.move ( posX, posY );
  531. cssHelper.resize ( newWidth, -1 );
  532. }
  533. }
  534. this.createControls = function ( headerId )
  535. {
  536. ASSERT( headerId, "createControls: headerId is NOT valid !!!" );
  537. this.m_headerId = headerId;
  538. this.createHeaderBackground ();
  539. for ( var i = 0; i < this.m_listPanes.length; i++)
  540. {
  541. var pane = this.getPane( i );
  542. pane.createControls ( headerId );
  543. if ( i < this.m_listPanes.length - 1 ) // for all panes except right-most pane
  544. pane.createThickArrow ();
  545. }
  546. }
  547. this.moveControls = function ()
  548. {
  549. for ( var i = 0; i < this.m_listPanes.length; i++)
  550. {
  551. var pane = this.getPane( i );
  552. pane.moveControls ();
  553. }
  554. }
  555. this.setNodesVisibility = function ()
  556. {
  557. for ( var i = 0; i < this.m_listPanes.length; i++)
  558. {
  559. var pane = this.getPane( i );
  560. pane.setNodesVisibility ();
  561. }
  562. }
  563. this.OnScroll = function ( evtObj )
  564. {
  565. this.nScrollLeft = evtObj.target.scrollLeft;
  566. this.nScrollTop = evtObj.target.scrollTop;
  567. for ( var i = 0; i < this.m_listPanes.length; i++)
  568. {
  569. var pane = this.getPane( i );
  570. pane.OnScroll ();
  571. }
  572. }
  573. this.OnGraphResize = function ()
  574. {
  575. var cssHelper = new CElementStyleHelper ( this.m_canvasId );
  576. var sizeCanvas = cssHelper.getClientSize ();
  577. var widthNew = sizeCanvas.width;
  578. var heightNew = sizeCanvas.height;
  579. var newX = -1;
  580. var newY = -1;
  581. this.moveHeaderBackground ( newX, newY, widthNew );
  582. for ( var i = 0; i < this.m_listPanes.length; i++)
  583. {
  584. var pane = this.getPane( i );
  585. pane.setHeight ( heightNew )
  586. pane.LayoutNodes ();
  587. }
  588. }
  589. }