CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWGUIEventDataAdder Class Reference

#include <Fireworks/Core/interface/FWGUIEventDataAdder.h>

Public Member Functions

void addNewItem ()
 
void addNewItemAndClose ()
 
 FWGUIEventDataAdder (UInt_t w, UInt_t, FWEventItemsManager *, TGFrame *, FWJobMetadataManager *)
 
void metadataUpdatedSlot (void)
 
void resetNameEntry ()
 
void rowClicked (Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
 
void show ()
 
void updateFilterString (const char *str)
 
void windowIsClosing ()
 
virtual ~FWGUIEventDataAdder ()
 

Private Member Functions

void createWindow ()
 
 FWGUIEventDataAdder (const FWGUIEventDataAdder &)=delete
 
void newIndexSelected (int)
 
const FWGUIEventDataAdderoperator= (const FWGUIEventDataAdder &)=delete
 

Private Attributes

TGTextButton * m_apply
 
TGTextButton * m_applyAndClose
 
TGCheckButton * m_doNotUseProcessName
 
std::string m_expr
 
TGTransientFrame * m_frame
 
FWEventItemsManagerm_manager
 
FWJobMetadataManagerm_metadataManager
 
std::string m_moduleLabel
 
TGTextEntry * m_name
 
TGFrame * m_parentFrame
 
std::string m_processName
 
std::string m_productInstanceLabel
 
std::string m_purpose
 
TGTextEntry * m_search
 
DataAdderTableManagerm_tableManager
 
FWTableWidgetm_tableWidget
 
std::string m_type
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 41 of file FWGUIEventDataAdder.h.

Constructor & Destructor Documentation

FWGUIEventDataAdder::FWGUIEventDataAdder ( UInt_t  w,
UInt_t  iHeight,
FWEventItemsManager iManager,
TGFrame *  iParent,
FWJobMetadataManager iMetadataManager 
)

Definition at line 351 of file FWGUIEventDataAdder.cc.

References createWindow(), m_metadataManager, FWJobMetadataManager::metadataChanged_, and metadataUpdatedSlot().

356  :
357  m_manager(iManager),
358  m_metadataManager(iMetadataManager),
359  m_parentFrame(iParent)
360 {
362  createWindow();
363 }
FWEventItemsManager * m_manager
sigc::signal< void > metadataChanged_
FWJobMetadataManager * m_metadataManager
FWGUIEventDataAdder::~FWGUIEventDataAdder ( )
virtual

Definition at line 370 of file FWGUIEventDataAdder.cc.

371 {
372  /*
373  // m_frame->Cleanup();
374  // delete m_frame;
375  m_frame=0;
376  // delete m_tableWidget;
377  m_tableWidget=0;
378  delete m_tableManager;
379  m_tableManager=0;
380  */
381 }
FWGUIEventDataAdder::FWGUIEventDataAdder ( const FWGUIEventDataAdder )
privatedelete

Member Function Documentation

void FWGUIEventDataAdder::addNewItem ( )

Definition at line 399 of file FWGUIEventDataAdder.cc.

References FWEventItemsManager::add(), FWEventItemsManager::begin(), FWDisplayProperties::defaultProperties, FWEventItemsManager::end(), FWEventItemsManager::find(), fwLog, fwlog::kWarning, m_doNotUseProcessName, m_frame, m_manager, m_moduleLabel, m_name, m_processName, m_productInstanceLabel, m_purpose, m_type, mps_check::msg, dataset::name, modifiedElectrons_cfi::processName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by addNewItemAndClose().

400 {
401  TClass* theClass = TClass::GetClass(m_type.c_str());
402  if(nullptr==theClass) {
403  return;
404  }
405  const std::string moduleLabel = m_moduleLabel;
406  if(moduleLabel.empty()) {
407  return;
408  }
409 
410  const std::string name = m_name->GetText();
411  if(name.empty()) {
412  return;
413  }
414 
415  if ( m_manager->find( name ) ) {
416  TString msg("Event item '");
417  msg += name;
418  msg += "' is already registered. Please use another name.";
419  fwLog(fwlog::kWarning) << msg.Data() << std::endl;
420  new TGMsgBox(gClient->GetDefaultRoot(), m_frame,
421  "Error - Name conflict", msg, kMBIconExclamation, kMBOk);
422  return;
423  }
424 
425  int largest = -1;
426  if(m_manager->begin() != m_manager->end()) {
427  if ( *(m_manager->begin()) )
428  largest = (*(m_manager->begin()))->layer();
429  }
431  itEnd = m_manager->end();
432  it!=itEnd;
433  ++it) {
434  if((*it) && largest < (*it)->layer()) {
435  largest = (*it)->layer();
436  }
437  }
438  ++largest;
440  if(m_doNotUseProcessName->IsOn() && m_doNotUseProcessName->IsEnabled()) {
441  processName="";
442  }
443  FWPhysicsObjectDesc desc(name, theClass, m_purpose,
445  moduleLabel,
447  processName,
448  "",
449  largest);
450  m_manager->add(desc);
451 }
FWEventItemsManager * m_manager
static const FWDisplayProperties defaultProperties
std::string m_productInstanceLabel
FWEventItem * add(const FWPhysicsObjectDesc &iItem, const FWConfiguration *pbConf=nullptr, bool doSetEvent=true)
TGCheckButton * m_doNotUseProcessName
TGTransientFrame * m_frame
const FWEventItem * find(const std::string &iName) const
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
#define fwLog(_level_)
Definition: fwLog.h:50
tuple msg
Definition: mps_check.py:285
std::vector< FWEventItem * >::const_iterator const_iterator
const_iterator end() const
void FWGUIEventDataAdder::addNewItemAndClose ( )

