1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-----------------------------------------------------------------
19 // AliLoginFrame class
20 // The class that deals with the login frame of the GUI
21 // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-----------------------------------------------------------------
25 #include "TGTextBuffer.h"
26 #include "TGTextEntry.h"
27 #include "TGridResult.h"
33 #include "AliAnalysisGUI.h"
34 #include "AliLoginFrame.h"
36 ClassImp(AliLoginFrame)
38 //___________________________________________________________________________
39 AliLoginFrame::AliLoginFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h, UInt_t options) : TGTransientFrame(p, main, w, h, options) {
42 SetWindowName("Login");
44 // create the Vertical Frame for the text fields and buttons
45 fVFrame1 = new TGVerticalFrame(this, 400, 150, kFixedWidth);
47 // create the Horizontal Frame 1
48 fHFrame1 = new TGHorizontalFrame(this, 400, 50, kFixedWidth);
50 fLabel1 = new TGLabel(fHFrame1, new TGString("Server"));
51 fTextServer = new TGTextEntry(fHFrame1, new TGTextBuffer(35));
52 fTextServer->SetText("alien://");
54 fHFrame1->AddFrame(fLabel1,
55 new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5));
56 fHFrame1->AddFrame(fTextServer,
57 new TGLayoutHints(kLHintsRight | kLHintsTop, 5, 5, 5, 5));
59 fVFrame1->AddFrame(fHFrame1,new TGLayoutHints(kLHintsTop));
61 // Create the Horizontal for the buttons
62 fHFrame3 = new TGHorizontalFrame(this, 400, 50, kFixedWidth);
64 fButtonLogIn = new TGTextButton(fHFrame3, "Log In", 1);
65 fButtonLogIn->Connect("Clicked()", "AliLoginFrame", this, "DoLogIn()");
67 fButtonCancel = new TGTextButton(fHFrame3, "Cancel", 2);
68 fButtonCancel->Connect("Clicked()", "AliLoginFrame", this, "DoCancel()");
70 fHFrame3->AddFrame(fButtonLogIn,new TGLayoutHints
71 (kLHintsCenterY | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2));
72 fHFrame3->AddFrame(fButtonCancel,new TGLayoutHints
73 (kLHintsCenterY | kLHintsRight | kLHintsExpandX, 2, 2, 2, 2));
77 fVFrame1->AddFrame(fHFrame3, new TGLayoutHints(kLHintsBottom));
79 AddFrame(fVFrame1, new TGLayoutHints(kLHintsTop));
86 //___________________________________________________________________________
87 AliLoginFrame::~AliLoginFrame() {
91 SetCleanup(kDeepCleanup);
94 //___________________________________________________________________________
95 void AliLoginFrame::DoLogIn() {
96 // When LogIn Button is pressed.
98 AliAnalysisGUI * fAnalysisGUI = dynamic_cast<AliAnalysisGUI*> (const_cast<TGWindow*> (GetMain()));
100 fAnalysisGUI->LogIn(fTextServer->GetText());
103 TGridResult* result = gGrid->Command("motd",kFALSE,0);
106 TString * msg = new TString();
107 while ((line=result->GetKey(i++,""))) {
111 new TGMsgBox(gClient->GetRoot(), this, "Welcome", msg->Data(), 0, kMBOk);
112 TTimer::SingleShot(1, "AliLoginFrame", this, "CloseWindow()");
116 //___________________________________________________________________________
117 void AliLoginFrame::DoCancel() {
118 // When Cancel button is pressed.
120 TTimer::SingleShot(150, "AliLoginFrame", this, "CloseWindow()");