CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
void newIndexSelected (int)
 
const FWGUIEventDataAdderoperator= (const FWGUIEventDataAdder &)
 

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 352 of file FWGUIEventDataAdder.cc.

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

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

Definition at line 371 of file FWGUIEventDataAdder.cc.

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

Member Function Documentation

void FWGUIEventDataAdder::addNewItem ( )

Definition at line 400 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, moduleLabel(), runTheMatrix::msg, and mergeVDriftHistosByStation::name.

Referenced by addNewItemAndClose().

401 {
402  TClass* theClass = TClass::GetClass(m_type.c_str());
403  if(0==theClass) {
404  return;
405  }
406  const std::string moduleLabel = m_moduleLabel;
407  if(moduleLabel.empty()) {
408  return;
409  }
410 
411  const std::string name = m_name->GetText();
412  if(name.empty()) {
413  return;
414  }
415 
416  if ( m_manager->find( name ) ) {
417  TString msg("Event item '");
418  msg += name;
419  msg += "' is already registered. Please use another name.";
420  fwLog(fwlog::kWarning) << msg.Data() << std::endl;
421  new TGMsgBox(gClient->GetDefaultRoot(), m_frame,
422  "Error - Name conflict", msg, kMBIconExclamation, kMBOk);
423  return;
424  }
425 
426  int largest = -1;
427  if(m_manager->begin() != m_manager->end()) {
428  if ( *(m_manager->begin()) )
429  largest = (*(m_manager->begin()))->layer();
430  }
432  itEnd = m_manager->end();
433  it!=itEnd;
434  ++it) {
435  if((*it) && largest < (*it)->layer()) {
436  largest = (*it)->layer();
437  }
438  }
439  ++largest;
440  std::string processName = m_processName;
441  if(m_doNotUseProcessName->IsOn() && m_doNotUseProcessName->IsEnabled()) {
442  processName="";
443  }
444  FWPhysicsObjectDesc desc(name, theClass, m_purpose,
446  moduleLabel,
448  processName,
449  "",
450  largest);
451  m_manager->add(desc);
452 }
const FWEventItem * add(const FWPhysicsObjectDesc &iItem)
FWEventItemsManager * m_manager
static const FWDisplayProperties defaultProperties
std::string m_productInstanceLabel
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:51
std::vector< FWEventItem * >::const_iterator const_iterator
const_iterator end() const
const std::string * moduleLabel() const
Definition: HLTadd.h:40
void FWGUIEventDataAdder::addNewItemAndClose ( )

Definition at line 455 of file FWGUIEventDataAdder.cc.

References addNewItem(), and windowIsClosing().

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

Definition at line 496 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().

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

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

Referenced by FWGUIEventDataAdder().

561 {
563  m_tableManager->sort(0, true);
564 }
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 573 of file FWGUIEventDataAdder.cc.

References getHLTprescales::index, m_apply, m_applyAndClose, m_doNotUseProcessName, m_metadataManager, m_moduleLabel, m_name, m_processName, m_productInstanceLabel, m_purpose, m_type, FWJobMetadataManager::processNamesInJob(), and FWJobMetadataManager::usableData().

Referenced by createWindow().

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

Definition at line 567 of file FWGUIEventDataAdder.cc.

References m_apply, m_moduleLabel, and m_name.

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

Definition at line 634 of file FWGUIEventDataAdder.cc.

References m_tableManager, and DataAdderTableManager::setSelection().

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

Definition at line 489 of file FWGUIEventDataAdder.cc.

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

490 {
493 }
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
virtual void sortWithFilter(const char *filter)
DataAdderTableManager * m_tableManager
void FWGUIEventDataAdder::windowIsClosing ( )

Definition at line 472 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().

473 {
474  m_name->SetText("");
475  m_search->SetText("");
476  m_purpose.clear();
477  m_type.clear();
478  m_moduleLabel.clear();
479  m_processName.clear();
480  m_productInstanceLabel.clear();
481  m_apply->SetEnabled(false);
482  m_applyAndClose->SetEnabled(false);
483 
484  m_frame->UnmapWindow();
485  m_frame->DontCallClose();
486 }
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().