AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliStorageAdministratorPanelMarkEvent.cxx
Go to the documentation of this file.
2 #include "AliStorageTypes.h"
3 
4 #include <iostream>
5 
6 #include <TGFrame.h>
7 #include <TGButton.h>
8 
9 using namespace std;
10 
12 
14 
15 #define WINDOWS_WIDTH 200
16 #define WINDOWS_HEIGHT 200
17 
18 enum BUTTON{
21 };
22 
23 enum TEXTENTRY{
26 };
27 
29  TGMainFrame(gClient->GetRoot(), 400, 400),
30  fStatusLabel(0),
31  fRunNumberEntry(0),
32  fEventNumberEntry(0),
33  fServerSocket(SERVER_COMMUNICATION_REQ),
34  fEventManager(0)
35 {
37  InitWindow();
38 }
39 
41 {
42  cout<<"ADMIN PANEL -- Mark Window descructor called";
43  cout<<" --- OK"<<endl;
44 }
45 
47 {
49  return fInstance;
50 }
51 
53 {
54  SetCleanup(kDeepCleanup);
55 
56  AddFrame(new TGLabel(this,"Run number:"),new TGLayoutHints(kLHintsLeft));
57 
58  fRunNumberEntry = new TGNumberEntry(this,
59  0,
60  6,
62  TGNumberFormat::kNESInteger,
63  TGNumberFormat::kNEAPositive,
64  TGNumberFormat::kNELNoLimits);
65  AddFrame(fRunNumberEntry,new TGLayoutHints(kLHintsLeft));
66 
67  AddFrame(new TGLabel(this,"Event number:"),new TGLayoutHints(kLHintsLeft));
68 
69  fEventNumberEntry = new TGNumberEntry(this,
70  0,
71  6,
73  TGNumberFormat::kNESInteger,
74  TGNumberFormat::kNEAPositive,
75  TGNumberFormat::kNELNoLimits);
76  AddFrame(fEventNumberEntry,new TGLayoutHints(kLHintsLeft));
77 
78  fStatusLabel = new TGLabel(this,"");
79  AddFrame(fStatusLabel,new TGLayoutHints(kLHintsExpandX | kLHintsLeft));
80 
81  AddFrame(new TGTextButton(this,"Close",BUTTON_CLOSE),
82  new TGLayoutHints(kLHintsLeft));
83 
84  AddFrame(new TGTextButton(this,"Mark event",BUTTON_MARK),
85  new TGLayoutHints(kLHintsRight));
86 
87 
88  SetWindowName("Mark Event");
89  MapSubwindows();
91  MapWindow();
92 }
93 
94 
95 
96 
98 {
99  int runNumber;
100  int eventNumber;
101 
102  //get run and event number from TGNumberEntries
103  runNumber=fRunNumberEntry->GetIntNumber();
104  eventNumber=fEventNumberEntry->GetIntNumber();
105 
106  struct serverRequestStruct *requestMessage = new struct serverRequestStruct;
107 // struct eventStruct mark;
108  requestMessage->eventsRunNumber = runNumber;
109  requestMessage->eventsEventNumber = eventNumber;
110  requestMessage->messageType = REQUEST_MARK_EVENT;
111 // requestMessage->event = mark;
112 
113  fEventManager->Send(requestMessage,fServerSocket);
114  bool response;
115  fEventManager->Get(&response,fServerSocket);
116 
117  if(response)
118  {
119  fStatusLabel->SetText("Event marked");
120  cout<<"ADMIN PANEL -- Event marked succesfully"<<endl;
121  }
122  else
123  {
124  fStatusLabel->SetText("Couldn't mark this event");
125  cout<<"ADMIN PANEL -- Could not matk event"<<endl;
126  }
127 }
128 
131 
133 {
134  cout<<"Quiting mark event";
135  if(fInstance){delete fInstance;fInstance=0;}
136  cout<<" -- OK"<<endl;
137 }
138 
139 Bool_t AliStorageAdministratorPanelMarkEvent::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
140 {
141  switch (GET_MSG(msg))
142  {
143  case kC_COMMAND:
144  switch (GET_SUBMSG(msg))
145  {
146  case kCM_BUTTON:
147  switch(parm1)
148  {
149  case BUTTON_CLOSE:onCloseButton();break;
150  case BUTTON_MARK:onMarkButton();break;
151  default:break;
152  }
153  break;
154  default:break;
155  }
156  break;
157  default:break;
158  }
159 
160  return false;
161 }
static AliZMQManager * GetInstance()
static AliStorageAdministratorPanelMarkEvent * fInstance
bool Send(std::vector< serverListStruct > list, storageSockets socket)
ClassImp(AliStorageAdministratorPanelMarkEvent)
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)
static AliStorageAdministratorPanelMarkEvent * GetInstance()
bool Get(std::vector< serverListStruct > *&result, storageSockets socket)