otsdaq_utilities  v2_05_02_indev
HistogramViewer.js
1 /*===============================================================================*
2  * HistogramViewer.js: the javascript code to instantiate a root objects *
3  * navigator in the otsdaq framework *
4  * *
5  * Copyright (C) 2019 *
6  * *
7  * Authors: Dario Menasce *
8  * *
9  * INFN: Piazza della Scienza 3, Edificio U2, Milano, Italy 20126 *
10  * *
11  * This program is free software: you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation, either version 3 of the License, or *
14  * (at your option) any later version. *
15  * *
16  * This program is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19  * GNU General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU General Public License *
22  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
23  ================================================================================*/
24 
25 //----------------------------- Pre requisites --------------------------------
26 Ext.require(
27  [
28  'Ext.tab.*' ,
29  'Ext.window.*' ,
30  'Ext.tip.*' ,
31  'Ext.ux.*',
32  'Ext.layout.container.Border'
33  ]
34  );
35 
36 //------------------------- General utility function ---------------------------
37 // Retrieves the local URN number
38 var getLocalURN = function(index,name)
39 {
40  var params = (window.location.search.substr(1)).split('&');
41  var splitted, vs;
42  if(name)
43  {
44  for(index=0;index<params.length;++index)
45  {
46  splitted = params[index].indexOf('=');
47  if(splitted < 0) continue;
48  vs = [params[index].substr(0,splitted),params[index].substr(splitted+1)];
49  if(decodeURIComponent(vs[0]) == name) return decodeURIComponent(vs[1]);
50  }
51  return;
52  }
53 
54  if(index >= params.length) return;
55 
56  splitted = params[index].indexOf('=');
57  if(splitted < 0) return;
58  vs = [params[index].substr(0,splitted),params[index].substr(splitted+1)];
59  return decodeURIComponent(vs[1]);
60 }
61 
62 //------------------------- General utility function ---------------------------
63 // Creates the different <div> placeholders for the main components of the page
64 function generateDIVPlaceholder(id,top,left)
65 {
66  var div = document.createElement("div");
67  div.id = id ;
68  div.style.position = "absolute";
69  div.style.top = top + "px";
70  div.style.left = left + "px";
71 
72  document.getElementsByTagName("BODY")[0].appendChild(div);
73 }
74 //------------------------------------------------------------------------------
75 function generateDIVPlaceholderUnder(id,idUnder,top,left,width,height)
76 {
77  var div = document.createElement("div");
78  div.id = id ;
79  div.style.position = "absolute";
80  div.style.top = top + "px";
81  div.style.left = left + "px";
82  div.style.width = width + "px";
83  div.style.height = height + "px";
84 
85  document.getElementById(idUnder).appendChild(div);
86 }
87 //-----------------------------------------------------------------------------
88 // Reposition the div signed by id to top/left positions
89 // If either top or left is blank, it is ginred in the movement
90 function repositionDiv(id,top,left)
91 {
92  var div = document.getElementById(id);
93  if( top != "" ) div.style.top = top + "px";
94  if( left != "" ) div.style.left = left + "px";
95 }
96 //==============================================================================
97 Ext.onReady(function()
98 {
99  function xmlKeysPrintout(fromWhere)
100  {
101  const e = new Error();
102  const a = e.stack.split("\n")[1] ;
103  const w = a.split("/") ;
104  const s = w.length -1 ;
105  const l = w[s].split(":")[1] ;
106  STDLINE("----------- Line: " + l + "-----------") ;
107  STDLINE("From: '"+fromWhere+"'" ) ;
108  STDLINE(" --> fSystemPath_ : "+fSystemPath_ ) ;
109  STDLINE(" --> fRootPath_ : "+fRootPath_ ) ;
110  STDLINE(" --> fFoldersPath_ : "+fFoldersPath_ ) ;
111  STDLINE(" --> fFileName_ : "+fFileName_ ) ;
112  STDLINE(" --> fRFoldersPath_: "+fRFoldersPath_) ;
113  STDLINE(" --> fHistName_ : "+fHistName_ ) ;
114  STDLINE("--------------------------------------") ;
115  }
116 
117  var currentDirectory_ = "" ;
118  var currentRootObject_ = "" ;
119  var currentTree_ = "" ;
120  var grid_ = "" ;
121  var selectedItem_ = "getDirectories"; ;
122  var theStore_ = "" ;
123  var theCanvas_ = "" ;
124  var fSystemPath_ = "" ;
125  var fRootPath_ = "" ;
126  var fFoldersPath_ = "" ;
127  var fFileName_ = "" ;
128  var fRFoldersPath_ = "" ;
129  var fHistName_ = "" ;
130  var fRFoldersPath = "" ;
131  var theSources_ = "" ;
132  var theControls_ = "" ;
133  var thetheSourcesCB__ = "" ;
134  var dataModel_ = "" ;
135  var displayPlot_ = "" ;
136  var periodicPlotID_ = "" ;
137  var mdi_ = "" ;
138  var treeDisplayField_ = "fDisplayName" ;
139  var doReset_ = true ;
140  var _cookieCodeMailbox = 0; //RAR must get from desktop messages now to survive cross-origin browser restrictions//self.parent.document.getElementById("DesktopContent-cookieCodeMailbox") ;
141  var _cookieCode = 0; //RAR must get from desktop messages now to survive cross-origin browser restrictions //_cookieCodeMailbox.innerHTML ;
142  var _theWindow = self ;
143 
144  //NOTE: RAR must get _requestURL from desktop messages now to survive cross-origin browser restrictions
145  var _requestURL = self.parent.window.location.origin +
146  "/urn:xdaq-application:lid=" +
147  getLocalURN(0,"urn") +
148  "/Request?" ;
149  var viewportW = window.innerWidth ;
150  var viewportH = window.innerHeight ;
151 
152  var topMargin_ = 28
153  var bottomMargin_ = 5 ;
154  var decorationH = 0 ;
155  var sourceT = 0 ;
156  var sourceL = 0 ;
157  var sourceW = 200 ;
158  var sourceH = 25 ;
159  var navigatorT = topMargin_ ;
160  var navigatorL = 0 ;
161  var navigatorW = 200 ;
162  var navigatorH = viewportH - (topMargin_ + bottomMargin_) - decorationH ;
163  var controlsT = 460 ;
164  var controlsL = navigatorW + 5 ;
165  var controlsW = viewportW - navigatorW - 20 ;
166  var controlsH = 80 ;
167  var canvasT = navigatorT ;
168  var canvasL = navigatorW + 5 ;
169  var canvasW = viewportW - navigatorW - 20 ;
170  var canvasH = viewportH - (topMargin_ + bottomMargin_) - decorationH - controlsH ;
171  var canvasPos = 0 ;
172 
173  generateDIVPlaceholder ("sourceDiv" , 0 , 0 ) ;
174  generateDIVPlaceholder ("navigatorDiv" , navigatorT, navigatorL ) ;
175  generateDIVPlaceholder ("histogramDiv" , topMargin_, navigatorW + 5 ) ;
176  generateDIVPlaceholderUnder("histogram1" , "histogramDiv", 0 , 0 , 400, 400) ;
177  generateDIVPlaceholder ("controlsDiv" , controlsT , controlsL ) ;
178 
179  //-----------------------------------------------------------------------------
180  function STDLINE(str)
181  {
182  const e = new Error() ;
183  const a = e.stack.split("\n")[1] ;
184  const w = a.split("/") ;
185  const s = w.length -1 ;
186  const l = w[s].split(":")[1] ;
187  const n = w[s].split(":")[0] ;
188  const m = l+"] ["+n+"] "+str ;
189  console.log(m) ;
190  }
191  //-----------------------------------------------------------------------------
192  getXMLValue = function(req, name)
193  {
194  if(!name) return req.getAttribute("value");
195  return getXMLAttributeValue(req,name,"value");
196  }
197 
198  //-----------------------------------------------------------------------------
199  getXMLAttributeValue = function(req, name, attribute)
200  {
201  var el;
202  if(el = getXMLNode(req,name)) return el.getAttribute(attribute);
203  else if((name == "Error" )&& (!req || !req.responseXML))
204  return "Unknown error occured " +
205  "(XML response may have been illegal)!";
206  else
207  return undefined;
208  }
209 
210  //-----------------------------------------------------------------------------
211  getXMLNode = function(req, name)
212  {
213  var els;
214  if(req && req.responseXML)
215  req = req.responseXML;
216  if(req)
217  {
218  var i;
219  els = req.getElementsByTagName(name);
220  if(els.length) return els[0];
221  }
222 
223  return undefined;
224  }
225 
226  //-----------------------------------------------------------------------------
227  getXMLNodes = function(req, name)
228  {
229  var els;
230  if(req && req.responseXML)
231  req = req.responseXML;
232  if(req)
233  {
234  return req.getElementsByTagName(name);
235  }
236 
237  return undefined;
238  }
239 
240  //-----------------------------------------------------------------------------
241  dataModel_ = Ext.define(
242  'DirectoriesDataModel',
243  {
244  extend: 'Ext.data.Model',
245  fields: [
246  {name: 'nChilds' , type: 'int' , convert: null},
247  {name: 'fSystemPath' , type: 'string', convert: null},
248  {name: 'fRootPath' , type: 'string', convert: null},
249  {name: 'fFoldersPath' , type: 'string', convert: null},
250  {name: 'fFileName' , type: 'string', convert: null},
251  {name: 'fHistName' , type: 'string', convert: null},
252  {name: 'fRFoldersPath', type: 'string', convert: null},
253  {name: 'fDisplayName' , type: 'string', convert: null}
254  ]
255  }
256  );
257  //-----------------------------------------------------------------------------
258  // This panel represents the canvas to contain ROOT objects
259  theCanvas_ = Ext.create(
260  'Ext.panel.Panel',
261  {
262  renderTo : 'histogramDiv',
263  fullscreen: true ,
264  height : canvasH ,
265  width : canvasW ,
266  draggable : false ,
267  defaults : {
268  styleHtmlContent: true
269  },
270  items : [
271  {
272  style : 'background-color: #5E99CC' ,
273  id : 'histogram1' ,
274  itemId: 'canvas' ,
275  //html : '<p><p><center><h1>Canvas to display plots</h1></center>',
276  height: 1 ,
277  width : 1
278  }
279  ]
280  }
281  ).setPosition(0,0) ;
282 
283 //-----------------------------------------------------------------------------
284  function createSources(dirs)
285  {
286  theSources_ = Ext.create (
287  'Ext.data.Store',
288  {
289  fields: ['abbr', 'dir'],
290  data : dirs
291  }
292  );
293  theSourcesCB_ = Ext.create(
294  'Ext.form.ComboBox',
295  {
296  id : 'source' ,
297  fieldLabel : 'Source:' ,
298  labelWidth : 45 ,
299  height : sourceH ,
300  width : sourceW ,
301  store : theSources_,
302  queryMode : 'local' ,
303  displayField: 'dir' ,
304  valueField : 'abbr' ,
305  renderTo : 'sourceDiv',
306  listeners : {
307  select : function(thisCombo, record, eOpts)
308  {
309  fRootPath_ = record.data.dir ;
310  STDLINE("fRootPath_: "+fRootPath_) ;
311  makeStore(fRootPath_, 'RequestType=getMeDirs') ;
312  makeGrid (fRootPath_, 'Directories and files') ;
313  },
314  focusleave: function (thisCombo)
315  {
316  STDLINE('remove selection listener') ;
317  thisCombo.suspendEvent('select') ;
318  STDLINE('removed selection listener') ;
319  },
320  focusenter: function (thisCombo)
321  {
322  STDLINE('reinstate selection listener') ;
323  thisCombo.resumeEvent('select') ;
324  STDLINE('reinstated selection listener') ;
325  }
326  }
327  }
328  ).setPosition(sourceT,sourceL);
329  theSourcesCB_.setRawValue(dirs[0].dir) ; // Set default value
330  }
331 
332  //-----------------------------------------------------------------------------
333  var resetCanvasB = Ext.create (
334  'Ext.Button',
335  {
336  cls : 'controlButtons',
337  text : 'Reset' ,
338  renderTo: 'controlsDiv' ,
339  margin : 2 ,
340  border : 1 ,
341  style : {
342  borderColor: 'blue',
343  borderStyle: 'solid'
344  },
345  handler : function()
346  {
347  JSROOT.cleanup('histogram1');
348  mdi_ = new JSROOT.GridDisplay('histogram1', ''); // gridi2x2
349  }
350  }
351  );
352  var clearCanvasB = Ext.create (
353  'Ext.Button',
354  {
355  text : 'Clear' ,
356  renderTo: 'controlsDiv' ,
357  margin : 2 ,
358  border : 1 ,
359  style : {
360  borderColor: 'blue',
361  borderStyle: 'solid'
362  },
363  handler : function()
364  {
365  //theCanvas_.items.item[0].initialConfig.html = 'Display cleared' ;
366  //theCanvas_.update() ;
367  clearInterval(periodicPlotID_) ;
368  JSROOT.cleanup('histogram1');
369  mdi_ = new JSROOT.GridDisplay('histogram1', ''); // gridi2x2
370  }
371  }
372  );
373  var freezeCanvasB = Ext.create(
374  'Ext.Button',
375  {
376  text : 'Freeze' ,
377  renderTo: 'controlsDiv' ,
378  margin : 2 ,
379  border : 1 ,
380  style : {
381  borderColor: 'blue',
382  borderStyle: 'solid'
383  },
384  handler : function()
385  {
386  clearInterval(periodicPlotID_) ;
387  }
388  }
389  );
390 timeoutInterval = Ext.create (
391  'Ext.form.field.Number',
392  {
393  name : 'timeout' ,
394  width : 160 ,
395  fieldLabel : 'Refresh interval',
396  step : 1 ,
397  value : 5.0 ,
398  minValue : 5.0 ,
399  maxValue : 60 ,
400  allowDecimals: true
401  }
402  )
403 theControls_ = Ext.create (
404  'Ext.panel.Panel',
405  {
406  title : 'Canvas controls' ,
407  width : controlsW ,
408  height : controlsH ,
409  renderTo : 'controlsDiv' ,
410  draggable: true ,
411  items : [
412  resetCanvasB ,
413  clearCanvasB ,
414  freezeCanvasB ,
415  timeoutInterval
416  ]
417  }
418  ).setPosition(0,0);
419  //-----------------------------------------------------------------------------
420  function makeGrid(where,what)
421  {
422  if( grid_ ) grid_.destroy() ;
423  theStore_.sort(treeDisplayField_, 'ASC');
424 
425  mdi_ = new JSROOT.GridDisplay('histogram1', ''); // gridi2x2
426 
427  grid_ = Ext.create(
428  'Ext.tree.Panel',
429  {
430  title : what ,
431  id : 'navigator' ,
432  store : theStore_ ,
433  draggable : true ,
434  resizable : true ,
435  border : true ,
436  renderTo : "navigatorDiv",
437  rootVisible: false ,
438  useArrows : true ,
439  width : navigatorW ,
440  height : navigatorH ,
441  selModel : {
442  mode : 'MULTI' // SIMPLE or MULTI
443  },
444  buttons : [
445  {
446  xtype : 'button' ,
447  text : '<<' ,
448  margin : 2 ,
449  style : {
450  borderColor: 'blue' ,
451  borderStyle: 'solid'
452  } ,
453  minWidth : 10 ,
454  height : 25 ,
455  width : 30 ,
456  listeners: {
457  click: function()
458  {
459  if( currentTree_ = 'fileContent' )
460  {
461  selectedItem_ = "getDirectories" ;
462  makeStore(fRootPath_, 'RequestType=getMeDirs') ;
463  makeGrid (fRootPath_, 'Directories and files') ;
464  }
465  }
466  }
467  }
468  ],
469  columns : [
470  {
471  xtype : 'treecolumn' ,
472  id : 'provenance' ,
473  text : where ,
474  flex : 1 ,
475  dataIndex: 'fDisplayName'
476  },
477  {
478  xtype : 'treecolumn' ,
479  hidden : false ,
480  text : 'type' ,
481  width : 1 ,
482  dataIndex: 'leaf'
483  },
484  {
485  xtype : 'treecolumn' ,
486  hidden : false ,
487  text : 'fSystemPath' ,
488  width : 1 ,
489  dataIndex: 'fSystemPath'
490  },
491  {
492  xtype : 'treecolumn' ,
493  hidden : false ,
494  text : 'fRootPath' ,
495  width : 1 ,
496  dataIndex: 'fRootPath'
497  },
498  {
499  xtype : 'treecolumn' ,
500  hidden : false ,
501  text : 'fFoldersPath',
502  width : 1 ,
503  dataIndex: 'fFoldersPath'
504  },
505  {
506  xtype : 'treecolumn' ,
507  hidden : false ,
508  text : 'fFileName' ,
509  width : 1 ,
510  dataIndex: 'fFileName'
511  },
512  {
513  xtype : 'treecolumn' ,
514  hidden : false ,
515  text : 'fHistName' ,
516  width : 1 ,
517  dataIndex: 'fHistName'
518  }
519  ],
520  listeners : {
521  expand : function(expandedItem, options) // for some reason doesn't trigegr
522  {
523  STDLINE("expanded") ;
524  },
525  itemclick : function(thisItem, record, item, index, e, eOpts)
526  {
527  var selection = this.getSelection() ;
528  STDLINE("Selected "+selection.length+" items") ;
529  for(var i=0; i<selection.length; i++)
530  {
531  fSystemPath_ = selection[i].data.fSystemPath ;
532  fFoldersPath_ = selection[i].data.fFoldersPath ;
533  fRootPath_ = selection[i].data.fRootPath ;
534  fHistName_ = selection[i].data.fHistName ;
535  fFileName_ = selection[i].data.fFileName ;
536  if( typeof fFoldersPath_ === "undefined" ) fFoldersPath_ = "" ;
537  xmlKeysPrintout("Clicked on a tree item")
538  }
539  STDLINE("Selected "+selection.length+" items") ;
540  //clearInterval(periodicPlotID_) ;
541  var itemSplit = item.innerText.split("\n\t\n") ;
542  var isLeaf = itemSplit[1].replace("\n","").replace("\t","") ;
543  if( isLeaf == "true" )
544  {
545  if( selectedItem_ == "getDirectories" )
546  {
547  treeDisplayField_ = 'fDisplayName' ;
548  selectedItem_ = "getRootObject" ;
549  currentTree_ = 'fileContent' ;
550  currentDirectory_ = fSystemPath_ +
551  '/' +
552  fRootPath_ +
553  "/" +
554  fFoldersPath_ +
555  "/" +
556  fHistName_ ;
557  STDLINE('RequestType : getMeRootFile' ) ;
558  xmlKeysPrintout("Getting directories in particular")
559  STDLINE('currentDirectory_: '+currentDirectory_) ;
560  makeStore(currentDirectory_,'RequestType=getMeRootFile');
561  makeGrid (currentDirectory_,'ROOT file content' );
562  }
563  else if( selectedItem_ == "getRootObject" )
564  {
565  xmlKeysPrintout("Getting the content of a root file in particular (getRootObject)")
566  currentRootObject_ = "/" +
567  fRootPath_ +
568  "/" +
569  fFoldersPath_ +
570  fFileName_ +
571  "/" +
572  fHistName_ ;
573  STDLINE('RequestType : getRootObject' ) ;
574  STDLINE('currentRootObject_: '+currentRootObject_) ;
575  theAjaxRequest(
576  _requestURL+"RequestType=getRoot",
577  {
578  CookieCode: _cookieCode,
579  RootPath : currentRootObject_
580  },
581  ""
582  )
583  var tOut = Math.round(timeoutInterval.getValue() * 1000);
584  // periodicPlotID_ = setInterval(
585  // function()
586  // {
587  // STDLINE("Launching Ajax Request with refresh time: "+tOut) ;
588  // theAjaxRequest(
589  // _requestURL+"RequestType=getRoot",
590  // {
591  // CookieCode: _cookieCode,
592  // RootPath : currentRootObject_
593  // },
594  // ""
595  // )
596  // },
597  // tOut
598  // )
599  }
600  }
601  },
602  headerclick: function(ct, column, e, t, eOpts)
603  {
604  var a = column ;
605  STDLINE("header clicked") ;
606  }
607  }
608  }
609  ).setPosition(0,0);
610 
611  var objectProvenance = Ext.create(
612  'Ext.tip.ToolTip',
613  {
614  target: 'provenance',
615  html : 'Object provenance: ' + where
616  }
617  );
618  }
619  //-----------------------------------------------------------------------------
620  function makeStore(path, reqType)
621  {
622  xmlKeysPrintout("Sending parameters block to server")
623  theStore_ = Ext.create(
624  'Ext.data.TreeStore',
625  {
626  model : 'DirectoriesDataModel',
627  id : 'theStore',
628  autoLoad : false,
629  root : {
630  expanded : true
631  },
632  proxy : {
633  type : 'ajax',
634  actionMethods: {
635  read : 'POST'
636  },
637  extraParams : {
638  "CookieCode" : _cookieCode ,
639  "Path" : path , // used by Ryan's part
640  "fRootPath" : fRootPath_ ,
641  "fFoldersPath": fFoldersPath_ ,
642  "fHistName" : fHistName_ ,
643  "fFileName" : fFileName_
644  },
645  url : _requestURL + reqType,
646  reader : {
647  type : 'xml',
648  root : 'nodes',
649  record : '> node'
650  },
651  },
652  listeners: {
653  beforeload : function(thisStore, operation, eOpts)
654  {
655  STDLINE("Request: "+_requestURL + reqType) ;
656  },
657  load : function( thisStore, records, successful, operation, node, eOpts )
658  {
659  STDLINE("Load was succesful? "+successful) ;
660  }
661 
662  }
663  }
664  );
665  theStore_.load() ;
666  }
667 
668  //-----------------------------------------------------------------------------
669  // This function serves two different purposes:
670  // 1 - retrieve the heads of the filesystem directories where ROOT files reside
671  // 2 - retrieve a specific ROOT file object to display on an Extjs canvas
672 
673  function theAjaxRequest(theRequestURL,theParams,theRawData)
674  {
675  var today = new Date();
676  var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
677  STDLINE("Ajax request issued to "+theRequestURL+ " at " + time) ;
678  Ext.Ajax.request(
679  {
680  url : theRequestURL,
681  method : 'POST' ,
682  headers: {
683  'Content-Type': 'text/plain;charset=UTF-8'
684  } ,
685  params : theParams ,
686  rawData: theRawData ,
687  timeout: 50000 ,
688  success: function(response, request)
689  {
690  STDLINE("Successful") ;
691  if(getXMLValue(response,"headOfSearch") == 'located') // Returns the list of available fRooPaths
692  { // Get list of head-points
693  var dirs = [] ;
694  var theNodes = getXMLNodes(response,'dir') ;
695  for(var i=0; i<theNodes.length; ++i)
696  {
697  var theDir = theNodes[i].getAttribute("value")
698  STDLINE("Adding "+theDir+" to the list of enty points") ;
699  dirs.push({"abbr": theDir, "dir": theDir}) ;
700  }
701 
702  createSources(dirs) ;
703  var a = 0 ;
704  }
705  else if(!(typeof getXMLValue(response,"rootType") == 'undefined')) // Returns the plot to display
706  { // get specific ROOT Object and display
707  canvasPos++ ;
708  // if( periodicPlotID_ != "" )
709  // {
710  // clearInterval(periodicPlotID_) ;
711  // periodicPlotID_ = "" ;
712  // doReset_ = true ;
713  // }
714  var rootName = getXMLValue (response,"path" );
715  var rootJSON = getXMLValue (response,"rootJSON");
716  var object = JSROOT.parse(rootJSON );
717  STDLINE("Launchin displayPlot") ;
718  displayPlot_(object) ; // This is to get an immediate response
719  // JSROOT.RegisterForResize(theFrame);
720  // if( object._typename != "TCanvas")
721  // {
722  // periodicPlotID_ = setInterval(
723  // function()
724  // {
725  // displayPlot_(object) ; // This is delayed
726  // },
727  // 2000
728  // ) ;
729  // }
730  }
731  },
732  failure: function(response, options)
733  {
734  var a = response ;
735  Ext.MessageBox.alert(
736  'Something went wrong:',
737  'Response: ' + response.responseText
738  );
739  }
740  }
741  );
742  } ;
743  //-----------------------------------------------------------------------------
744  displayPlot_ = function(object)
745  {
746  var index = canvasPos % mdi_.NumGridFrames() ;
747  // if( index > mdi_.NumGridFrames()) {index = 0}
748  // var pos = "item" + index ;
749 
750  // if (mdi_!=null) theFrame = mdi_.FindFrame(pos, true);
751  theFrame = 'histogram1' ;
752  var rootTitle = object.fTitle ;
753  if( doReset_ )
754  {
755  STDLINE("-------> Resetting " + rootTitle);
756  JSROOT.redraw (
757  theFrame ,
758  object ,
759  ""
760  );
761  doReset_ = false ;
762  }
763  else
764  {
765  STDLINE("-------> Updating " + rootTitle) ;
766  JSROOT.redraw (
767  theFrame ,
768  object ,
769  ""
770  );
771  }
772  }
773  //-----------------------------------------------------------------------------
774  self.onresize = function()
775  {
776  var w = window.innerWidth;
777  var h = window.innerHeight;
778  theCanvas_.setSize(w,h) ;
779  theCanvas_.width = w - navigatorW - 20 ;
780  theCanvas_.height = h - (topMargin_ + bottomMargin_) - decorationH - controlsH ;
781  theCanvas_.items.items[0].width = theCanvas_.width ;
782  theCanvas_.items.items[0].height = theCanvas_.height ;
783  repositionDiv(
784  "controlsDiv",
785  theCanvas_.height + topMargin_,
786  "" // No horizontal repositioning
787  ) ;
788  theCanvas_.update() ;
789  if( currentRootObject_ == "" ) return ;
790  theAjaxRequest(
791  _requestURL+"RequestType=getRoot",
792  {
793  CookieCode: _cookieCode,
794  RootPath : "/" +
795  currentRootObject_
796  },
797  ""
798  ) ;
799  };
800  //=================================== Begin operations ==================================================
801  // This is where the whole action starts
802 
803  currentTree_ = 'files' ;
804  STDLINE("The job begins") ;
805  theAjaxRequest(
806  _requestURL+"RequestType=getDirectoryContents",
807  {
808  CookieCode: _cookieCode,
809  Path : "/"
810  },
811  ""
812  ) ;
813 
814 });
815