Definition at line 454 of file FWGUIEventDataAdder.cc.

References addNewItem(), and windowIsClosing().

455 {
456  addNewItem();
457  windowIsClosing();
458 }
void FWGUIEventDataAdder::createWindow ( )
private

Definition at line 495 of file FWGUIEventDataAdder.cc.

References FWDialogBuilder::addCheckbox(), FWDialogBuilder::addLabel(), FWDialogBuilder::addTable(), FWDialogBuilder::addTextButton(), FWDialogBuilder::addTextEntry(), FWTableWidget::disableGrowInWidth(), FWDialogBuilder::expand(), FWDialogBuilder::floatLeft(), FWDialogBuilder::frameSpaceDown(), FWDialogBuilder::frameSpaceUpDown(), FWDialogBuilder::hSpacer(), FWDialogBuilder::indent(), DataAdderTableManager::indexSelected_, m_apply, m_applyAndClose, m_doNotUseProcessName, m_frame, m_metadataManager, m_name, m_parentFrame, m_search, m_tableManager, m_tableWidget, newIndexSelected(), FWTableWidget::SetBackgroundColor(), FWTableWidget::SetHeaderBackgroundColor(), FWTableWidget::SetLineSeparatorColor(), FWDialogBuilder::spaceDown(), FWDialogBuilder::spaceRight(), and FWDialogBuilder::spaceUp().

Referenced by FWGUIEventDataAdder(), and show().

