CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWTableView.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWTableView
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Feb 21 11:22:41 EST 2008
11 // $Id: FWTableView.cc,v 1.30 2010/12/02 20:03:09 amraktad Exp $
12 //
13 
14 // system include files
15 #include <stdlib.h>
16 #include <algorithm>
17 #include <boost/shared_ptr.hpp>
18 #include <iostream>
19 #include <sstream>
20 #include <stdexcept>
21 
22 #include "TClass.h"
23 #include "TSystem.h"
24 #include "TGComboBox.h"
25 #include "TGLabel.h"
26 #include "TGTextEntry.h"
27 #include "TEveWindow.h"
28 
29 // user include files
43 
44 static const TString& coreIcondir()
45 {
46  static TString path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_BASE"));
47  if ( gSystem->AccessPathName(path.Data()) ){ // cannot find directory
48  assert(gSystem->Getenv("CMSSW_RELEASE_BASE"));
49  path = Form("%s/src/Fireworks/Core/icons/",gSystem->Getenv("CMSSW_RELEASE_BASE"));
50  }
51  return path;
52 }
53 
54 /*
55 static
56 const TGPicture* filtered(bool iBackgroundIsBlack)
57 {
58  if(iBackgroundIsBlack) {
59  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"filtered-blackbg.png");
60  return s;
61  }
62  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"filtered-whitebg.png");
63  return s;
64 
65 }
66 
67 static
68 const TGPicture* filtered_over(bool iBackgroundIsBlack)
69 {
70  if(iBackgroundIsBlack) {
71  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"filtered-whitebg-over.png");
72  return s;
73  }
74  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"filtered-whitebg-over.png");
75  return s;
76 }
77 */
78 /*
79 static
80 const TGPicture* alert_over()
81 {
82  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"alert-blackbg-over.png");
83  return s;
84 }
85 
86 static
87 const TGPicture* alert()
88 {
89  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"alert-blackbg.png");
90  return s;
91 }
92 */
93 
94 /*
95 static
96 const TGPicture* unfiltered(bool iBackgroundIsBlack)
97 {
98  if(iBackgroundIsBlack) {
99  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"unfiltered-blackbg.png");
100  return s;
101  }
102  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"unfiltered-whitebg.png");
103  return s;
104 }
105 static
106 const TGPicture* unfiltered_over(bool iBackgroundIsBlack)
107 {
108  if(iBackgroundIsBlack) {
109  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"unfiltered-blackbg-over.png");
110  return s;
111  }
112  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"unfiltered-whitebg-over.png");
113  return s;
114 }
115 
116 static
117 const TGPicture* info(bool iBackgroundIsBlack)
118 {
119  if(iBackgroundIsBlack) {
120  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"info2-blackbg.png");
121  return s;
122  }
123  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"info2-whitebg.png");
124  return s;
125 }
126 
127 static
128 const TGPicture* info_over(bool iBackgroundIsBlack)
129 {
130  if(iBackgroundIsBlack) {
131  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"info2-blackbg-over.png");
132  return s;
133  }
134  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"info2-whitebg-over.png");
135  return s;
136 }
137 
138 static
139 const TGPicture* info_disabled(bool iBackgroundIsBlack)
140 {
141  if(iBackgroundIsBlack) {
142  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"info2-blackbg-disabled.png");
143  return s;
144  }
145  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"info2-whitebg-disabled.png");
146  return s;
147 }
148 */
149 static
150 const TGPicture* arrow_right(bool iBackgroundIsBlack)
151 {
152  if(iBackgroundIsBlack) {
153  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-white-right-blackbg.png");
154  return s;
155  }
156  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-black-right-whitebg.png");
157  return s;
158 }
159 
160 static
161 const TGPicture* arrow_right_disabled(bool iBackgroundIsBlack)
162 {
163  if(iBackgroundIsBlack) {
164  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-white-right-disabled-blackbg.png");
165  return s;
166  }
167  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-black-right-disabled-whitebg.png");
168  return s;
169 }
170 
171 static
172 const TGPicture* arrow_down(bool iBackgroundIsBlack)
173 {
174  if(iBackgroundIsBlack) {
175  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-white-down-blackbg.png");
176  return s;
177  }
178  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-black-down-whitebg.png");
179  return s;
180 }
181 
182 static
183 const TGPicture* arrow_down_disabled(bool iBackgroundIsBlack)
184 {
185  if(iBackgroundIsBlack) {
186  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-white-down-disabled-blackbg.png");
187  return s;
188  }
189  static const TGPicture* s = gClient->GetPicture(coreIcondir()+"arrow-black-down-disabled-whitebg.png");
190  return s;
191 }
192 
193 //
194 // constants, enums and typedefs
195 //
196 static const std::string kTableView = "TableView";
197 static const std::string kCollection = "collection";
198 static const std::string kColumns = "columns";
199 static const std::string kSortColumn = "sortColumn";
200 static const std::string kDescendingSort = "descendingSort";
201 
202 //
203 // constructors and destructor
204 //
205 FWTableView::FWTableView (TEveWindowSlot* iParent, FWTableViewManager *manager)
206  : FWViewBase(FWViewType::kTable),
207  m_iColl(-1),
208  m_manager(manager),
209  m_tableManager(new FWTableViewTableManager(this)),
210  m_tableWidget(0),
211  m_showColumnUI(false),
212  m_validator(new FWExpressionValidator),
213  m_currentColumn(-1),
214  m_useColumnsFromConfig(false)
215 
216 {
217  m_eveWindow = iParent->MakeFrame(0);
218  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
219 // TGHorizontalFrame *buttons = new TGHorizontalFrame(frame);
220 // frame->AddFrame(buttons, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
221 
222 // m_collection = new TGComboBox(buttons);
223  m_vert = new TGVerticalFrame(frame);
224  frame->AddFrame(m_vert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
225  TGHorizontalFrame *header = new TGHorizontalFrame(m_vert);
226  m_vert->AddFrame(header, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
227  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
229  arrow_right(bgIsBlack),
230  arrow_right_disabled(bgIsBlack),
231  arrow_right_disabled(bgIsBlack));
232  m_columnUIButton->Connect("Clicked()", "FWTableView", this, "toggleShowHide()");
233  header->AddFrame(m_columnUIButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft,6,10));
234 
235  TGCompositeFrame *labfr = new TGHorizontalFrame(header, 60, 25, kFixedSize);
236  TGLabel *label = new TGLabel(labfr, "Collection");
237  labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1,3,0,0));
238  header->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
239 
240  m_collection = new TGComboBox(header);
241  updateItems();
242  header->AddFrame(m_collection, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
243  m_collection->Connect("Selected(Int_t)", "FWTableView", this, "selectCollection(Int_t)");
244  m_collection->Select(2, true);
245  m_column_control = new TGVerticalFrame(m_vert);
246  m_vert->AddFrame(m_column_control, new TGLayoutHints(kLHintsExpandX));
247  TGLabel *column_control_label = new TGLabel(m_column_control, "Column editor");
248 // column_control_label->SetBackgroundColor(bgIsBlack ? kBlack : kWhite);
249 // column_control_label->SetForegroundColor(bgIsBlack ? kWhite : kBlack);
250 // column_control_label->SetTextColor(bgIsBlack ? kWhite : kBlack);
251  m_column_control->AddFrame(column_control_label, new TGLayoutHints(kLHintsExpandX));
252  TGHorizontalFrame *column_control_fields = new TGHorizontalFrame(m_column_control);
253  m_column_control->AddFrame(column_control_fields, new TGLayoutHints(kLHintsExpandX));
254  m_column_name_field = new TGTextEntry(column_control_fields);
255  m_column_name_field->SetMaxWidth(10);
256  m_column_expr_field = new FWGUIValidatingTextEntry(column_control_fields);
257 // m_column_expr_field->SetEnabled(kFALSE);
259  m_column_prec_field = new TGTextEntry(column_control_fields);
260  m_column_prec_field->SetMaxWidth(10);
261  TGLabel *name_label = new TGLabel(column_control_fields, "Title");
262  TGLabel *expr_label = new TGLabel(column_control_fields, "Expression");
263  TGLabel *prec_label = new TGLabel(column_control_fields, "Precision");
264  column_control_fields->AddFrame(name_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
265  column_control_fields->AddFrame(m_column_name_field, new TGLayoutHints(kLHintsExpandX));
266  column_control_fields->AddFrame(expr_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
267  column_control_fields->AddFrame(m_column_expr_field, new TGLayoutHints(kLHintsExpandX));
268  column_control_fields->AddFrame(prec_label, new TGLayoutHints( kLHintsBottom, 1, 1, 2, 2));
269  column_control_fields->AddFrame(m_column_prec_field, new TGLayoutHints(kLHintsExpandX));
270  TGTextButton *add_button = new TGTextButton(column_control_fields, "Add");
271  TGTextButton *del_button = new TGTextButton(column_control_fields, "Delete");
272  TGTextButton *mod_button = new TGTextButton(column_control_fields, "Modify");
273  add_button->Connect("Clicked()", "FWTableView", this, "addColumn()");
274  del_button->Connect("Clicked()", "FWTableView", this, "deleteColumn()");
275  mod_button->Connect("Clicked()", "FWTableView", this, "modifyColumn()");
276  column_control_fields->AddFrame(add_button, new TGLayoutHints);
277  column_control_fields->AddFrame(del_button, new TGLayoutHints);
278  column_control_fields->AddFrame(mod_button, new TGLayoutHints);
281  m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(kWhite));
282  m_tableWidget->Connect("rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)", "FWTableView",
283  this, "modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
284  m_tableWidget->Connect("columnClicked(Int_t,Int_t,Int_t)", "FWTableView",
285  this, "columnSelected(Int_t,Int_t,Int_t)");
286  m_vert->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
287  frame->MapSubwindows();
288  m_vert->HideFrame(m_column_control);
289  frame->Layout();
290  frame->MapWindow();
291 }
292 
294 {
295  // take out composite frame and delete it directly ( without the timeout)
296  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
297  frame->RemoveFrame(m_vert);
298  delete m_vert;
299 
300  m_eveWindow->DestroyWindowAndSlot();
301  delete m_tableManager;
302  delete m_validator;
303 }
304 
305 void
307 {
308  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
309 // m_tableWidget->SetBackgroundColor(TColor::Number2Pixel(iColor));
310 // m_viewer->GetGLViewer()->SetClearColor(iColor);
311 }
312 
314 {
315  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(manager.background()));
316 // m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(manager.background()));
317 // switch (manager.foreground()) {
318 // case FWColorManager::kBlackIndex:
319 // m_tableWidget->SetHeaderForegroundColor(gVirtualX->GetPixel(kBlack));
320 // break;
321 // default:
322 // m_tableWidget->SetHeaderForegroundColor(0xffffff);
323 // break;
324 // }
325  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(manager.foreground()));
326 // m_tableWidget->dataChanged();
327 }
328 
329 //
330 // const member functions
331 //
332 
333 
334 void
336 {
337  // are we the first FWTableView to go into the configuration? If
338  // we are, then we are responsible for writing out the list of
339  // types (which we do by letting FWTableViewManager::addToImpl
340  // write into our configuration)
341  if (this == m_manager->m_views.front().get())
342  m_manager->addToImpl(iTo);
343  // then there is the stuff we have to do anyway: remember what
344  // collection we display
346  std::string collectionName;
347  if (m_manager->items()[m_iColl])
348  collectionName = m_manager->items()[m_iColl]->name();
349  else
350  collectionName = "NULL";
351 
352  FWConfiguration collection(collectionName);
353  main.addKeyValue(kCollection, collection);
355  main.addKeyValue(kSortColumn, sortColumn);
356  FWConfiguration descendingSort(m_tableWidget->descendingSort());
357  main.addKeyValue(kDescendingSort, descendingSort);
358 // FWConfiguration columns(1);
359 // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
360 // i = m_tableManager->m_tableFormats->begin(),
361 // iEnd = m_tableManager->m_tableFormats->end();
362 // i != iEnd; ++i) {
363 // columns.addValue(i->name);
364 // columns.addValue(i->expression);
365 // char prec[100];
366 // snprintf(prec, 100, "%d", i->precision);
367 // columns.addValue(prec);
368 // }
369 // main.addKeyValue(kColumns, columns);
370  iTo.addKeyValue(kTableView, main);
371  // take care of parameters
373 }
374 
375 void
377 {
378  if (this == m_manager->m_views.front().get())
379  m_manager->setFrom(iFrom);
380  try {
381  const FWConfiguration *main = iFrom.valueForKey(kTableView);
382  assert(main != 0);
383  // use the columns from the config, not the default columns for
384  // the collection type
385 // m_useColumnsFromConfig = true;
386 // m_tableManager->m_tableFormats->clear();
387 // const FWConfiguration *columns = main->valueForKey(kColumns);
388 // for (FWConfiguration::StringValuesIt it = columns->stringValues()->begin(),
389 // itEnd = columns->stringValues()->end(); it != itEnd; ++it) {
390 // const std::string &name = *it++;
391 // const std::string &expr = *it++;
392 // int prec = atoi(it->c_str());
393 // FWTableViewManager::TableEntry e = { expr, name, prec };
394 // m_tableManager->m_tableFormats->push_back(e);
395 // }
397  const std::string &collectionName = collection->value();
398  // find item
399  for (std::vector<const FWEventItem *>::const_iterator
400  it = m_manager->items().begin(),
401  itEnd = m_manager->items().end();
402  it != itEnd; ++it) {
403  if (*it && (*it)->name() == collectionName) {
404  m_collection->Select(it - m_manager->items().begin(), true);
405  break;
406  }
407  }
408  const FWConfiguration *sortColumn = main->valueForKey(kSortColumn);
409  const FWConfiguration *descendingSort = main->valueForKey(kDescendingSort);
410  if (sortColumn != 0 && descendingSort != 0) {
411  unsigned int sort = sortColumn->version();
412  bool descending = descendingSort->version();
413  if (sort < (( unsigned int) m_tableManager->numberOfColumns()))
414  m_tableWidget->sort(sort, descending);
415  }
416  } catch (...) {
417  // configuration doesn't contain info for the table. Be forgiving.
418  std::cerr << "This configuration file contains tables, but no column information. "
419  "(It is probably old.) Using defaults." << std::endl;
420  }
421 
422 // main.addKeyValue(kCollection, collection);
423 // FWConfiguration columns(1);
424 // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
425 // i = m_tableManager->m_tableFormats->begin(),
426 // iEnd = m_tableManager->m_tableFormats->end();
427 // i != iEnd; ++i) {
428 // columns.addValue(i->name);
429 // columns.addValue(i->expression);
430 // columns.addValue(Form("%d", i->precision));
431 // }
432 // main.addKeyValue(kColumns, columns);
433 // iTo.addKeyValue(kTableView, main);
434 // // take care of parameters
435 // FWConfigurableParameterizable::addTo(iTo);
436 
437  // take care of parameters
439 }
440 
441 void
442 FWTableView::saveImageTo(const std::string& iName) const
443 {
444 // bool succeeded = m_viewer->GetGLViewer()->SavePicture(iName.c_str());
445 // if(!succeeded) {
446 // throw std::runtime_error("Unable to save picture");
447 // }
448 }
449 
450 void
452 {
454  const TGPicture* picture = 0;
455  const TGPicture* down = 0;
456  const TGPicture* disabled = 0;
457  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
458  if (m_showColumnUI) {
459  picture = arrow_down(bgIsBlack);
460  down = arrow_down_disabled(bgIsBlack);
461  disabled = arrow_down_disabled(bgIsBlack);
462  m_vert->ShowFrame(m_column_control);
463  } else {
464  picture = arrow_right(bgIsBlack);
465  down = arrow_right_disabled(bgIsBlack);
466  disabled = arrow_right_disabled(bgIsBlack);
467  m_vert->HideFrame(m_column_control);
468  }
469  m_vert->Layout();
470  m_columnUIButton->swapIcons(picture,down,disabled);
471 }
472 
477 {
478  int selected = m_collection->GetSelected();
479  m_collection->RemoveAll();
480  int index = 0;
481 
482  for (size_t i = 0, e = m_manager->items().size(); i != e; ++i)
483  {
484  const FWEventItem *item = m_manager->items()[i];
485  if (item)
486  m_collection->AddEntry(item->name().c_str(), i);
487 
488  if (m_iColl == index && 0 == item)
489  {
490  //the collection we were showing is now gone
491  m_iColl = -1;
492  selected = -1;
493  }
494  }
495 
496  if (selected != -1 && selected < m_collection->GetNumberOfEntries())
497  m_collection->Select(selected, false);
498 
499  TGListBox *lb = m_collection->GetListBox();
500  lb->SetHeight(TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
501 }
502 
504 {
506 }
507 
509 {
510  if (m_iColl == -1)
511  return 0;
512  return m_manager->items()[m_iColl];
513 }
514 
516 {
517 // const FWEventItem *item = m_manager->items()[m_iColl];
520 // std::vector<FWExpressionEvaluator> &ev = m_evaluators;
521 // for (unsigned int i = 0; i < item->size(); ++i) {
522 // for (unsigned int j = 0; j < ev.size(); ++j) {
523 // printf("%s = %f\t", (*m_manager->tableFormats(item->modelType()->GetName())).second[j].name.c_str(),
524 // ev[j].evalExpression(item->modelData(i)));
525 // }
526 // printf("\n");
527 // }
528 // fflush(stdout);
529 }
530 
535 void
537 {
538 // printf("selected collection %d, ", i_coll);
539  const FWEventItem *item = m_manager->items()[i_coll];
540  assert(0!=item);
541 // printf("%s\n", item->modelType()->GetName());
542  m_iColl = i_coll;
543 // m_validator = new FWExpressionValidator;
544 // m_column_expr_field->setValidator(m_validator);
545  if (m_validator != 0) {
546 // std::cout << "setting validator to " << item->modelType()->GetName() << std::endl;
547  m_validator->setType(ROOT::Reflex::Type::ByTypeInfo(*(item->modelType()->GetTypeInfo())));
548  } else {
549 // std::cout << "can't set null validator\n";
550  }
551  if (not m_useColumnsFromConfig) {
552  if (m_manager->tableFormats(*item->modelType()) == m_manager->m_tableFormats.end()) {
553  fwLog(fwlog::kInfo) << "No table format for objects of this type " << item->modelType()->GetName() << std::endl;
554  m_tableManager->m_tableFormats->clear();
555  } else {
557  }
558  }
559 // columnSelected(-1, 1, 0);
561  dataChanged();
562 }
563 
564 void FWTableView::modelSelected(Int_t iRow,Int_t iButton,Int_t iKeyMod,Int_t iGlobalX,Int_t iGlobalY)
565 {
566  if(iKeyMod & kKeyControlMask) {
567  item()->toggleSelect(iRow);
568  } else {
569  FWChangeSentry sentry(*(item()->changeManager()));
571  item()->select(iRow);
572  }
573  if(iButton == kButton3) {
574  openSelectedModelContextMenu_(iGlobalX,iGlobalY);
575  }
576 }
577 
578 void FWTableView::columnSelected (Int_t iCol, Int_t iButton, Int_t iKeyMod)
579 {
580  if (iButton == 1 || iButton == 3)
581  m_currentColumn = iCol;
582  // update contents of the column editor
583  if (m_currentColumn >= 0 &&
587  m_column_name_field->SetText(entry.name.c_str());
588  m_column_expr_field->SetText(entry.expression.c_str());
589  m_column_prec_field->SetText(Form("%d", entry.precision));
590  } else {
591  m_column_name_field->SetText("");
592  m_column_expr_field->SetText("");
593  m_column_prec_field->SetText("");
594  }
595 }
596 
598 {
599  std::string name = m_column_name_field->GetText();
600  std::string expr = m_column_expr_field->GetText();
601  // convert the precision to a long int
602  char *endptr = 0;
603  int prec = (int) strtol(m_column_prec_field->GetText(), &endptr, 0);
604  if (name == "" || expr == "" ||
605  m_column_prec_field->GetText() == 0 || *endptr != 0) {
606  fwLog(fwlog::kInfo) << "bad input\n";
607  fflush(stdout);
608  return;
609  }
610  fwLog(fwlog::kInfo) << "adding column "<< name << ": " << expr << ", precision " << prec << std::endl;
611  fflush(stdout);
612 // m_manager->tableFormats(*item->modelType())
613  FWTableViewManager::TableEntry e = { expr, name, prec };
614  m_tableManager->m_tableFormats->push_back(e);
615  m_currentColumn = (int)m_tableManager->m_tableFormats->size() + 1;
616  // change needs to be propagated to all tables, because all
617  // tables displaying objects of this type are affected
618  // MT -- this is NOT true!!! FIX
621 }
622 
624 {
625  if (m_currentColumn >= 0 &&
629  m_column_name_field->SetText("");
630  m_column_expr_field->SetText("");
631  m_column_prec_field->SetText("");
632  m_currentColumn = -1;
633  }
634  // change needs to be propagated to all tables, because all
635  // tables displaying objects of this type are affected
636  // MT -- this is NOT true!!! FIX
639 }
640 
642 {
643  std::string name = m_column_name_field->GetText();
644  std::string expr = m_column_expr_field->GetText();
645  // convert the precision to a long int
646  char *endptr = 0;
647  int prec = (int) strtol(m_column_prec_field->GetText(), &endptr, 0);
648  if (name == "" || expr == "" ||
649  m_column_prec_field->GetText() == 0 || *endptr != 0) {
650  fwLog(fwlog::kInfo) << "bad input\n";
651  fflush(stdout);
652  return;
653  }
654  fwLog(fwlog::kInfo) << "modify column "<< name << ": " << expr << ", precision " << prec << std::endl;
655  fflush(stdout);
656 // m_manager->tableFormats(*item->modelType())
657  FWTableViewManager::TableEntry e = { expr, name, prec };
659  // change needs to be propagated to all tables, because all
660  // tables displaying objects of this type are affected
661  // MT -- this is NOT true!!! FIX
664 }
665 
static const std::string kDescendingSort
Definition: FWTableView.cc:200
int i
Definition: DBlmapReader.cc:9
void SetBackgroundColor(Pixel_t)
void addToImpl(FWConfiguration &) const
Color_t background() const
void updateEvaluators()
Definition: FWTableView.cc:503
FWTableViewManager * m_manager
Definition: FWTableView.h:91
void dataChanged()
Called if mouse button pressed in Row Header, defaults is to do nothing.
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:99
static const TGPicture * arrow_down(bool iBackgroundIsBlack)
Definition: FWTableView.cc:172
virtual ~FWTableView()
Definition: FWTableView.cc:293
const std::string & label
Definition: MVAComputer.cc:186
void columnSelected(Int_t iCol, Int_t iButton, Int_t iKeyMod)
Definition: FWTableView.cc:578
const std::string & name() const
Definition: FWEventItem.cc:500
void setFrom(const FWConfiguration &)
FWExpressionValidator * m_validator
Definition: FWTableView.h:98
void toggleShowHide()
Definition: FWTableView.cc:451
void addColumn()
Definition: FWTableView.cc:597
virtual void setFrom(const FWConfiguration &)
void selectCollection(Int_t)
Definition: FWTableView.cc:536
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
void SetHeaderBackgroundColor(Pixel_t)
unsigned int version() const
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void forceLayout()
Definition: FWTableWidget.h:84
FWColorManager & colorManager() const
virtual int numberOfColumns() const
Number of columns in the table.
TGTextEntry * m_column_name_field
Definition: FWTableView.h:96
void SetLineSeparatorColor(Pixel_t)
int main(int argc, char **argv)
int path() const
Definition: HLTadd.h:3
TGCompositeFrame * m_column_control
Definition: FWTableView.h:89
U second(std::pair< T, U > const &p)
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
Definition: FWTableView.cc:150
const Items & items() const
void sort(UInt_t iColumn, bool iDescendingSort)
void updateItems()
Definition: FWTableView.cc:476
static const std::string kSortColumn
Definition: FWTableView.cc:199
bool descendingSort() const
Definition: FWTableWidget.h:91
static const std::string kCollection
Definition: FWTableView.cc:197
const FWEventItem * item() const
Definition: FWTableView.cc:508
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
bool m_showColumnUI
Definition: FWTableView.h:94
static const TString & coreIcondir()
Definition: FWTableView.cc:44
void setValidator(FWValidatorBase *)
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
static const std::string kColumns
Definition: FWTableView.cc:198
void setBackgroundColor(Color_t)
Definition: FWTableView.cc:306
FWTableView(TEveWindowSlot *, FWTableViewManager *)
Definition: FWTableView.cc:205
void resetColors(const class FWColorManager &)
Definition: FWTableView.cc:313
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:161
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
void modelSelected(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
Definition: FWTableView.cc:564
static const std::string kTableView
Definition: FWTableView.cc:196
const std::string & value(unsigned int iIndex=0) const
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:133
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:274
virtual void setFrom(const FWConfiguration &)
Definition: FWTableView.cc:376
#define fwLog(_level_)
Definition: fwLog.h:51
TGCompositeFrame * m_vert
Definition: FWTableView.h:89
TEveWindowFrame * m_eveWindow
Definition: FWTableView.h:87
virtual void saveImageTo(const std::string &iName) const
Definition: FWTableView.cc:442
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:183
int sortedColumn() const
Definition: FWTableWidget.h:90
int m_currentColumn
Definition: FWTableView.h:100
Color_t foreground() const
bool m_useColumnsFromConfig
Definition: FWTableView.h:101
const TClass * modelType() const
Definition: FWEventItem.cc:561
virtual void addTo(FWConfiguration &) const
Definition: FWTableView.cc:335
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:97
void select(int iIndex) const
Definition: FWEventItem.cc:260
const FWConfiguration * valueForKey(const std::string &iKey) const
string s
Definition: asciidump.py:422
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
FWCustomIconsButton * m_columnUIButton
Definition: FWTableView.h:95
TGComboBox * m_collection
Definition: FWTableView.h:88
void dataChanged()
Definition: FWTableView.cc:515
TableSpecs::iterator tableFormats(const Reflex::Type &key)
void modifyColumn()
Definition: FWTableView.cc:641
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:57
void setType(const ROOT::Reflex::Type &)
void deleteColumn()
Definition: FWTableView.cc:623
virtual void addTo(FWConfiguration &) const