00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ROOT_TSessionViewer
00022 #define ROOT_TSessionViewer
00023
00024 #ifndef ROOT_TGFrame
00025 #include "TGFrame.h"
00026 #endif
00027
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031
00032 #ifndef ROOT_TGTextEntry
00033 #include "TGTextEntry.h"
00034 #endif
00035
00036 #ifndef ROOT_TGNumberEntry
00037 #include "TGNumberEntry.h"
00038 #endif
00039
00040 #ifndef ROOT_TGTab
00041 #include "TGTab.h"
00042 #endif
00043
00044 #ifndef ROOT_TGListView
00045 #include "TGListView.h"
00046 #endif
00047
00048 #ifndef ROOT_TTime
00049 #include "TTime.h"
00050 #endif
00051
00052 #include <stdio.h>
00053 #include <time.h>
00054
00055 class TList;
00056 class TChain;
00057 class TDSet;
00058 class TGNumberEntry;
00059 class TGTextEntry;
00060 class TGTextButton;
00061 class TGCheckButton;
00062 class TGTextBuffer;
00063 class TGTableLayout;
00064 class TGIcon;
00065 class TGLabel;
00066 class TGHProgressBar;
00067 class TGPopupMenu;
00068 class TGLVContainer;
00069 class TGListView;
00070 class TGLVEntry;
00071 class TGCanvas;
00072 class TGListTree;
00073 class TGListTreeItem;
00074 class TGStatusBar;
00075 class TGPicture;
00076 class TGMenuBar;
00077 class TGPopupMenu;
00078 class TGToolBar;
00079 class TGTextView;
00080 class TGTab;
00081 class TRootEmbeddedCanvas;
00082 class TGListBox;
00083 class TCanvas;
00084 class TEnv;
00085 struct UserGroup_t;
00086
00087 class TProofMgr;
00088 class TProof;
00089 class TSessionViewer;
00090 class TSessionLogView;
00091 class TQueryResult;
00092 class TContextMenu;
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 class TQueryDescription : public TObject {
00105
00106 public:
00107 enum ESessionQueryStatus {
00108 kSessionQueryAborted = 0,
00109 kSessionQuerySubmitted,
00110 kSessionQueryRunning,
00111 kSessionQueryStopped,
00112 kSessionQueryCompleted,
00113 kSessionQueryFinalized,
00114 kSessionQueryCreated,
00115 kSessionQueryFromProof
00116 };
00117
00118 ESessionQueryStatus fStatus;
00119 TString fReference;
00120 TString fQueryName;
00121 TString fSelectorString;
00122 TString fTDSetString;
00123 TString fOptions;
00124 TString fEventList;
00125 Int_t fNbFiles;
00126 Long64_t fNoEntries;
00127 Long64_t fFirstEntry;
00128 TTime fStartTime;
00129 TTime fEndTime;
00130 TObject *fChain;
00131 TQueryResult *fResult;
00132
00133 const char *GetName() const { return fQueryName; }
00134
00135 ClassDef(TQueryDescription, 1)
00136 };
00137
00138
00139 enum EMenuIdentification {
00140 kMenuAddToFeedback,
00141 kMenuShow,
00142 kMenuRemoveFromFeedback
00143 };
00144
00145
00146
00147
00148
00149 class TSessionDescription : public TObject {
00150
00151 public:
00152 TString fTag;
00153 TString fName;
00154 TString fAddress;
00155 Int_t fPort;
00156 TString fConfigFile;
00157 Int_t fLogLevel;
00158 TString fUserName;
00159 Bool_t fConnected;
00160 Bool_t fAttached;
00161 Bool_t fLocal;
00162 Bool_t fSync;
00163 Bool_t fAutoEnable;
00164 TList *fQueries;
00165 TList *fPackages;
00166 TQueryDescription *fActQuery;
00167 TProof *fProof;
00168 TProofMgr *fProofMgr;
00169 Int_t fNbHistos;
00170
00171 const char *GetName() const { return fName; }
00172
00173 ClassDef(TSessionDescription, 1)
00174 };
00175
00176
00177
00178
00179
00180 class TPackageDescription : public TObject {
00181
00182 public:
00183 TString fName;
00184 TString fPathName;
00185 Int_t fId;
00186 Bool_t fUploaded;
00187 Bool_t fEnabled;
00188
00189 const char *GetName() const { return fName; }
00190
00191 ClassDef(TPackageDescription, 1)
00192 };
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 class TSessionServerFrame : public TGCompositeFrame {
00203
00204 private:
00205 TGCompositeFrame *fFrmNewServer;
00206 TGTextEntry *fTxtName;
00207 TGTextEntry *fTxtAddress;
00208 TGNumberEntry *fNumPort;
00209 TGNumberEntry *fLogLevel;
00210 TGTextEntry *fTxtConfig;
00211 TGTextEntry *fTxtUsrName;
00212 TGCheckButton *fSync;
00213 TSessionViewer *fViewer;
00214 TGTextButton *fBtnAdd;
00215 TGTextButton *fBtnConnect;
00216
00217 public:
00218 TSessionServerFrame(TGWindow *parent, Int_t w, Int_t h);
00219 virtual ~TSessionServerFrame();
00220
00221 void Build(TSessionViewer *gui);
00222
00223 const char *GetName() const { return fTxtName->GetText(); }
00224 const char *GetAddress() const { return fTxtAddress->GetText(); }
00225 Int_t GetPortNumber() const { return fNumPort->GetIntNumber(); }
00226 Int_t GetLogLevel() const { return fLogLevel->GetIntNumber(); }
00227 const char *GetConfigText() const { return fTxtConfig->GetText(); }
00228 const char *GetUserName() const { return fTxtUsrName->GetText(); }
00229 Bool_t IsSync() const { return (Bool_t)(fSync->GetState() == kButtonDown); }
00230
00231 void SetAddEnabled(Bool_t on = kTRUE) {
00232 on == kTRUE ? ShowFrame(fBtnAdd) : HideFrame(fBtnAdd); }
00233 void SetConnectEnabled(Bool_t on = kTRUE) {
00234 on == kTRUE ? ShowFrame(fBtnConnect) : HideFrame(fBtnConnect); }
00235 void SetName(const char *str) { fTxtName->SetText(str); }
00236 void SetAddress(const char *str) { fTxtAddress->SetText(str); }
00237 void SetPortNumber(Int_t port) { fNumPort->SetIntNumber(port); }
00238 void SetLogLevel(Int_t log) { fLogLevel->SetIntNumber(log); }
00239 void SetConfigText(const char *str) { fTxtConfig->SetText(str); }
00240 void SetUserName(const char *str) { fTxtUsrName->SetText(str); }
00241 void SetSync(Bool_t sync) {
00242 fSync->SetState(sync ? kButtonDown : kButtonUp); }
00243
00244 void SettingsChanged();
00245
00246 void OnBtnConnectClicked();
00247 void OnBtnNewServerClicked();
00248 void OnBtnDeleteClicked();
00249 void OnBtnAddClicked();
00250 void OnConfigFileClicked();
00251 void Update(TSessionDescription* desc);
00252 virtual Bool_t HandleExpose(Event_t *event);
00253 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00254
00255 ClassDef(TSessionServerFrame, 0)
00256 };
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268 class TSessionFrame : public TGCompositeFrame {
00269
00270 private:
00271
00272 TGTab *fTab;
00273 TGCompositeFrame *fFA, *fFB, *fFC;
00274 TGCompositeFrame *fFD, *fFE;
00275 TGTextEntry *fCommandTxt;
00276 TGTextBuffer *fCommandBuf;
00277 TGTextView *fInfoTextView;
00278 TGCheckButton *fClearCheck;
00279 TGTextButton *fBtnShowLog;
00280 TGTextButton *fBtnNewQuery;
00281 TGTextButton *fBtnGetQueries;
00282
00283 TGListBox *fLBPackages;
00284 TGTextButton *fBtnAdd;
00285 TGTextButton *fBtnRemove;
00286 TGTextButton *fBtnUp;
00287 TGTextButton *fBtnDown;
00288 TGTextButton *fBtnShow;
00289 TGTextButton *fBtnShowEnabled;
00290 TGCheckButton *fChkMulti;
00291 TGCheckButton *fChkEnable;
00292 TGTextButton *fBtnUpload;
00293 TGTextButton *fBtnEnable;
00294 TGTextButton *fBtnClear;
00295 TGTextButton *fBtnDisable;
00296
00297 TGCanvas *fDSetView;
00298 TGListTree *fDataSetTree;
00299 TGTextButton *fBtnUploadDSet;
00300 TGTextButton *fBtnRemoveDSet;
00301 TGTextButton *fBtnVerifyDSet;
00302 TGTextButton *fBtnRefresh;
00303
00304 TGTextEntry *fTxtParallel;
00305 TGNumberEntry *fLogLevel;
00306 TGTextButton *fApplyLogLevel;
00307 TGTextButton *fApplyParallel;
00308
00309 TSessionViewer *fViewer;
00310 TGLabel *fInfoLine[19];
00311
00312 public:
00313 TSessionFrame(TGWindow* parent, Int_t w, Int_t h);
00314 virtual ~TSessionFrame();
00315
00316 void Build(TSessionViewer *gui);
00317 void CheckAutoEnPack(Bool_t checked = kTRUE) {
00318 fChkEnable->SetState(checked ? kButtonDown : kButtonUp); }
00319 Int_t GetLogLevel() const { return fLogLevel->GetIntNumber(); }
00320 void SetLogLevel(Int_t log) { fLogLevel->SetIntNumber(log); }
00321 TGTab *GetTab() const { return fTab; }
00322
00323
00324 void OnApplyLogLevel();
00325 void OnApplyParallel();
00326 void OnBtnAddClicked();
00327 void OnBtnRemoveClicked();
00328 void OnBtnUpClicked();
00329 void OnBtnDownClicked();
00330 void OnBtnShowLogClicked();
00331 void OnBtnNewQueryClicked();
00332 void OnBtnGetQueriesClicked();
00333 void OnBtnDisconnectClicked();
00334 void OnCommandLine();
00335 void OnUploadPackages();
00336 void OnEnablePackages();
00337 void OnDisablePackages();
00338 void OnClearPackages();
00339 void OnMultipleSelection(Bool_t on);
00340 void OnStartupEnable(Bool_t on);
00341 void ProofInfos();
00342 void SetLocal(Bool_t local = kTRUE);
00343 void ShutdownSession();
00344 void UpdatePackages();
00345 void OnBtnUploadDSet();
00346 void OnBtnRemoveDSet();
00347 void OnBtnVerifyDSet();
00348 void UpdateListOfDataSets();
00349
00350 ClassDef(TSessionFrame, 0)
00351 };
00352
00353
00354
00355
00356
00357 class TEditQueryFrame : public TGCompositeFrame {
00358
00359 private:
00360 TGCompositeFrame *fFrmMore;
00361 TGTextButton *fBtnMore;
00362
00363 TGTextEntry *fTxtQueryName;
00364 TGTextEntry *fTxtChain;
00365 TGTextEntry *fTxtSelector;
00366 TGTextEntry *fTxtOptions;
00367 TGNumberEntry *fNumEntries;
00368 TGNumberEntry *fNumFirstEntry;
00369 TGTextEntry *fTxtParFile;
00370 TGTextEntry *fTxtEventList;
00371 TSessionViewer *fViewer;
00372 TQueryDescription *fQuery;
00373 TObject *fChain;
00374
00375 public:
00376 TEditQueryFrame(TGWindow* p, Int_t w, Int_t h);
00377 virtual ~TEditQueryFrame();
00378 void Build(TSessionViewer *gui);
00379 void OnNewQueryMore();
00380 void OnBrowseChain();
00381 void OnBrowseSelector();
00382 void OnBrowseEventList();
00383 void OnBtnSave();
00384 void OnElementSelected(TObject *obj);
00385 void SettingsChanged();
00386 void UpdateFields(TQueryDescription *desc);
00387
00388 ClassDef(TEditQueryFrame, 0)
00389 };
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399 class TSessionQueryFrame : public TGCompositeFrame {
00400
00401 private:
00402
00403 enum EQueryStatus { kRunning = 0, kDone, kStopped, kAborted };
00404
00405 TGTextButton *fBtnSubmit;
00406 TGTextButton *fBtnFinalize;
00407 TGTextButton *fBtnStop;
00408 TGTextButton *fBtnAbort;
00409 TGTextButton *fBtnShowLog;
00410 TGTextButton *fBtnRetrieve;
00411 TGTextButton *fBtnSave;
00412 TGTextView *fInfoTextView;
00413
00414 Bool_t fModified;
00415 Int_t fFiles;
00416 Long64_t fFirst;
00417 Long64_t fEntries;
00418 Long64_t fPrevTotal;
00419 Long64_t fPrevProcessed;
00420 TGLabel *fLabInfos;
00421 TGLabel *fLabStatus;
00422 TGLabel *fTotal;
00423 TGLabel *fRate;
00424 EQueryStatus fStatus;
00425 TGTab *fTab;
00426 TGCompositeFrame *fFA, *fFB, *fFC;
00427 TEditQueryFrame *fFD;
00428 TGHProgressBar *frmProg;
00429 TRootEmbeddedCanvas *fECanvas;
00430 TCanvas *fStatsCanvas;
00431 TSessionViewer *fViewer;
00432 TQueryDescription *fDesc;
00433
00434 public:
00435 TSessionQueryFrame(TGWindow* parent, Int_t w, Int_t h);
00436 virtual ~TSessionQueryFrame();
00437
00438 void Build(TSessionViewer *gui);
00439
00440 TCanvas *GetStatsCanvas() const { return fStatsCanvas; }
00441 TEditQueryFrame *GetQueryEditFrame() const { return fFD; }
00442 TGTab *GetTab() const { return fTab; }
00443
00444 void Feedback(TList *objs);
00445 void Modified(Bool_t mod = kTRUE);
00446 void Progress(Long64_t total, Long64_t processed);
00447 void Progress(Long64_t total, Long64_t processed,
00448 Long64_t bytesread, Float_t initTime,
00449 Float_t procTime, Float_t evtrti,
00450 Float_t mbrti);
00451 void ProgressLocal(Long64_t total, Long64_t processed);
00452 void IndicateStop(Bool_t aborted);
00453 void ResetProgressDialog(const char *selec, Int_t files, Long64_t first, Long64_t entries);
00454
00455
00456 void OnBtnSubmit();
00457 void OnBtnFinalize();
00458 void OnBtnStop();
00459 void OnBtnAbort();
00460 void OnBtnShowLog();
00461 void OnBtnRetrieve();
00462 void UpdateInfos();
00463 void UpdateButtons(TQueryDescription *desc);
00464 void UpdateHistos(TList *objs);
00465
00466 ClassDef(TSessionQueryFrame, 0)
00467 };
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477 class TSessionOutputFrame : public TGCompositeFrame {
00478
00479 private:
00480 TGLVEntry *fEntryTmp;
00481 TGLVContainer *fLVContainer;
00482 TSessionViewer *fViewer;
00483
00484 public:
00485 TSessionOutputFrame(TGWindow* parent, Int_t w, Int_t h);
00486 virtual ~TSessionOutputFrame();
00487
00488 void AddObject(TObject *obj);
00489 void Build(TSessionViewer *gui);
00490 TGLVContainer *GetLVContainer() { return fLVContainer; }
00491 void OnElementClicked(TGLVEntry* entry, Int_t btn, Int_t x, Int_t y);
00492 void OnElementDblClicked(TGLVEntry *entry ,Int_t btn, Int_t x, Int_t y);
00493 void RemoveAll() { fLVContainer->RemoveAll(); }
00494
00495 ClassDef(TSessionOutputFrame, 0)
00496 };
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506 class TSessionInputFrame : public TGCompositeFrame {
00507
00508 private:
00509 TSessionViewer *fViewer;
00510 TGLVContainer *fLVContainer;
00511
00512 public:
00513 TSessionInputFrame(TGWindow* parent, Int_t w, Int_t h);
00514 virtual ~TSessionInputFrame();
00515
00516 void AddObject(TObject *obj);
00517 void Build(TSessionViewer *gui);
00518 void RemoveAll() { fLVContainer->RemoveAll(); }
00519 TGLVContainer *GetLVContainer() { return fLVContainer; }
00520
00521 ClassDef(TSessionInputFrame, 0)
00522 };
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533 class TSessionViewer : public TGMainFrame {
00534
00535 private:
00536 time_t fStart, fElapsed;
00537 Bool_t fChangePic;
00538 Bool_t fBusy;
00539 TGHorizontalFrame *fHf;
00540 TGVerticalFrame *fV1;
00541 TGVerticalFrame *fV2;
00542 TSessionServerFrame *fServerFrame;
00543 TSessionFrame *fSessionFrame;
00544 TSessionQueryFrame *fQueryFrame;
00545 TSessionOutputFrame *fOutputFrame;
00546 TSessionInputFrame *fInputFrame;
00547 TSessionLogView *fLogWindow;
00548 TSessionDescription *fActDesc;
00549 TList *fSessions;
00550 const TGPicture *fLocal;
00551 const TGPicture *fProofCon;
00552 const TGPicture *fProofDiscon;
00553 const TGPicture *fQueryCon;
00554 const TGPicture *fQueryDiscon;
00555 const TGPicture *fBaseIcon;
00556
00557 TGFrame *fActFrame;
00558 TGToolBar *fToolBar;
00559 TGMenuBar *fMenuBar;
00560 TGPopupMenu *fFileMenu;
00561 TGPopupMenu *fSessionMenu;
00562 TGPopupMenu *fQueryMenu;
00563 TGPopupMenu *fOptionsMenu;
00564 TGPopupMenu *fCascadeMenu;
00565 TGPopupMenu *fHelpMenu;
00566
00567 TGPopupMenu *fPopupSrv;
00568 TGPopupMenu *fPopupQry;
00569 TContextMenu *fContextMenu;
00570
00571 TGHProgressBar *fConnectProg;
00572 TGCanvas *fTreeView;
00573 TGListTree *fSessionHierarchy;
00574 TGListTreeItem *fSessionItem;
00575 TGStatusBar *fStatusBar;
00576 TGPicture *fRightIconPicture;
00577 TGIcon *fRightIcon;
00578 TTimer *fTimer;
00579 UserGroup_t *fUserGroup;
00580 Bool_t fAutoSave;
00581 TString fConfigFile;
00582 TEnv *fViewerEnv;
00583
00584 public:
00585
00586 TSessionViewer(const char *title = "ROOT Session Viewer", UInt_t w = 550, UInt_t h = 320);
00587 TSessionViewer(const char *title, Int_t x, Int_t y, UInt_t w, UInt_t h);
00588 virtual ~TSessionViewer();
00589 virtual void Build();
00590 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t);
00591
00592 TSessionServerFrame *GetServerFrame() const { return fServerFrame; }
00593 TSessionFrame *GetSessionFrame() const { return fSessionFrame; }
00594 TSessionQueryFrame *GetQueryFrame() const { return fQueryFrame; }
00595 TSessionOutputFrame *GetOutputFrame() const { return fOutputFrame; }
00596 TSessionInputFrame *GetInputFrame() const { return fInputFrame; }
00597 TSessionDescription *GetActDesc() const { return fActDesc; }
00598 TList *GetSessions() const { return fSessions; }
00599 TGListTree *GetSessionHierarchy() const { return fSessionHierarchy; }
00600 TGListTreeItem *GetSessionItem() const { return fSessionItem; }
00601 const TGPicture *GetLocalPict() const { return fLocal; }
00602 const TGPicture *GetProofConPict() const { return fProofCon; }
00603 const TGPicture *GetProofDisconPict() const { return fProofDiscon; }
00604 const TGPicture *GetQueryConPict() const { return fQueryCon; }
00605 const TGPicture *GetQueryDisconPict() const { return fQueryDiscon; }
00606 const TGPicture *GetBasePict() const { return fBaseIcon; }
00607 TGPopupMenu *GetPopupSrv() const { return fPopupSrv; }
00608 TGPopupMenu *GetPopupQry() const { return fPopupQry; }
00609 TContextMenu *GetContextMenu() const { return fContextMenu; }
00610 TGStatusBar *GetStatusBar() const { return fStatusBar; }
00611 TGHProgressBar *GetConnectProg() const { return fConnectProg; }
00612 TGPopupMenu *GetCascadeMenu() const { return fCascadeMenu; }
00613 TGPopupMenu *GetOptionsMenu() const { return fOptionsMenu; }
00614
00615 void ChangeRightLogo(const char *name);
00616 void CleanupSession();
00617 void CloseWindow();
00618 void DisableTimer();
00619 void EditQuery();
00620 void EnableTimer();
00621 Bool_t HandleTimer(TTimer *);
00622 Bool_t IsBusy() const { return fBusy; }
00623 Bool_t IsAutoSave() const { return fAutoSave; }
00624 void LogMessage(const char *msg, Bool_t all);
00625 void MyHandleMenu(Int_t);
00626 void OnCascadeMenu();
00627 void OnListTreeClicked(TGListTreeItem *entry, Int_t btn, Int_t x, Int_t y);
00628 void OnListTreeDoubleClicked(TGListTreeItem *entry, Int_t btn);
00629 void QueryResultReady(char *query);
00630 void DeleteQuery();
00631 void ReadConfiguration(const char *filename = 0);
00632 void ResetSession();
00633 void UpdateListOfProofs();
00634 void UpdateListOfSessions();
00635 void UpdateListOfPackages();
00636 void WriteConfiguration(const char *filename = 0);
00637 void SetBusy(Bool_t busy = kTRUE) { fBusy = busy; }
00638 void SetChangePic(Bool_t change) { fChangePic = change;}
00639 void SetLogWindow(TSessionLogView *log) { fLogWindow = log; }
00640 void ShowEnabledPackages();
00641 void ShowPackages();
00642 void ShowInfo(const char *txt);
00643 void ShowLog(const char *queryref);
00644 void ShowStatus();
00645 void StartupMessage(char *msg, Bool_t stat, Int_t curr, Int_t total);
00646 void StartViewer();
00647 void Terminate();
00648
00649 ClassDef(TSessionViewer, 0)
00650 };
00651
00652 R__EXTERN TSessionViewer *gSessionViewer;
00653
00654 #endif