496 {
499 
500  m_frame = new TGTransientFrame(gClient->GetDefaultRoot(),m_parentFrame,600,400);
501  m_frame->Connect("CloseWindow()","FWGUIEventDataAdder",this,"windowIsClosing()");
502 
503  FWDialogBuilder builder(m_frame);
504  TGTextButton *cancelButton, *resetButton;
505 
506  builder.indent(10)
507  .spaceDown(15)
508  .addLabel("Search:", 0).expand(false).spaceUp(4).floatLeft(4)
509  .addTextEntry("", &m_search).spaceUp(0)
510  .frameSpaceDown(10)
511  .addLabel("Viewable Collections", 8)
512  .frameSpaceDown(5)
513  .addTable(m_tableManager, &m_tableWidget).expand(true, true)
514  .addLabel("Name:", 0).expand(false).spaceUp(4).floatLeft(4)
515  .addTextEntry("", &m_name).spaceUp(0).floatLeft(4)
516  .addTextButton(" Reset ", &resetButton).expand(false, false)
517  .frameSpaceUpDown(5)
518  .addCheckbox("Do not use Process Name and "
519  "instead only get this data "
520  "from the most recent Process",
522  .frameSpaceDown(15)
523  .hSpacer().floatLeft(0)
524  .addTextButton(" Close ", &cancelButton).expand(false).floatLeft(4)
525  .addTextButton(" Add Data ", &m_apply).expand(false).floatLeft(4)
526  .addTextButton(" Add Data && Close ", &m_applyAndClose).expand(false)
527  .spaceRight(25).spaceDown(15);
528 
529  m_search->Connect("TextChanged(const char *)", "FWGUIEventDataAdder",
530  this, "updateFilterString(const char *)");
531  m_search->SetEnabled(true);
535  m_tableWidget->Connect("rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
536  "FWGUIEventDataAdder",this,
537  "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)");
538 
540  m_name->SetState(true);
541  resetButton->SetEnabled(true);
542  resetButton->Connect("Clicked()", "FWGUIEventDataAdder", this, "resetNameEntry()");
543  m_doNotUseProcessName->SetState(kButtonDown);
544  cancelButton->Connect("Clicked()","FWGUIEventDataAdder", this, "windowIsClosing()");
545  cancelButton->SetEnabled(true);
546  m_apply->Connect("Clicked()", "FWGUIEventDataAdder", this, "addNewItem()");
547  m_applyAndClose->Connect("Clicked()", "FWGUIEventDataAdder", this, "addNewItemAndClose()");
548 
549  m_frame->SetWindowName("Add Collection");
550  m_frame->MapSubwindows();
551  m_frame->Layout();
552 }
TGTextButton * m_applyAndClose
void SetHeaderBackgroundColor(Pixel_t)
void SetLineSeparatorColor(Pixel_t)
FWJobMetadataManager * m_metadataManager
void disableGrowInWidth()
TGCheckButton * m_doNotUseProcessName
TGTransientFrame * m_frame
void SetBackgroundColor(Pixel_t) override
sigc::signal< void, int > indexSelected_
FWTableWidget * m_tableWidget
DataAdderTableManager * m_tableManager
void FWGUIEventDataAdder::metadataUpdatedSlot ( void  )

Slot for the metadataChanged signal of the FWJobMetadataManager. Whenever metadata changes, for whatever reason (e.g. a new file), we need to update the table.

Definition at line 559 of file FWGUIEventDataAdder.cc.

References m_tableManager, DataAdderTableManager::reset(), and FWTableManagerBase::sort().

Referenced by FWGUIEventDataAdder().

560 {
562  m_tableManager->sort(0, true);
563 }
void sort(int iCol, bool iSortOrder)
Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder...
DataAdderTableManager * m_tableManager
void FWGUIEventDataAdder::newIndexSelected ( int  iSelectedIndex)
private

Definition at line 572 of file FWGUIEventDataAdder.cc.

References m_apply, m_applyAndClose, m_doNotUseProcessName, m_metadataManager, m_moduleLabel, m_name, m_processName, m_productInstanceLabel, m_purpose, m_type, modifiedElectrons_cfi::processName, FWJobMetadataManager::processNamesInJob(), AlCaHLTBitMon_QueryRunRegistry::string, and FWJobMetadataManager::usableData().

Referenced by createWindow().

573 {
574  if(-1 != iSelectedIndex) {
575  std::vector<FWJobMetadataManager::Data> &metadata = m_metadataManager->usableData();
576  m_purpose = metadata[iSelectedIndex].purpose_;
577  m_type = metadata[iSelectedIndex].type_;
578  std::string oldModuleLabel = m_moduleLabel;
579  m_moduleLabel = metadata[iSelectedIndex].moduleLabel_;
580  m_productInstanceLabel = metadata[iSelectedIndex].productInstanceLabel_;
581  m_processName = metadata[iSelectedIndex].processName_;
582 
583  if(strlen(m_name->GetText())==0 || oldModuleLabel == m_name->GetText()) {
584  m_name->SetText(m_moduleLabel.c_str());
585  }
586  m_apply->SetEnabled(true);
587  m_applyAndClose->SetEnabled(true);
588 
589  //Check to see if this is the last process, if it is then we can let the user decide
590  // to not use the process name when doing the lookup. This makes a saved configuration
591  // more robust. However, if they choose a collection not from the last process then we need the
592  // process name in order to correctly get the data they want
593  bool isMostRecentProcess =true;
594  int index = 0;
595  for(std::vector<FWJobMetadataManager::Data>::iterator it = metadata.begin(), itEnd = metadata.end();
596  it != itEnd && isMostRecentProcess;
597  ++it,++index) {
598  if(index == iSelectedIndex) {continue;}
599  if(it->moduleLabel_ == m_moduleLabel &&
600  it->purpose_ == m_purpose &&
601  it->type_ == m_type &&
602  it->productInstanceLabel_ == m_productInstanceLabel) {
603  //see if this process is newer than the data requested
604 
605  for(size_t pni = 0, pne = m_metadataManager->processNamesInJob().size();
606  pni != pne; ++pni)
607  {
609  if (m_processName == processName)
610  break;
611 
612  if(it->processName_ == processName)
613  {
614  isMostRecentProcess = false;
615  break;
616  }
617  }
618  }
619  }
620  if(isMostRecentProcess) {
621  if(!m_doNotUseProcessName->IsEnabled()) {
622  m_doNotUseProcessName->SetEnabled(true);
623  }
624  } else {
625  //NOTE: must remember state before we get here because 'enable' and 'on' are mutually
626  // exlcusive :(
627  m_doNotUseProcessName->SetEnabled(false);
628  }
629  }
630 }
TGTextButton * m_applyAndClose
std::vector< std::string > & processNamesInJob()
FWJobMetadataManager * m_metadataManager
std::string m_productInstanceLabel
std::vector< Data > & usableData()
TGCheckButton * m_doNotUseProcessName
const FWGUIEventDataAdder& FWGUIEventDataAdder::operator= ( const FWGUIEventDataAdder )
privatedelete
void FWGUIEventDataAdder::resetNameEntry ( )

Definition at line 566 of file FWGUIEventDataAdder.cc.

References m_apply, m_moduleLabel, and m_name.

567 {
568  m_name->SetText(m_apply->IsEnabled() ? m_moduleLabel.c_str() : "", kFALSE);
569 }
void FWGUIEventDataAdder::rowClicked ( Int_t  iRow,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  ,
Int_t   
)

Definition at line 633 of file FWGUIEventDataAdder.cc.

References m_tableManager, and DataAdderTableManager::setSelection().

634 {
635  if(iButton==kButton1) {
636  m_tableManager->setSelection(iRow,iKeyMod);
637  }
638 }
void setSelection(int row, int mask)
DataAdderTableManager * m_tableManager
void FWGUIEventDataAdder::show ( )

Definition at line 461 of file FWGUIEventDataAdder.cc.

References createWindow(), and m_frame.

Referenced by FWGUIManager::addData(), Vispa.Main.AboutDialog.AboutDialog::onScreen(), Vispa.Gui.BoxContentDialog.BoxContentDialog::onScreen(), and Vispa.Gui.FindDialog.FindDialog::onScreen().

462 {
463  // Map main frame
464  if(nullptr==m_frame) {
465  createWindow();
466  }
467  m_frame->MapWindow();
468 }
TGTransientFrame * m_frame
void FWGUIEventDataAdder::updateFilterString ( const char *  str)

Definition at line 488 of file FWGUIEventDataAdder.cc.

References FWTableManagerBase::dataChanged(), m_tableManager, and DataAdderTableManager::sortWithFilter().

489 {
492 }
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
virtual void sortWithFilter(const char *filter)
DataAdderTableManager * m_tableManager
#define str(s)
void FWGUIEventDataAdder::windowIsClosing ( )

Definition at line 471 of file FWGUIEventDataAdder.cc.

References m_apply, m_applyAndClose, m_frame, m_moduleLabel, m_name, m_processName, m_productInstanceLabel, m_purpose, m_search, and m_type.

Referenced by addNewItemAndClose().

472 {
473  m_name->SetText("");
474  m_search->SetText("");
475  m_purpose.clear();
476  m_type.clear();
477  m_moduleLabel.clear();
478  m_processName.clear();
479  m_productInstanceLabel.clear();
480  m_apply->SetEnabled(false);
481  m_applyAndClose->SetEnabled(false);
482 
483  m_frame->UnmapWindow();
484  m_frame->DontCallClose();
485 }
TGTextButton * m_applyAndClose
std::string m_productInstanceLabel
TGTransientFrame * m_frame

Member Data Documentation

TGTextButton* FWGUIEventDataAdder::m_apply
private
TGTextButton* FWGUIEventDataAdder::m_applyAndClose
private

Definition at line 84 of file FWGUIEventDataAdder.h.

Referenced by createWindow(), newIndexSelected(), and windowIsClosing().

TGCheckButton* FWGUIEventDataAdder::m_doNotUseProcessName
private

Definition at line 82 of file FWGUIEventDataAdder.h.

Referenced by addNewItem(), createWindow(), and newIndexSelected().

std::string FWGUIEventDataAdder::m_expr
private

Definition at line 94 of file FWGUIEventDataAdder.h.

TGTransientFrame* FWGUIEventDataAdder::m_frame
private

Definition at line 80 of file FWGUIEventDataAdder.h.

Referenced by addNewItem(), createWindow(), show(), and windowIsClosing().

FWEventItemsManager* FWGUIEventDataAdder::m_manager
private

Definition at line 76 of file FWGUIEventDataAdder.h.

Referenced by addNewItem().

FWJobMetadataManager* FWGUIEventDataAdder::m_metadataManager
private

Definition at line 77 of file FWGUIEventDataAdder.h.

Referenced by createWindow(), FWGUIEventDataAdder(), and newIndexSelected().

std::string FWGUIEventDataAdder::m_moduleLabel
private
TGTextEntry* FWGUIEventDataAdder::m_name
private
TGFrame* FWGUIEventDataAdder::m_parentFrame
private

Definition at line 79 of file FWGUIEventDataAdder.h.

Referenced by createWindow().

std::string FWGUIEventDataAdder::m_processName
private

Definition at line 92 of file FWGUIEventDataAdder.h.

Referenced by addNewItem(), newIndexSelected(), and windowIsClosing().

std::string FWGUIEventDataAdder::m_productInstanceLabel
private

Definition at line 91 of file FWGUIEventDataAdder.h.

Referenced by addNewItem(), newIndexSelected(), and windowIsClosing().

std::string FWGUIEventDataAdder::m_purpose
private

Definition at line 87 of file FWGUIEventDataAdder.h.

Referenced by addNewItem(), newIndexSelected(), and windowIsClosing().

TGTextEntry* FWGUIEventDataAdder::m_search
private

Definition at line 85 of file FWGUIEventDataAdder.h.

Referenced by createWindow(), and windowIsClosing().

DataAdderTableManager* FWGUIEventDataAdder::m_tableManager
private
FWTableWidget* FWGUIEventDataAdder::m_tableWidget
private

Definition at line 97 of file FWGUIEventDataAdder.h.

Referenced by createWindow().

std::string FWGUIEventDataAdder::m_type
private

Definition at line 89 of file FWGUIEventDataAdder.h.

Referenced by addNewItem(), newIndexSelected(), and windowIsClosing().