ROOT  6.06/09
Reference Guide
TSessionDialogs.cxx
Go to the documentation of this file.
1 // @(#)root/sessionviewer:$Id$
2 // Author: Marek Biskup, Jakub Madejczyk, Bertrand Bellenot 10/08/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TSessionDialogs //
15 // //
16 // This file defines several dialogs that are used by TSessionViewer. //
17 // The following dialogs are available: TNewChainDlg and TNewQueryDlg. //
18 // //
19 //////////////////////////////////////////////////////////////////////////
20 
21 #include "TSessionDialogs.h"
22 #include "TSessionViewer.h"
23 #include "TROOT.h"
24 #include "TSystem.h"
25 #include "TGButton.h"
26 #include "TList.h"
27 #include "TChain.h"
28 #include "TDSet.h"
29 #include "TGTextEntry.h"
30 #include "TGTextBuffer.h"
31 #include "TGNumberEntry.h"
32 #include "TGLabel.h"
33 #include "TGListView.h"
34 #include "TGPicture.h"
35 #include "TGFSContainer.h"
36 #include "TGFileDialog.h"
37 #include "TGListTree.h"
38 #include "TInterpreter.h"
39 #include "TApplication.h"
40 #include "TKey.h"
41 #include "TGTableLayout.h"
42 #include "TGFileDialog.h"
43 #include "TProof.h"
44 #include "TFileInfo.h"
45 #include "TGMsgBox.h"
46 #include "TRegexp.h"
47 
50 
51 /* not yet used
52 static const char *gParTypes[] = {
53  "Par files", "*.par",
54  "All files", "*",
55  0, 0
56 };
57 */
58 
59 static const char *gDatasetTypes[] = {
60  "ROOT files", "*.root",
61  "All files", "*",
62  0, 0
63 };
64 
65 static const char *gFileTypes[] = {
66  "C files", "*.[C|c]*",
67  "ROOT files", "*.root",
68  "All files", "*",
69  0, 0
70 };
71 
72 //////////////////////////////////////////////////////////////////////////
73 // New Chain Dialog
74 //////////////////////////////////////////////////////////////////////////
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// Create a new chain dialog box. Used to list chains present in memory
78 /// and offers the possibility to create new ones by executing macros
79 /// directly from the associate file container.
80 
82  TGTransientFrame(p, main, 350, 300, kVerticalFrame)
83 {
84  Pixel_t backgnd;
85  if (!p || !main) return;
87  fClient->GetColorByName("#F0FFF0", backgnd);
88  AddFrame(new TGLabel(this, new TGHotString("List of Chains in Memory :")),
89  new TGLayoutHints(kLHintsLeft, 5, 5, 7, 2) );
90 
91  // Add TGListView used to show objects in memory
92  fListView = new TGListView(this, 300, 100);
98 
99  fListView->Connect("Clicked(TGLVEntry*, Int_t)", "TNewChainDlg",
100  this, "OnElementClicked(TGLVEntry* ,Int_t)");
101 
102  // Add text entry showing type and name of user's selection
103  TGCompositeFrame* frmSel = new TGHorizontalFrame(this, 300, 100);
104  frmSel->SetCleanup(kDeepCleanup);
105  frmSel->AddFrame(new TGLabel(frmSel, new TGHotString("Selected chain :")),
106  new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5, 5, 5, 5) );
107  fNameBuf = new TGTextBuffer(100);
108  fName = new TGTextEntry(frmSel, fNameBuf);
110  fName->Associate(this);
112  fName->ChangeBackground(backgnd);
113  frmSel->AddFrame(fName, new TGLayoutHints(kLHintsLeft | kLHintsCenterY | kLHintsExpandX, 5, 5, 5, 5));
114  AddFrame(frmSel, new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
115 
116  AddFrame(new TGLabel(this, "Double-click on the macro to be executed to create a new Chain:"),
117  new TGLayoutHints(kLHintsCenterX, 5, 5, 5, 2));
118 
119  // Add TGListview / TGFileContainer to allow user to execute Macros
120  // for the creation of new TChains / TDSets
121  TGListView* lv = new TGListView(this, 300, 100);
122  AddFrame(lv,new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 2, 5));
123 
124  Pixel_t white;
125  gClient->GetColorByName("white",white);
126  fContents = new TGFileContainer(lv, kSunkenFrame, white);
128  fContents->SetFilter("*.[C|c]*");
130  fContents->Associate(this);
133  fContents->AddFile(".."); // up level directory
134  fContents->Resize();
135  fContents->StopRefreshTimer(); // stop refreshing
136 
137  // position relative to the parent's window
138  Window_t wdummy;
139  Int_t ax, ay;
140  gVirtualX->TranslateCoordinates( main->GetId(),
142  0, 0, ax, ay, wdummy);
143  Move(ax + 200, ay + 35);
144 
145  TGCompositeFrame *tmp;
146  AddFrame(tmp = new TGCompositeFrame(this, 140, 20, kHorizontalFrame),
148  tmp->SetCleanup(kDeepCleanup);
149  // Apply and Close buttons
150  tmp->AddFrame(fOkButton = new TGTextButton(tmp, "&Ok", 0),
151  new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
152  tmp->AddFrame(fCancelButton = new TGTextButton(tmp, "&Cancel", 1),
153  new TGLayoutHints(kLHintsExpandX, 5, 5, 5, 5));
154  fOkButton->Associate(this);
155  fCancelButton->Associate(this);
157 
158  SetWindowName("Chain Selection Dialog");
159  MapSubwindows();
160  Layout();
162  MapWindow();
163  UpdateList();
164 }
165 
166 ////////////////////////////////////////////////////////////////////////////////
167 /// Delete chain dialog.
168 
170 {
171  if (IsZombie()) return;
172  delete fLVContainer;
173  delete fContents;
174  Cleanup();
175 }
176 
177 ////////////////////////////////////////////////////////////////////////////////
178 /// Emits OnElementSelected signal if dset is not zero.
179 
181 {
182  if (obj && (obj->IsA() == TChain::Class() ||
183  obj->IsA() == TDSet::Class())) {
184  Emit("OnElementSelected(TObject *)", (Long_t)obj);
185  }
186 }
187 
188 ////////////////////////////////////////////////////////////////////////////////
189 /// Handle click in the Memory list view and put the type
190 /// and name of selected object in the text entry.
191 
193 {
194  fChain = (TObject *)entry->GetUserData();
195  if (fChain->IsA() == TChain::Class()) {
196  TString s = TString::Format("%s : %s" , ((TChain *)fChain)->GetTitle(),
197  ((TChain *)fChain)->GetName());
198  fName->SetText(s);
199  }
200  else if (fChain->IsA() == TDSet::Class()) {
201  TString s = TString::Format("%s : %s" , ((TDSet *)fChain)->GetName(),
202  ((TDSet *)fChain)->GetObjName());
203  fName->SetText(s);
204  }
206 }
207 
208 ////////////////////////////////////////////////////////////////////////////////
209 /// Update Memory list view.
210 
212 {
213  TGLVEntry *item=0;
214  TObject *obj = 0;
215  fChains = gROOT->GetListOfDataSets();
217  if (!fChains) return;
218  TIter next(fChains);
219  // loop on the list of chains/datasets in memory,
220  // and fill the associated listview
221  while ((obj = (TObject *)next())) {
222  item = 0;
223  if (obj->IsA() == TChain::Class()) {
224  const char *title = ((TChain *)obj)->GetTitle();
225  if (!title[0])
226  ((TChain *)obj)->SetTitle("TChain");
227  item = new TGLVEntry(fLVContainer, ((TChain *)obj)->GetName(),
228  ((TChain *)obj)->GetTitle());
229  }
230  else if (obj->IsA() == TDSet::Class()) {
231  item = new TGLVEntry(fLVContainer, ((TDSet *)obj)->GetObjName(),
232  ((TDSet *)obj)->GetName());
233  }
234  if (item) {
235  item->SetUserData(obj);
236  fLVContainer->AddItem(item);
237  }
238  }
240  Resize();
241 }
242 
243 ////////////////////////////////////////////////////////////////////////////////
244 /// Display content of directory.
245 
247 {
249  gSystem->ChangeDirectory(fname);
250  fContents->ChangeDirectory(fname);
252  fContents->AddFile(".."); // up level directory
253  Resize();
254 }
255 
256 ////////////////////////////////////////////////////////////////////////////////
257 /// Handle double click in the File container.
258 
260 {
261  if (btn!=kButton1) return;
262  gVirtualX->SetCursor(fContents->GetId(),gVirtualX->CreateCursor(kWatch));
263 
264  TString name(f->GetTitle());
265 
266  // Check if the file is a root macro file type
267  if (name.Contains(".C")) {
268  // form the command
269  TString command = TString::Format(".x %s/%s",
271  name.Data());
272  // and process
273  gApplication->ProcessLine(command.Data());
274  UpdateList();
275  } else {
276  // if double clicked on a directory, then display it
278  }
279  gVirtualX->SetCursor(fContents->GetId(),gVirtualX->CreateCursor(kPointer));
280 }
281 
282 ////////////////////////////////////////////////////////////////////////////////
283 /// Process messages for new chain dialog.
284 
286 {
287  switch (GET_MSG(msg)) {
288  case kC_COMMAND:
289  switch (GET_SUBMSG(msg)) {
290  case kCM_BUTTON:
291  switch (parm1) {
292 
293  case 0:
294  // Apply button
297  DeleteWindow();
298  break;
299 
300  case 1:
301  // Close button
302  fChain = 0;
303  DeleteWindow();
304  break;
305  }
306  break;
307  default:
308  break;
309  }
310  break;
311 
312  case kC_CONTAINER:
313  switch (GET_SUBMSG(msg)) {
314  case kCT_ITEMDBLCLICK:
315  if (parm1==kButton1) {
316  TGLVEntry *lv_entry = (TGLVEntry *)fContents->GetLastActive();
317  if (lv_entry) OnDoubleClick(lv_entry, parm1);
318  }
319  break;
320  }
321  break;
322  default:
323  break;
324  }
325  return kTRUE;
326 }
327 
328 ////////////////////////////////////////////////////////////////////////////////
329 /// Close file dialog.
330 
332 {
333  DeleteWindow();
334 }
335 
336 
337 //////////////////////////////////////////////////////////////////////////
338 // New Query Dialog
339 //////////////////////////////////////////////////////////////////////////
340 
341 ////////////////////////////////////////////////////////////////////////////////
342 /// Create a new Query dialog, used by the Session Viewer, to Edit a Query if
343 /// the editmode flag is set, or to create a new one if not set.
344 
346  TQueryDescription *query, Bool_t editmode) :
347  TGTransientFrame(gClient->GetRoot(), gui, Width, Height)
348 {
349  Window_t wdummy;
350  Int_t ax, ay;
351  fEditMode = editmode;
352  fModified = kFALSE;
353  fChain = 0;
354  fQuery = query;
355  if (fQuery && fQuery->fChain) {
356  fChain = fQuery->fChain;
357  }
358  Build(gui);
359  // if in edit mode, update fields with query description data
360  if (editmode && query)
361  UpdateFields(query);
362  else if (!editmode) {
363  TQueryDescription *fquery;
364  fquery = (TQueryDescription *)fViewer->GetActDesc()->fQueries->Last();
365  if(fquery)
366  fTxtQueryName->SetText(fquery->fQueryName);
367  else
368  fTxtQueryName->SetText("Query 1");
369  }
370  MapSubwindows();
371  Resize(Width, Height);
372  // hide options frame
374  fBtnMore->SetText(" More >> ");
375  SetWMSizeHints(Width+5, Height+25, Width+5, Height+25, 1, 1);
377  Layout();
378  SetWindowName("Query Dialog");
379  // Position relative to parent
380  gVirtualX->TranslateCoordinates( fViewer->GetId(),
382  0, 0, ax, ay, wdummy);
383  Move(ax + fViewer->GetWidth()/2, ay + 35);
384 }
385 
386 ////////////////////////////////////////////////////////////////////////////////
387 /// Delete query dialog.
388 
390 {
391  if (IsZombie()) return;
392  Cleanup();
393 }
394 
395 ////////////////////////////////////////////////////////////////////////////////
396 /// Build the "new query" dialog.
397 
399 {
400  TGButton* btnTmp;
401  fViewer = gui;
404  SetMinWidth(500);
405  fFrmNewQuery = new TGGroupFrame(this, "New Query");
407 
409  kLHintsExpandY, 2, 2, 2, 2));
411 
412  // add "Query Name" label and text entry
413  fFrmNewQuery->AddFrame(new TGLabel(fFrmNewQuery, "Query Name :"),
414  new TGTableLayoutHints(0, 1, 0, 1, kLHintsCenterY, 0, 5, 4, 0));
416  (const char *)0, 1), new TGTableLayoutHints(1, 2, 0, 1,
417  kLHintsCenterY, 5, 5, 4, 0));
418 
419  // add "TChain" label and text entry
420  fFrmNewQuery->AddFrame(new TGLabel(fFrmNewQuery, "TChain :"),
421  new TGTableLayoutHints(0, 1, 1, 2, kLHintsCenterY, 0, 5, 4, 0));
423  (const char *)0, 2), new TGTableLayoutHints(1, 2, 1, 2,
424  kLHintsCenterY, 5, 5, 4, 0));
425  fTxtChain->SetToolTipText("Specify TChain or TDSet from memory or file");
427  // add "Browse" button
428  fFrmNewQuery->AddFrame(btnTmp = new TGTextButton(fFrmNewQuery, "Browse..."),
429  new TGTableLayoutHints(2, 3, 1, 2, kLHintsCenterY, 5, 0, 4, 8));
430  btnTmp->Connect("Clicked()", "TNewQueryDlg", this, "OnBrowseChain()");
431 
432  // add "Selector" label and text entry
433  fFrmNewQuery->AddFrame(new TGLabel(fFrmNewQuery, "Selector :"),
434  new TGTableLayoutHints(0, 1, 2, 3, kLHintsCenterY, 0, 5, 0, 0));
436  (const char *)0, 3), new TGTableLayoutHints(1, 2, 2, 3,
437  kLHintsCenterY, 5, 5, 0, 0));
438  // add "Browse" button
439  fFrmNewQuery->AddFrame(btnTmp = new TGTextButton(fFrmNewQuery, "Browse..."),
440  new TGTableLayoutHints(2, 3, 2, 3, kLHintsCenterY, 5, 0, 0, 8));
441  btnTmp->Connect("Clicked()", "TNewQueryDlg", this, "OnBrowseSelector()");
442 
443  // add "Less <<" ("More >>") button
445  new TGTableLayoutHints(2, 3, 4, 5, kLHintsCenterY, 5, 5, 4, 0));
446  fBtnMore->Connect("Clicked()", "TNewQueryDlg", this, "OnNewQueryMore()");
447 
448  // add (initially hidden) options frame
449  fFrmMore = new TGCompositeFrame(fFrmNewQuery, 200, 200);
451 
455 
456  // add "Options" label and text entry
457  fFrmMore->AddFrame(new TGLabel(fFrmMore, "Options :"),
458  new TGTableLayoutHints(0, 1, 0, 1, kLHintsCenterY, 0, 5, 0, 0));
460  (const char *)0, 4), new TGTableLayoutHints(1, 2, 0, 1, 0, 22,
461  0, 0, 8));
462  fTxtOptions->SetText("ASYN");
463 
464  // add "Nb Entries" label and number entry
465  fFrmMore->AddFrame(new TGLabel(fFrmMore, "Nb Entries :"),
466  new TGTableLayoutHints(0, 1, 1, 2, kLHintsCenterY, 0, 5, 0, 0));
470  0, 22, 0, 0, 8));
471  // coverity[negative_returns]: no problem with -1, the format is kNESInteger
473  // add "First Entry" label and number entry
474  fFrmMore->AddFrame(new TGLabel(fFrmMore, "First entry :"),
475  new TGTableLayoutHints(0, 1, 2, 3, kLHintsCenterY, 0, 5, 0, 0));
479  22, 0, 0, 8));
480 
481  // add "Event list" label and text entry
482  fFrmMore->AddFrame(new TGLabel(fFrmMore, "Event list :"),
483  new TGTableLayoutHints(0, 1, 3, 4, kLHintsCenterY, 0, 5, 0, 0));
485  (const char *)0, 6), new TGTableLayoutHints(1, 2, 3, 4, 0, 22,
486  5, 0, 0));
487  // add "Browse" button
488  fFrmMore->AddFrame(btnTmp = new TGTextButton(fFrmMore, "Browse..."),
489  new TGTableLayoutHints(2, 3, 3, 4, 0, 6, 0, 0, 8));
490  btnTmp->Connect("Clicked()", "TNewQueryDlg", this, "OnBrowseEventList()");
491 
492  fTxtQueryName->Associate(this);
493  fTxtChain->Associate(this);
494  fTxtSelector->Associate(this);
495  fTxtOptions->Associate(this);
496  fNumEntries->Associate(this);
497  fNumFirstEntry->Associate(this);
498  fTxtEventList->Associate(this);
499 
500  fTxtQueryName->Connect("TextChanged(char*)", "TNewQueryDlg", this,
501  "SettingsChanged()");
502  fTxtChain->Connect("TextChanged(char*)", "TNewQueryDlg", this,
503  "SettingsChanged()");
504  fTxtSelector->Connect("TextChanged(char*)", "TNewQueryDlg", this,
505  "SettingsChanged()");
506  fTxtOptions->Connect("TextChanged(char*)", "TNewQueryDlg", this,
507  "SettingsChanged()");
508  fNumEntries->Connect("ValueChanged(Long_t)", "TNewQueryDlg", this,
509  "SettingsChanged()");
510  fNumFirstEntry->Connect("ValueChanged(Long_t)", "TNewQueryDlg", this,
511  "SettingsChanged()");
512  fTxtEventList->Connect("TextChanged(char*)", "TNewQueryDlg", this,
513  "SettingsChanged()");
514 
515  TGCompositeFrame *tmp;
516  AddFrame(tmp = new TGCompositeFrame(this, 140, 20, kHorizontalFrame),
518  tmp->SetCleanup(kDeepCleanup);
519  // Add "Save" and "Save & Submit" buttons if we are in edition mode
520  // or "Add" and "Add & Submit" if we are not in edition mode.
521  if (fEditMode) {
522  fBtnSave = new TGTextButton(tmp, "Save");
523  fBtnSubmit = new TGTextButton(tmp, "Save && Submit");
524  }
525  else {
526  fBtnSave = new TGTextButton(tmp, "Add");
527  fBtnSubmit = new TGTextButton(tmp, "Add && Submit");
528  }
530  3, 3, 3, 3));
532  3, 3, 3, 3));
533  fBtnSave->Connect("Clicked()", "TNewQueryDlg", this, "OnBtnSaveClicked()");
534  fBtnSubmit->Connect("Clicked()", "TNewQueryDlg", this, "OnBtnSubmitClicked()");
535  tmp->AddFrame(fBtnClose = new TGTextButton(tmp, "Close"),
536  new TGLayoutHints(kLHintsLeft | kLHintsExpandX, 3, 3, 3, 3));
537  fBtnClose->Connect("Clicked()", "TNewQueryDlg", this, "OnBtnCloseClicked()");
540 }
541 
542 ////////////////////////////////////////////////////////////////////////////////
543 /// Called when window is closed via the window manager.
544 
546 {
547  DeleteWindow();
548 }
549 
550 ////////////////////////////////////////////////////////////////////////////////
551 /// Show/hide options frame and update button text accordingly.
552 
554 {
557  fBtnMore->SetText(" More >> ");
558  }
559  else {
561  fBtnMore->SetText(" Less << ");
562  }
563 }
564 
565 ////////////////////////////////////////////////////////////////////////////////
566 /// Call new chain dialog.
567 
569 {
570  TNewChainDlg *dlg = new TNewChainDlg(fClient->GetRoot(), this);
571  dlg->Connect("OnElementSelected(TObject *)", "TNewQueryDlg",
572  this, "OnElementSelected(TObject *)");
573 }
574 
575 ////////////////////////////////////////////////////////////////////////////////
576 /// Handle OnElementSelected signal coming from new chain dialog.
577 
579 {
580  if (obj) {
581  fChain = obj;
582  if (obj->IsA() == TChain::Class())
583  fTxtChain->SetText(((TChain *)fChain)->GetName());
584  else if (obj->IsA() == TDSet::Class())
585  fTxtChain->SetText(((TDSet *)fChain)->GetObjName());
586  }
587 }
588 
589 ////////////////////////////////////////////////////////////////////////////////
590 /// Open file browser to choose selector macro.
591 
593 {
594  TGFileInfo fi;
595  fi.fFileTypes = gFileTypes;
596  new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
597  if (!fi.fFilename) return;
599 }
600 
601 ////////////////////////////////////////////////////////////////////////////////
602 ///Browse event list
603 
605 {
606 }
607 
608 ////////////////////////////////////////////////////////////////////////////////
609 /// Save current settings in main session viewer.
610 
612 {
613  // if we are in edition mode and query description is valid,
614  // use it, otherwise create a new one
615  TQueryDescription *newquery;
616  if (fEditMode && fQuery)
617  newquery = fQuery;
618  else
619  newquery = new TQueryDescription();
620 
621  // update query description fields
622  newquery->fSelectorString = fTxtSelector->GetText();
623  if (fChain) {
624  newquery->fTDSetString = fChain->GetName();
625  newquery->fChain = fChain;
626  }
627  else {
628  newquery->fTDSetString = "";
629  newquery->fChain = 0;
630  }
631  newquery->fQueryName = fTxtQueryName->GetText();
632  newquery->fOptions.Form("%s",fTxtOptions->GetText());
633  newquery->fNoEntries = fNumEntries->GetIntNumber();
634  newquery->fFirstEntry = fNumFirstEntry->GetIntNumber();
635  newquery->fNbFiles = 0;
636  newquery->fResult = 0;
637 
638  if (newquery->fChain) {
639  if (newquery->fChain->IsA() == TChain::Class())
640  newquery->fNbFiles = ((TChain *)newquery->fChain)->GetListOfFiles()->GetEntriesFast();
641  else if (newquery->fChain->IsA() == TDSet::Class())
642  newquery->fNbFiles = ((TDSet *)newquery->fChain)->GetListOfElements()->GetSize();
643  }
644  if (!fEditMode) {
645  // if not in editor mode, create a new list tree item
646  // and set user data to the newly created query description
647  newquery->fResult = 0;
649 
650  TQueryDescription *fquery;
652  while (fquery) {
653  int e = 1, j = 0, idx = 0;
654  const char *name = fquery->fQueryName;
655  for (int i=strlen(name)-1;i>0;i--) {
656  if (isdigit(name[i])) {
657  idx += (name[i]-'0') * e;
658  e *= 10;
659  j++;
660  }
661  else
662  break;
663  }
664  if (idx > 0) {
665  idx++;
666  newquery->fQueryName.Remove(strlen(name)-j,j);
667  newquery->fQueryName.Append(Form("%d",idx));
668  }
669  else
670  newquery->fQueryName.Append(" 1");
672  }
673  fTxtQueryName->SetText(newquery->fQueryName);
674  fViewer->GetActDesc()->fQueries->Add((TObject *)newquery);
679  item2->SetUserData(newquery);
684  fViewer->OnListTreeClicked(item2, 1, 0, 0);
685  }
686  else {
687  // else if in editor mode, just update user data with modified
688  // query description
690  fViewer->GetSessionHierarchy()->RenameItem(item, newquery->fQueryName);
691  item->SetUserData(newquery);
692  }
693  // update list tree
698  fModified = kFALSE;
699 }
700 
701 ////////////////////////////////////////////////////////////////////////////////
702 /// Save and submit query description.
703 
705 {
708 }
709 
710 ////////////////////////////////////////////////////////////////////////////////
711 /// Close dialog.
712 
714 {
715  Int_t result = kMBNo;
716  if (fModified) {
717  new TGMsgBox(fClient->GetRoot(), this, "Modified Settings",
718  "Do you wish to SAVE changes ?", 0,
719  kMBYes | kMBNo | kMBCancel, &result);
720  if (result == kMBYes) {
722  }
723  }
724  if (result == kMBNo) {
725  DeleteWindow();
726  }
727 }
728 
729 ////////////////////////////////////////////////////////////////////////////////
730 /// Display dialog and set focus to query name text entry.
731 
733 {
734  MapWindow();
736 }
737 
738 ////////////////////////////////////////////////////////////////////////////////
739 /// Settings have changed, update GUI accordingly.
740 
742 {
743  if (fEditMode && fQuery) {
744  if ((strcmp(fQuery->fSelectorString.Data(), fTxtSelector->GetText())) ||
745  (strcmp(fQuery->fQueryName.Data(), fTxtQueryName->GetText())) ||
746  (strcmp(fQuery->fOptions.Data(), fTxtOptions->GetText())) ||
749  (fQuery->fChain != fChain)) {
750  fModified = kTRUE;
751  }
752  else {
753  fModified = kFALSE;
754  }
755  }
756  else {
757  if ((fTxtQueryName->GetText()) &&
758  ((fTxtQueryName->GetText()) ||
759  (fTxtChain->GetText())))
760  fModified = kTRUE;
761  else
762  fModified = kFALSE;
763  }
764  if (fModified) {
767  }
768  else {
771  }
772 }
773 
774 ////////////////////////////////////////////////////////////////////////////////
775 /// Update entry fields with query description values.
776 
778 {
779  fQuery = desc;
781  fTxtChain->SetText("");
782  if (desc->fChain)
785  fTxtOptions->SetText(desc->fOptions);
789 }
790 ////////////////////////////////////////////////////////////////////////////////
791 /// Process messages for new query dialog.
792 /// Essentially used to navigate between text entry fields.
793 
795 {
796  switch (GET_MSG(msg)) {
797  case kC_TEXTENTRY:
798  switch (GET_SUBMSG(msg)) {
799  case kTE_ENTER:
800  case kTE_TAB:
801  switch (parm1) {
802  case 1: // Query Name
803  fTxtChain->SelectAll();
804  fTxtChain->SetFocus();
805  break;
806  case 2: // Chain Name
809  break;
810  case 3: // Selector Name
813  break;
814  case 4: // Options
817  break;
818  case 6: // Event List
821  break;
822  }
823  break;
824 
825  default:
826  break;
827  }
828  break;
829 
830  default:
831  break;
832  }
833  return kTRUE;
834 }
835 
836 //////////////////////////////////////////////////////////////////////////
837 // Upload DataSet Dialog
838 //////////////////////////////////////////////////////////////////////////
839 
840 ////////////////////////////////////////////////////////////////////////////////
841 /// Create a Upload DataSet dialog box. Used to create and upload a dataset
842 
844  TGTransientFrame(gClient->GetRoot(), gui, w, h)
845 {
846  fUploading = kFALSE;
847  if (!gui) return;
848  fViewer = gui;
849 
851  TGHorizontalFrame *hFrame1 = new TGHorizontalFrame(this);
852  hFrame1->SetCleanup(kDeepCleanup);
853  hFrame1->AddFrame(new TGLabel(hFrame1,"Name of DataSet :"),
855  10, 10, 5, 5));
856  fDSetName = new TGTextEntry(hFrame1, new TGTextBuffer(50));
857  fDSetName->SetText("DataSet1");
860  10, 10, 5, 5));
862  2, 2, 2, 2));
863 
864  // "DataSet Files" group frame
865  TGGroupFrame *groupFrame1 = new TGGroupFrame(this, "DataSet Files");
866  groupFrame1->SetCleanup(kDeepCleanup);
867 
868  // horizontal frame for files location URL
869  TGHorizontalFrame *hFrame11 = new TGHorizontalFrame(groupFrame1);
870  hFrame11->SetCleanup(kDeepCleanup);
871  hFrame11->AddFrame(new TGLabel(hFrame11,"Location URL :"),
873  10, 10, 5, 5));
874  fLocationURL = new TGTextEntry(hFrame11, new TGTextBuffer(150));
875  fLocationURL->SetToolTipText("Enter location URL ( i.e \" root://lxplus//castor/cern.ch/user/n/name/*.root \" )");
878  kLHintsCenterY, 10, 10, 5, 5));
879  fAddButton = new TGTextButton(hFrame11, " Add >> ", 0);
880  fAddButton->SetToolTipText("Add file(s) to the list");
881  fAddButton->Associate(this);
883  kLHintsExpandX, 5, 10, 5, 5));
884  groupFrame1->AddFrame(hFrame11, new TGLayoutHints(kLHintsLeft | kLHintsTop |
885  kLHintsExpandX, 2, 2, 2, 2));
886  // horizontal frame for the list view displaying list of files
887  // and for a vertical frame with control buttons
888  TGHorizontalFrame *hFrame2 = new TGHorizontalFrame(groupFrame1);
889  hFrame2->SetCleanup(kDeepCleanup);
890 
891  // list view
892  // Add TGListView used to show list of files
893  fListView = new TGListView(hFrame2, 300, 100);
899  fLVContainer->SetHeader("File Name", kTextLeft, kTextLeft , 0);
901  kLHintsExpandX | kLHintsExpandY, 2, 2, 10, 10));
902 
903  // vertical frame for control buttons
904  TGVerticalFrame *vFrame1 = new TGVerticalFrame(hFrame2);
905  vFrame1->SetCleanup(kDeepCleanup);
906 
907  fBrowseButton = new TGTextButton(vFrame1, " Browse... ", 1);
908  fBrowseButton->SetToolTipText("Add file(s) to the list");
909  fBrowseButton->Associate(this);
911  kLHintsExpandX, 15, 5, 5, 5));
912  fRemoveButton = new TGTextButton(vFrame1, " Remove ", 2);
913  fRemoveButton->SetToolTipText("Remove selected file from the list");
914  fRemoveButton->Associate(this);
916  kLHintsExpandX, 15, 5, 5, 5));
917  fClearButton = new TGTextButton(vFrame1, " Clear ", 3);
918  fClearButton->SetToolTipText("Clear list of files");
919  fClearButton->Associate(this);
921  kLHintsExpandX, 15, 5, 5, 5));
922 
923  fOverwriteDSet = new TGCheckButton(vFrame1, "Overwrite DataSet");
924  fOverwriteDSet->SetToolTipText("Overwrite DataSet");
926  kLHintsExpandX, 15, 5, 5, 5));
927  fOverwriteFiles = new TGCheckButton(vFrame1, "Overwrite Files");
928  fOverwriteFiles->SetToolTipText("Overwrite files in DataSet");
930  kLHintsExpandX, 15, 5, 5, 5));
931  fAppendFiles = new TGCheckButton(vFrame1, "Append Files");
932  fAppendFiles->SetToolTipText("Append files in DataSet");
934  kLHintsExpandX, 15, 5, 5, 5));
935 
936  fOverwriteDSet->Connect("Toggled(Bool_t)", "TUploadDataSetDlg", this,
937  "OnOverwriteDataset(Bool_t)");
938  fOverwriteFiles->Connect("Toggled(Bool_t)", "TUploadDataSetDlg", this,
939  "OnOverwriteFiles(Bool_t)");
940  fAppendFiles->Connect("Toggled(Bool_t)", "TUploadDataSetDlg", this,
941  "OnAppendFiles(Bool_t)");
942 
943  hFrame2->AddFrame(vFrame1, new TGLayoutHints(kLHintsRight | kLHintsTop |
944  kLHintsExpandY, 2, 2, 2, 2));
945  groupFrame1->AddFrame(hFrame2, new TGLayoutHints(kLHintsLeft | kLHintsTop |
946  kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
947 
948  AddFrame(groupFrame1, new TGLayoutHints(kLHintsLeft | kLHintsTop |
949  kLHintsExpandX, 5, 5, 2, 2));
950 
951  // horizontal frame for destination URL
952  TGHorizontalFrame *hFrame3 = new TGHorizontalFrame(this);
953  hFrame3->SetCleanup(kDeepCleanup);
954  hFrame3->AddFrame(new TGLabel(hFrame3,"Destination URL :"),
956  15, 10, 5, 5));
957  fDestinationURL = new TGTextEntry(hFrame3, new TGTextBuffer(150));
958  if (fViewer->GetActDesc()->fConnected &&
960  fViewer->GetActDesc()->fProof &&
961  fViewer->GetActDesc()->fProof->IsValid()) {
962  // const char *dest = fViewer->GetActDesc()->fProof->GetDataPoolUrl();
963  // fDestinationURL->SetText(dest);
964  }
965  fDestinationURL->SetToolTipText("Enter destination URL ( relative to \" root://host//proofpool/user/ \" )");
968  kLHintsCenterY, 10, 15, 5, 5));
970  2, 2, 2, 2));
971 
972  // horizontal frame for upload and close buttons
973  TGHorizontalFrame *hFrame4 = new TGHorizontalFrame(this);
974  hFrame4->SetCleanup(kDeepCleanup);
975  fUploadButton = new TGTextButton(hFrame4, "Upload DataSet", 10);
976  fUploadButton->SetToolTipText("Upload the dataset to the cluster");
977  fUploadButton->Associate(this);
979  kLHintsExpandX, 15, 15, 2, 2));
980  fCloseDlgButton = new TGTextButton(hFrame4, "Close Dialog", 11);
981  fCloseDlgButton->SetToolTipText("Close the dialog");
982  fCloseDlgButton->Associate(this);
984  kLHintsExpandX, 15, 15, 2, 2));
986  2, 2, 2, 2));
987 
988  // position relative to the parent's window
989  Window_t wdummy;
990  Int_t ax, ay;
991  gVirtualX->TranslateCoordinates( gui->GetId(),
993  0, 0, ax, ay, wdummy);
994  Move(ax + 250, ay + 200);
995 
996  SetWindowName("Upload DataSet Dialog");
997  MapSubwindows();
998  MapWindow();
999 
1000  Resize(w, h);
1001  SetWMSizeHints(w+5, h+5, w+5, h+5, 1, 1);
1003  Layout();
1004 }
1005 
1006 ////////////////////////////////////////////////////////////////////////////////
1007 /// Delete chain dialog.
1008 
1010 {
1011  if (IsZombie()) return;
1012  Cleanup();
1013 }
1014 
1015 ////////////////////////////////////////////////////////////////////////////////
1016 /// Close upload dataset dialog.
1017 
1019 {
1020  if (!fUploading)
1021  DeleteWindow();
1022 }
1023 
1024 ////////////////////////////////////////////////////////////////////////////////
1025 /// Process messages for upload dataset dialog.
1026 
1028 {
1029  switch (GET_MSG(msg)) {
1030  case kC_COMMAND:
1031  switch (GET_SUBMSG(msg)) {
1032  case kCM_BUTTON:
1033  switch (parm1) {
1034  case 0:
1035  // Add button
1036  if (fLocationURL->GetText())
1038  break;
1039  case 1:
1040  // Add button
1041  BrowseFiles();
1042  break;
1043  case 2:
1044  // Remove button
1045  RemoveFile();
1046  break;
1047  case 3:
1048  // Clear button
1049  ClearFiles();
1050  break;
1051  case 10:
1052  // Upload button
1053  UploadDataSet();
1054  break;
1055  case 11:
1056  // Close button
1057  CloseWindow();
1058  break;
1059  }
1060  break;
1061  default:
1062  break;
1063  }
1064  break;
1065 
1066  default:
1067  break;
1068  }
1069  return kTRUE;
1070 }
1071 
1072 ////////////////////////////////////////////////////////////////////////////////
1073 /// Add File name(s) from the file location URL to the list view.
1074 
1075 void TUploadDataSetDlg::AddFiles(const char *fileName)
1076 {
1077  if (strlen(fileName) < 5)
1078  return;
1079  if (strstr(fileName,"*.")) {
1080  // wildcarding case
1081  void *filesDir = gSystem->OpenDirectory(gSystem->DirName(fileName));
1082  const char* ent;
1083  TString filesExp(gSystem->BaseName(fileName));
1084  filesExp.ReplaceAll("*",".*");
1085  TRegexp rg(filesExp);
1086  while ((ent = gSystem->GetDirEntry(filesDir))) {
1087  TString entryString(ent);
1088  if (entryString.Index(rg) != kNPOS &&
1089  gSystem->AccessPathName(Form("%s/%s", gSystem->DirName(fileName),
1090  ent), kReadPermission) == kFALSE) {
1091  TString text = TString::Format("%s/%s",
1092  gSystem->UnixPathName(gSystem->DirName(fileName)), ent);
1093  if (!fLVContainer->FindItem(text.Data())) {
1094  TGLVEntry *entry = new TGLVEntry(fLVContainer, text.Data(), text.Data());
1095  entry->SetPictures(gClient->GetPicture("rootdb_t.xpm"),
1096  gClient->GetPicture("rootdb_t.xpm"));
1097  fLVContainer->AddItem(entry);
1098  }
1099  }
1100  }
1101  }
1102  else {
1103  // single file
1104  if (!fLVContainer->FindItem(fileName)) {
1105  TGLVEntry *entry = new TGLVEntry(fLVContainer, fileName, fileName);
1106  entry->SetPictures(gClient->GetPicture("rootdb_t.xpm"),
1107  gClient->GetPicture("rootdb_t.xpm"));
1108  fLVContainer->AddItem(entry);
1109  }
1110  }
1111  // update list view
1113  fListView->Layout();
1115 }
1116 
1117 ////////////////////////////////////////////////////////////////////////////////
1118 /// Add File name(s) from the file location URL to the list view.
1119 
1121 {
1122  TObjString *el;
1123  TIter next(fileList);
1124  while ((el = (TObjString *) next())) {
1125  TString fileName = TString::Format("%s/%s",
1127  gSystem->BaseName(el->GetString()));
1128  // single file
1129  if (!fLVContainer->FindItem(fileName.Data())) {
1130  TGLVEntry *entry = new TGLVEntry(fLVContainer, fileName.Data(), fileName.Data());
1131  entry->SetPictures(gClient->GetPicture("rootdb_t.xpm"),
1132  gClient->GetPicture("rootdb_t.xpm"));
1133  fLVContainer->AddItem(entry);
1134  }
1135  }
1136  // update list view
1138  fListView->Layout();
1140 }
1141 
1142 ////////////////////////////////////////////////////////////////////////////////
1143 /// Opens the TGFileDialog to allow user to select local file(s) to be added
1144 /// in the list view of dataset files.
1145 
1147 {
1148  TGFileInfo fi;
1149  fi.fFileTypes = gDatasetTypes;
1150  fi.fFilename = strdup("*.root");
1151  new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi);
1152  if (fi.fMultipleSelection && fi.fFileNamesList) {
1154  }
1155  else if (fi.fFilename) {
1156  AddFiles(fi.fFilename);
1157  }
1158 }
1159 
1160 ////////////////////////////////////////////////////////////////////////////////
1161 /// Clear content of the list view.
1162 
1164 {
1166  fListView->Layout();
1167  // update list view
1169 }
1170 
1171 ////////////////////////////////////////////////////////////////////////////////
1172 /// Notification of Overwrite Dataset check button.
1173 
1175 {
1176  if (on && fAppendFiles->IsOn())
1178 }
1179 
1180 ////////////////////////////////////////////////////////////////////////////////
1181 /// Notification of Overwrite Files check button.
1182 
1184 {
1185 }
1186 
1187 ////////////////////////////////////////////////////////////////////////////////
1188 /// Notification of Append Files check button.
1189 
1191 {
1192  if (on && fOverwriteDSet->IsOn())
1194 }
1195 
1196 ////////////////////////////////////////////////////////////////////////////////
1197 /// Remove the selected entry from the list view.
1198 
1200 {
1201  TGFrame *item = (TGFrame *)fLVContainer->GetLastActive();
1202  fLVContainer->RemoveItem(item);
1203  // update list view
1205  fListView->Layout();
1207 }
1208 
1209 ////////////////////////////////////////////////////////////////////////////////
1210 /// Upload the dataset to the server.
1211 
1213 {
1214  Int_t retval;
1215  TString fileList;
1216  const char *dsetName = fDSetName->GetText();
1217  const char *destination = fDestinationURL->GetText();
1218  UInt_t flags = 0;
1219  TList *skippedFiles = new TList();
1220  TList *datasetFiles = new TList();
1221 
1222  if (fUploading)
1223  return;
1224  if (!fViewer->GetActDesc()->fConnected ||
1225  !fViewer->GetActDesc()->fAttached ||
1226  !fViewer->GetActDesc()->fProof ||
1227  !fViewer->GetActDesc()->fProof->IsValid()) {
1228  return;
1229  }
1230  // Format upload flags with user selection
1231  if (fOverwriteDSet->IsOn())
1232  flags |= TProof::kOverwriteDataSet;
1233  else
1234  flags |= TProof::kNoOverwriteDataSet;
1235  if (fOverwriteFiles->IsOn())
1236  flags |= TProof::kOverwriteAllFiles;
1237  else
1238  flags |= TProof::kOverwriteNoFiles;
1239  if (fAppendFiles->IsOn()) {
1240  flags |= TProof::kAppend;
1241  if (flags & TProof::kNoOverwriteDataSet)
1242  flags &= ~TProof::kNoOverwriteDataSet;
1243  }
1244 
1245  Int_t ret = 0;
1247  TGFrameElement *el;
1248  TGLVEntry *entry;
1249 
1250  while ((el = (TGFrameElement *)next())) {
1251  entry = (TGLVEntry *) el->fFrame;
1252  const char *fname = gSystem->UnixPathName(entry->GetTitle());
1253  datasetFiles->Add(new TFileInfo(fname));
1254  }
1255  fUploading = kTRUE;
1258 
1259  if (strlen(destination) < 2) destination = 0;
1260 
1261  // GG 17/8/2012 -- BEGIN
1262  // NB: UploadDataSet is obsolete; these changes are the minimal ones to make
1263  // the build after the removal of an obsolete structure in TProof.h;
1264  // but all this needs to be reconsidered.
1265  ret = fViewer->GetActDesc()->fProof->UploadDataSet(dsetName,
1266  datasetFiles, destination, flags, skippedFiles);
1267 #if 0
1268  if (ret == TProof::kDataSetExists) {
1269  // ask user what to do :
1270  // cancel/overwrite and change option
1271  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1272  TString::Format("The dataset \"%s\" already exists on the cluster ! Overwrite ?",
1273  dsetName), kMBIconQuestion, kMBYes | kMBNo | kMBCancel | kMBAppend,
1274  &retval);
1275  if (retval == kMBYes) {
1276  ret = fViewer->GetActDesc()->fProof->UploadDataSet(dsetName,
1277  datasetFiles, destination,
1280  skippedFiles);
1281  }
1282  if (retval == kMBAppend) {
1283  ret = fViewer->GetActDesc()->fProof->UploadDataSet(dsetName,
1284  datasetFiles, destination,
1285  TProof::kAppend |
1287  skippedFiles);
1288  }
1289  }
1290 #endif
1291  if (ret != 0) {
1292  // Inform user
1293  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1294  "Failed uploading dataset/files to the cluster",
1295  kMBIconExclamation, kMBOk, &retval);
1296  fUploading = kFALSE;
1299  return;
1300  }
1301  // Here we cope with files that existed on the cluster and were skipped.
1302  if (skippedFiles->GetSize()) {
1303  TIter nexts(skippedFiles);
1304  while (TFileInfo *obj = (TFileInfo*)nexts()) {
1305  // Notify user that file: obj->GetFirstUrl()->GetUrl() exists on
1306  // the cluster and ask user what to do
1307  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1308  TString::Format("The file \"%s\" already exists on the cluster ! Overwrite ?",
1309  obj->GetFirstUrl()->GetUrl()), kMBIconQuestion,
1310  kMBYes | kMBNo | kMBYesAll | kMBNoAll | kMBDismiss, &retval);
1311  if (retval == kMBYesAll) {
1312  ret = fViewer->GetActDesc()->fProof->UploadDataSet(dsetName,
1313  skippedFiles, destination,
1314  TProof::kAppend |
1316  if (ret != 0) {
1317  // Inform user
1318  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1319  TString::Format("Failed uploading \"%s\" to the cluster",
1320  obj->GetFirstUrl()->GetUrl()), kMBIconExclamation,
1321  kMBOk, &retval);
1322  }
1323  else {
1324  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1325  "Files have been successfully uploaded to the cluster",
1326  kMBIconAsterisk, kMBOk, &retval);
1327  }
1328  fUploading = kFALSE;
1331  return;
1332  }
1333  if ((retval == kMBNoAll) || (retval == kMBDismiss)) {
1334  break;
1335  }
1336  if (retval == kMBYes) {
1337  // Append one file to the dataSet
1338  ret = fViewer->GetActDesc()->fProof->UploadDataSet(dsetName,
1339  obj->GetFirstUrl()->GetUrl(), destination,
1341  if (ret != 0) {
1342  // Inform user
1343  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1344  TString::Format("Failed uploading \"%s\" to the cluster",
1345  obj->GetFirstUrl()->GetUrl()), kMBIconExclamation,
1346  kMBOk, &retval);
1347  }
1348  else {
1349  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1350  "Files have been successfully uploaded to the cluster",
1351  kMBIconAsterisk, kMBOk, &retval);
1352  }
1353  }
1354  }
1355  skippedFiles->Clear();
1356  }
1357  else {
1358  new TGMsgBox(fClient->GetRoot(), this, "Upload DataSet",
1359  "Files have been successfully uploaded to the cluster",
1360  kMBIconAsterisk, kMBOk, &retval);
1361  }
1362  // GG 17/8/2012 -- END
1363 
1364  // finally, update list of datasets in session viewer
1366  fUploading = kFALSE;
1369 }
1370 
TGTextEntry * fName
virtual void HideFrame(TGFrame *f)
Hide sub frame.
Definition: TGFrame.cxx:1172
TGLVContainer * fLVContainer
void OnBtnSubmit()
Submit query.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:928
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1265
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
Definition: TGFrame.cxx:587
virtual Long_t ProcessLine(const char *line, Bool_t sync=kFALSE, Int_t *error=0)
Process a single command line, either a C++ statement or an interpreter command starting with a "...
const char * GetDirectory() const
virtual const char * GetName() const
Return unique name, used in SavePrimitive methods.
Definition: TGWindow.cxx:221
TGFileContainer * fContents
TGListTreeItem * FindChildByData(TGListTreeItem *item, void *userData)
Find child of item by userData.
void Popup()
Display dialog and set focus to query name text entry.
TGTextBuffer * fNameBuf
virtual void RemoveAll()
Remove all items from the container.
Definition: TGCanvas.cxx:638
Bool_t IsValid() const
Definition: TProof.h:970
virtual void AdjustHeaders()
Definition: TGListView.h:178
TGTextEntry * fTxtChain
void StopRefreshTimer()
stop refresh timer
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
Collectable string class.
Definition: TObjString.h:32
void OnBrowseChain()
Call new chain dialog.
void RemoveFile()
Remove the selected entry from the list view.
void OnBrowseSelector()
Open file browser to choose selector macro.
TGTextButton * fRemoveButton
TGCompositeFrame * fFrmNewQuery
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
Definition: TGFrame.cxx:1746
TGTextEntry * fLocationURL
TGTextEntry * fDSetName
void OnElementSelected(TObject *obj)
Handle OnElementSelected signal coming from new chain dialog.
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
virtual void SetToolTipText(const char *text, Long_t delayms=500)
Set tool tip text associated with this text entry.
void OnBtnSaveClicked()
Save current settings in main session viewer.
void OnBrowseEventList()
Browse event list.
Definition: TDSet.h:153
const TGWindow * GetRoot() const
Returns current root (i.e.
Definition: TGClient.cxx:222
TSessionViewer * fViewer
TNewQueryDlg(TSessionViewer *gui, Int_t Width, Int_t Height, TQueryDescription *query=0, Bool_t editmode=kFALSE)
Create a new Query dialog, used by the Session Viewer, to Edit a Query if the editmode flag is set...
TH1 * h
Definition: legend2.C:5
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition: TGFrame.cxx:691
UInt_t GetWidth() const
Definition: TGFrame.h:287
void ClearFiles()
Clear content of the list view.
void SetHeaders(Int_t ncolumns)
Definition: TGListView.h:259
TGTextButton * fOkButton
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for new query dialog.
TNewChainDlg(const TGWindow *p=0, const TGWindow *main=0)
Create a new chain dialog box.
Regular expression class.
Definition: TRegexp.h:35
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition: TSystem.cxx:856
#define gROOT
Definition: TROOT.h:340
virtual ~TUploadDataSetDlg()
Delete chain dialog.
TGTextEntry * fDestinationURL
TGTextEntry * fTxtEventList
virtual void Associate(const TGWindow *w)
Definition: TGCanvas.h:101
Bool_t IsZombie() const
Definition: TObject.h:141
TSessionDescription * GetActDesc() const
Basic string class.
Definition: TString.h:137
virtual TList * GetList() const
Definition: TGFrame.h:385
#define gClient
Definition: TGClient.h:174
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition: TGFrame.cxx:982
TGTextButton * fBtnSubmit
virtual void ShowFrame(TGFrame *f)
Show sub frame.
Definition: TGFrame.cxx:1186
int Int_t
Definition: RtypesCore.h:41
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:996
bool Bool_t
Definition: RtypesCore.h:59
virtual ~TNewQueryDlg()
Delete query dialog.
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
void OnOverwriteDataset(Bool_t on)
Notification of Overwrite Dataset check button.
ClassImp(TNewChainDlg) ClassImp(TNewQueryDlg) static const char *gDatasetTypes[]
R__EXTERN TApplication * gApplication
Definition: TApplication.h:171
TGTextButton * fBtnSave
virtual void SetViewMode(EListViewMode viewMode)
Set list view mode for container.
Definition: TGListView.cxx:608
virtual void Layout()
Layout list view components (container and contents of container).
TGTextButton * fUploadButton
Bool_t GetColorByName(const char *name, Pixel_t &pixel) const
Get a color by name.
Definition: TGClient.cxx:392
virtual void Layout()
Layout the elements of the composite frame.
Definition: TGFrame.cxx:1239
TGListView * fListView
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1036
const char * Data() const
Definition: TString.h:349
virtual void ChangeBackground(Pixel_t back)
Change frame background color.
Definition: TGFrame.cxx:275
virtual void SelectAll()
Selects all text (i.e.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition: TSystem.cxx:847
virtual void CloseWindow()
Close file dialog.
TGCompositeFrame * fFrmMore
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2334
ULong_t Pixel_t
Definition: GuiTypes.h:41
void OnBtnSubmitClicked()
Save and submit query description.
void Class()
Definition: Class.C:29
virtual void ChangeDirectory(const char *path)
Change current directory.
virtual UInt_t GetOptions() const
Definition: TGFrame.h:260
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition: TGListTree.h:100
void SettingsChanged()
Settings have changed, update GUI accordingly.
const char ** fFileTypes
Definition: TGFileDialog.h:65
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
Definition: TGFrame.cxx:1862
const char * GetText() const
Definition: TGTextEntry.h:140
void OnListTreeClicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y)
Handle mouse clicks in list tree.
TGCheckButton * fOverwriteDSet
void OnAppendFiles(Bool_t on)
Notification of Append Files check button.
TSeqCollection * fChains
TGLVContainer * fLVContainer
virtual void SetFocus()
Set focus to this text entry.
TGCompositeFrame(const TGCompositeFrame &)
TString & Append(const char *cs)
Definition: TString.h:492
TGTextButton * fCloseDlgButton
TSessionFrame * GetSessionFrame() const
void WriteConfiguration(const char *filename=0)
Save actual configuration in config file "filename".
TGTextButton * fClearButton
void SetDefaultHeaders()
Definition: TGListView.h:262
Int_t UploadDataSet(const char *, TList *, const char *=0, Int_t=0, TList *=0)
*** This function is deprecated and will disappear in future versions *** *** It is just a wrapper ar...
Definition: TProof.cxx:11202
virtual void DisplayDirectory(const TString &fname)
Display content of directory.
TUploadDataSetDlg(TSessionViewer *gui, Int_t w, Int_t h)
Create a Upload DataSet dialog box. Used to create and upload a dataset.
virtual void * FindItem(const TString &name, Bool_t direction=kTRUE, Bool_t caseSensitive=kTRUE, Bool_t subString=kFALSE)
Definition: TGCanvas.cxx:1687
void UpdateList()
Update Memory list view.
Definition: TGMsgBox.h:51
TSessionQueryFrame * GetQueryFrame() const
void CloseWindow()
Called when window is closed via the window manager.
TGCheckButton * fOverwriteFiles
virtual void RemoveItem(TGFrame *item)
Remove item from container.
Definition: TGCanvas.cxx:657
void Emit(const char *signal)
Acitvate signal without args.
Definition: TQObject.cxx:559
A doubly linked list.
Definition: TList.h:47
TGTextButton * fBtnClose
void OpenItem(TGListTreeItem *item)
Open item in list tree (i.e. show child items).
TSessionViewer * fViewer
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
Definition: TQObject.cxx:1135
void SetUserData(void *userData)
Definition: TGListView.h:118
virtual void Associate(const TGWindow *w)
Make w the window that will receive the generated messages.
void AddFiles(const char *fileName)
Add File name(s) from the file location URL to the list view.
TGCheckButton * fAppendFiles
TString GetString() const
Definition: TObjString.h:50
TGTextEntry * fTxtOptions
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
Bool_t fMultipleSelection
Definition: TGFileDialog.h:68
Int_t GET_SUBMSG(Long_t val)
Bool_t IsVisible(TGFrame *f) const
Get state of sub frame.
Definition: TGFrame.cxx:1213
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:90
TGListTree * GetSessionHierarchy() const
virtual void SetMinWidth(UInt_t w)
Definition: TGFrame.h:311
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
TObject * fChain
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
virtual TGFileItem * AddFile(const char *name, const TGPicture *pic=0, const TGPicture *lpic=0)
Add file in container.
unsigned int UInt_t
Definition: RtypesCore.h:42
char * Form(const char *fmt,...)
void ClearHighlighted()
Un highlight items.
TGListView * fListView
void OnNewQueryMore()
Show/hide options frame and update button text accordingly.
virtual void CloseWindow()
Close upload dataset dialog.
virtual void ChangeOptions(UInt_t options)
Change composite frame options. Options is an OR of the EFrameTypes.
Definition: TGFrame.cxx:1025
virtual Bool_t IsOn() const
Definition: TGButton.h:315
TGTextEntry * fTxtQueryName
void OnElementSelected(TObject *obj)
Emits OnElementSelected signal if dset is not zero.
TList * fFileNamesList
Definition: TGFileDialog.h:69
void BrowseFiles()
Opens the TGFileDialog to allow user to select local file(s) to be added in the list view of dataset ...
virtual void AddItem(TGLVEntry *item)
Definition: TGListView.h:231
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for new chain dialog.
void OnElementClicked(TGLVEntry *entry, Int_t btn)
Handle click in the Memory list view and put the type and name of selected object in the text entry...
void OnBtnCloseClicked()
Close dialog.
virtual void SetIntNumber(Long_t val)
TGTextButton * fAddButton
Long64_t entry
void UploadDataSet()
Upload the dataset to the server.
#define gVirtualX
Definition: TVirtualX.h:362
virtual void Move(Int_t x, Int_t y)
Move frame.
Definition: TGFrame.cxx:575
Int_t GET_MSG(Long_t val)
virtual void SetText(TGHotString *new_label)
Set new button text.
Definition: TGButton.cxx:594
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for upload dataset dialog.
virtual TObject * Last() const
Return the last object in the list. Returns 0 when list is empty.
Definition: TList.cxx:580
TGListTreeItem * GetSelected() const
Definition: TGListTree.h:403
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
int main(int argc, char *argv[])
Definition: python64.c:14
const TGWindow * GetDefaultRoot() const
Returns the root (i.e.
Definition: TGClient.cxx:232
void UpdateFields(TQueryDescription *desc)
Update entry fields with query description values.
static const char * gFileTypes[]
virtual Int_t GetSize() const
Definition: TCollection.h:95
void SetEnabled(Bool_t flag=kTRUE)
Definition: TGTextEntry.h:170
double f(double x)
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
Definition: TGFrame.cxx:1054
virtual void SetEnabled(Bool_t e=kTRUE)
Set enabled or disabled state of button.
Definition: TGButton.cxx:409
TText * text
virtual void SetPictures(const TGPicture *bigpic=0, const TGPicture *smallpic=0)
change pictures
Definition: TGListView.cxx:292
void * GetUserData() const
Definition: TGListView.h:119
Definition: TProof.h:339
char * fFilename
Definition: TGFileDialog.h:63
TObject * fChain
virtual const char * GetTitle() const
Returns title of object.
Definition: TGListView.h:113
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1099
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Definition: TList.cxx:348
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Definition: TGFrame.cxx:1146
TGTextEntry * fTxtSelector
virtual ~TNewChainDlg()
Delete chain dialog.
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
TGListTreeItem * GetSessionItem() const
Handle_t Window_t
Definition: GuiTypes.h:30
virtual void SetFilter(const char *filter)
Set file selection filter.
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:254
virtual void Add(TObject *obj)
Definition: TList.h:81
const Ssiz_t kNPOS
Definition: Rtypes.h:115
virtual void MapWindow()
Definition: TGFrame.h:267
TGClient * fClient
Definition: TGObject.h:41
TGTextButton * fCancelButton
A chain is a collection of files containg TTree objects.
Definition: TChain.h:35
TLine * lv
Definition: textalign.C:5
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:370
virtual void DisplayDirectory()
Display the contents of the current directory in the container.
TQueryResult * fResult
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:830
void OnOverwriteFiles(Bool_t on)
Notification of Overwrite Files check button.
virtual Long_t GetIntNumber() const
double result[121]
Class describing a generic file including meta information.
Definition: TFileInfo.h:50
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set check button state.
Definition: TGButton.cxx:1200
const TGPicture * GetQueryConPict() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition: TGFrame.h:391
virtual void SetText(const char *text, Bool_t emit=kTRUE)
Sets text entry to text, clears the selection and moves the cursor to the end of the line...
void SetHeader(const char *s, Int_t hmode, Int_t cmode, Int_t idx)
Definition: TGListView.h:260
TQueryDescription * fQuery
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:582
void HighlightItem(TGListTreeItem *item)
Highlight item.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
Definition: TGFrame.cxx:949
virtual void DeleteWindow()
Delete window.
Definition: TGFrame.cxx:258
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:459
TObject * obj
virtual TGFrame * GetLastActive() const
Definition: TGCanvas.h:139
Handle_t GetId() const
Definition: TGObject.h:52
ESessionQueryStatus fStatus
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition: TGButton.cxx:395
TGTextButton * fBrowseButton
void SetSelected(TGListTreeItem *item)
Definition: TGListTree.h:374
void UpdateListOfDataSets()
Update list of dataset present on the cluster.
void RenameItem(TGListTreeItem *item, const char *string)
Rename item in list tree.
TGNumberEntry * fNumFirstEntry
Definition: TGMsgBox.h:52
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition: TGButton.cxx:185
TGNumberEntry * fNumEntries
void Build(TSessionViewer *gui)
Build the "new query" dialog.
virtual void OnDoubleClick(TGLVEntry *, Int_t)
Handle double click in the File container.
TGTextButton * fBtnMore