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 *)
 
 FWGUIEventDataAdder (const FWGUIEventDataAdder &)=delete
 
void metadataUpdatedSlot (void)
 
const FWGUIEventDataAdderoperator= (const FWGUIEventDataAdder &)=delete
 
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 ()
 
void newIndexSelected (int)
 

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() [1/2]

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

Definition at line 318 of file FWGUIEventDataAdder.cc.

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

323  : m_manager(iManager), m_metadataManager(iMetadataManager), m_parentFrame(iParent) {
325  createWindow();
326 }
FWEventItemsManager * m_manager
FWJobMetadataManager * m_metadataManager
sigc::signal< void()> metadataChanged_

◆ ~FWGUIEventDataAdder()

FWGUIEventDataAdder::~FWGUIEventDataAdder ( )
virtual

Definition at line 333 of file FWGUIEventDataAdder.cc.

333  {
334  /*
335  // m_frame->Cleanup();
336  // delete m_frame;
337  m_frame=0;
338  // delete m_tableWidget;
339  m_tableWidget=0;
340  delete m_tableManager;
341  m_tableManager=0;
342  */
343 }

◆ FWGUIEventDataAdder() [2/2]

FWGUIEventDataAdder::FWGUIEventDataAdder ( const FWGUIEventDataAdder )
delete

Member Function Documentation

◆ addNewItem()

void FWGUIEventDataAdder::addNewItem ( )

Definition at line 360 of file FWGUIEventDataAdder.cc.

References FWEventItemsManager::add(), FWEventItemsManager::begin(), FWDisplayProperties::defaultProperties, submitPVResolutionJobs::desc, FWEventItemsManager::end(), FWEventItemsManager::find(), fwLog, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kWarning, m_doNotUseProcessName, m_frame, m_manager, m_moduleLabel, m_name, m_processName, m_productInstanceLabel, m_purpose, m_type, HerwigMaxPtPartonFilter_cfi::moduleLabel, mps_check::msg, Skims_PA_cff::name, SimL1EmulatorRepack_CalouGT_cff::processName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by addNewItemAndClose().

360  {
361  TClass *theClass = TClass::GetClass(m_type.c_str());
362  if (nullptr == theClass) {
363  return;
364  }
366  if (moduleLabel.empty()) {
367  return;
368  }
369 
370  const std::string name = m_name->GetText();
371  if (name.empty()) {
372  return;
373  }
374 
375  if (m_manager->find(name)) {
376  TString msg("Event item '");
377  msg += name;
378  msg += "' is already registered. Please use another name.";
379  fwLog(fwlog::kWarning) << msg.Data() << std::endl;
380  new TGMsgBox(gClient->GetDefaultRoot(), m_frame, "Error - Name conflict", msg, kMBIconExclamation, kMBOk);
381  return;
382  }
383 
384  int largest = -1;
385  if (m_manager->begin() != m_manager->end()) {
386  if (*(m_manager->begin()))
387  largest = (*(m_manager->begin()))->layer();
388  }
389  for (FWEventItemsManager::const_iterator it = m_manager->begin(), itEnd = m_manager->end(); it != itEnd; ++it) {
390  if ((*it) && largest < (*it)->layer()) {
391  largest = (*it)->layer();
392  }
393  }
394  ++largest;
396  if (m_doNotUseProcessName->IsOn() && m_doNotUseProcessName->IsEnabled()) {
397  processName = "";
398  }
400  theClass,
401  m_purpose,
403  moduleLabel,
405  processName,
406  "",
407  largest);
408  m_manager->add(desc);
409 }
FWEventItemsManager * m_manager
static const FWDisplayProperties defaultProperties
const FWEventItem * find(const std::string &iName) const
std::string m_productInstanceLabel
FWEventItem * add(const FWPhysicsObjectDesc &iItem, const FWConfiguration *pbConf=nullptr, bool doSetEvent=true)
TGCheckButton * m_doNotUseProcessName
TGTransientFrame * m_frame
#define fwLog(_level_)
Definition: fwLog.h:45
tuple msg
Definition: mps_check.py:286
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
const_iterator end() const
std::vector< FWEventItem * >::const_iterator const_iterator

◆ addNewItemAndClose()

void FWGUIEventDataAdder::addNewItemAndClose ( )

Definition at line 411 of file FWGUIEventDataAdder.cc.

References addNewItem(), and windowIsClosing().

411  {
412  addNewItem();
413  windowIsClosing();
414 }

◆ createWindow()

void FWGUIEventDataAdder::createWindow ( )
private

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

444  {
447  std::bind(&FWGUIEventDataAdder::newIndexSelected, this, std::placeholders::_1));
448 
449  m_frame = new TGTransientFrame(gClient->GetDefaultRoot(), m_parentFrame, 600, 400);
450  m_frame->Connect("CloseWindow()", "FWGUIEventDataAdder", this, "windowIsClosing()");
451 
452  FWDialogBuilder builder(m_frame);
453  TGTextButton *cancelButton, *resetButton;
454 
455  builder.indent(10)
456  .spaceDown(15)
457  .addLabel("Search:", 0)
458  .expand(false)
459  .spaceUp(4)
460  .floatLeft(4)
461  .addTextEntry("", &m_search)
462  .spaceUp(0)
463  .frameSpaceDown(10)
464  .addLabel("Viewable Collections", 8)
465  .frameSpaceDown(5)
466  .addTable(m_tableManager, &m_tableWidget)
467  .expand(true, true)
468  .addLabel("Name:", 0)
469  .expand(false)
470  .spaceUp(4)
471  .floatLeft(4)
472  .addTextEntry("", &m_name)
473  .spaceUp(0)
474  .floatLeft(4)
475  .addTextButton(" Reset ", &resetButton)
476  .expand(false, false)
477  .frameSpaceUpDown(5)
478  .addCheckbox(
479  "Do not use Process Name and "
480  "instead only get this data "
481  "from the most recent Process",
483  .frameSpaceDown(15)
484  .hSpacer()
485  .floatLeft(0)
486  .addTextButton(" Close ", &cancelButton)
487  .expand(false)
488  .floatLeft(4)
489  .addTextButton(" Add Data ", &m_apply)
490  .expand(false)
491  .floatLeft(4)
492  .addTextButton(" Add Data && Close ", &m_applyAndClose)
493  .expand(false)
494  .spaceRight(25)
495  .spaceDown(15);
496 
497  m_search->Connect("TextChanged(const char *)", "FWGUIEventDataAdder", this, "updateFilterString(const char *)");
498  m_search->SetEnabled(true);
502  m_tableWidget->Connect("rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
503  "FWGUIEventDataAdder",
504  this,
505  "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)");
506 
508  m_name->SetState(true);
509  resetButton->SetEnabled(true);
510  resetButton->Connect("Clicked()", "FWGUIEventDataAdder", this, "resetNameEntry()");
511  m_doNotUseProcessName->SetState(kButtonDown);
512  cancelButton->Connect("Clicked()", "FWGUIEventDataAdder", this, "windowIsClosing()");
513  cancelButton->SetEnabled(true);
514  m_apply->Connect("Clicked()", "FWGUIEventDataAdder", this, "addNewItem()");
515  m_applyAndClose->Connect("Clicked()", "FWGUIEventDataAdder", this, "addNewItemAndClose()");
516 
517  m_frame->SetWindowName("Add Collection");
518  m_frame->MapSubwindows();
519  m_frame->Layout();
520 }
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

◆ metadataUpdatedSlot()

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

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

Referenced by FWGUIEventDataAdder().

526  {
528  m_tableManager->sort(0, true);
529 }
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

◆ newIndexSelected()

void FWGUIEventDataAdder::newIndexSelected ( int  iSelectedIndex)
private

Definition at line 535 of file FWGUIEventDataAdder.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, m_apply, m_applyAndClose, m_doNotUseProcessName, m_metadataManager, m_moduleLabel, m_name, m_processName, m_productInstanceLabel, m_purpose, m_type, OccupancyTask_cfi::metadata, SimL1EmulatorRepack_CalouGT_cff::processName, FWJobMetadataManager::processNamesInJob(), AlCaHLTBitMon_QueryRunRegistry::string, and FWJobMetadataManager::usableData().

Referenced by createWindow().

535  {
536  if (-1 != iSelectedIndex) {
537  std::vector<FWJobMetadataManager::Data> &metadata = m_metadataManager->usableData();
538  m_purpose = metadata[iSelectedIndex].purpose_;
539  m_type = metadata[iSelectedIndex].type_;
540  std::string oldModuleLabel = m_moduleLabel;
541  m_moduleLabel = metadata[iSelectedIndex].moduleLabel_;
542  m_productInstanceLabel = metadata[iSelectedIndex].productInstanceLabel_;
543  m_processName = metadata[iSelectedIndex].processName_;
544 
545  if (strlen(m_name->GetText()) == 0 || oldModuleLabel == m_name->GetText()) {
546  m_name->SetText(m_moduleLabel.c_str());
547  }
548  m_apply->SetEnabled(true);
549  m_applyAndClose->SetEnabled(true);
550 
551  //Check to see if this is the last process, if it is then we can let the user decide
552  // to not use the process name when doing the lookup. This makes a saved configuration
553  // more robust. However, if they choose a collection not from the last process then we need the
554  // process name in order to correctly get the data they want
555  bool isMostRecentProcess = true;
556  int index = 0;
557  for (std::vector<FWJobMetadataManager::Data>::iterator it = metadata.begin(), itEnd = metadata.end();
558  it != itEnd && isMostRecentProcess;
559  ++it, ++index) {
560  if (index == iSelectedIndex) {
561  continue;
562  }
563  if (it->moduleLabel_ == m_moduleLabel && it->purpose_ == m_purpose && it->type_ == m_type &&
564  it->productInstanceLabel_ == m_productInstanceLabel) {
565  //see if this process is newer than the data requested
566 
567  for (size_t pni = 0, pne = m_metadataManager->processNamesInJob().size(); pni != pne; ++pni) {
569  if (m_processName == processName)
570  break;
571 
572  if (it->processName_ == processName) {
573  isMostRecentProcess = false;
574  break;
575  }
576  }
577  }
578  }
579  if (isMostRecentProcess) {
580  if (!m_doNotUseProcessName->IsEnabled()) {
581  m_doNotUseProcessName->SetEnabled(true);
582  }
583  } else {
584  //NOTE: must remember state before we get here because 'enable' and 'on' are mutually
585  // exlcusive :(
586  m_doNotUseProcessName->SetEnabled(false);
587  }
588  }
589 }
TGTextButton * m_applyAndClose
std::vector< std::string > & processNamesInJob()
FWJobMetadataManager * m_metadataManager
std::string m_productInstanceLabel
std::vector< Data > & usableData()
TGCheckButton * m_doNotUseProcessName

◆ operator=()

const FWGUIEventDataAdder& FWGUIEventDataAdder::operator= ( const FWGUIEventDataAdder )
delete

◆ resetNameEntry()

void FWGUIEventDataAdder::resetNameEntry ( )

Definition at line 531 of file FWGUIEventDataAdder.cc.

References m_apply, m_moduleLabel, and m_name.

531  {
532  m_name->SetText(m_apply->IsEnabled() ? m_moduleLabel.c_str() : "", kFALSE);
533 }

◆ rowClicked()

void FWGUIEventDataAdder::rowClicked ( Int_t  iRow,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  ,
Int_t   
)

Definition at line 591 of file FWGUIEventDataAdder.cc.

References m_tableManager, and DataAdderTableManager::setSelection().

591  {
592  if (iButton == kButton1) {
593  m_tableManager->setSelection(iRow, iKeyMod);
594  }
595 }
void setSelection(int row, int mask)
DataAdderTableManager * m_tableManager

◆ show()

void FWGUIEventDataAdder::show ( )

Definition at line 416 of file FWGUIEventDataAdder.cc.

References createWindow(), and m_frame.

Referenced by FWGUIManager::addData().

416  {
417  // Map main frame
418  if (nullptr == m_frame) {
419  createWindow();
420  }
421  m_frame->MapWindow();
422 }
TGTransientFrame * m_frame

◆ updateFilterString()

void FWGUIEventDataAdder::updateFilterString ( const char *  str)

Definition at line 439 of file FWGUIEventDataAdder.cc.

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

439  {
442 }
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)

◆ windowIsClosing()

void FWGUIEventDataAdder::windowIsClosing ( )

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

424  {
425  m_name->SetText("");
426  m_search->SetText("");
427  m_purpose.clear();
428  m_type.clear();
429  m_moduleLabel.clear();
430  m_processName.clear();
431  m_productInstanceLabel.clear();
432  m_apply->SetEnabled(false);
433  m_applyAndClose->SetEnabled(false);
434 
435  m_frame->UnmapWindow();
436  m_frame->DontCallClose();
437 }
TGTextButton * m_applyAndClose
std::string m_productInstanceLabel
TGTransientFrame * m_frame

Member Data Documentation

◆ m_apply

TGTextButton* FWGUIEventDataAdder::m_apply
private

◆ m_applyAndClose

TGTextButton* FWGUIEventDataAdder::m_applyAndClose
private

Definition at line 81 of file FWGUIEventDataAdder.h.

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

◆ m_doNotUseProcessName

TGCheckButton* FWGUIEventDataAdder::m_doNotUseProcessName
private

Definition at line 79 of file FWGUIEventDataAdder.h.

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

◆ m_expr

std::string FWGUIEventDataAdder::m_expr
private

Definition at line 91 of file FWGUIEventDataAdder.h.

◆ m_frame

TGTransientFrame* FWGUIEventDataAdder::m_frame
private

Definition at line 77 of file FWGUIEventDataAdder.h.

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

◆ m_manager

FWEventItemsManager* FWGUIEventDataAdder::m_manager
private

Definition at line 73 of file FWGUIEventDataAdder.h.

Referenced by addNewItem().

◆ m_metadataManager

FWJobMetadataManager* FWGUIEventDataAdder::m_metadataManager
private

Definition at line 74 of file FWGUIEventDataAdder.h.

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

◆ m_moduleLabel

std::string FWGUIEventDataAdder::m_moduleLabel
private

◆ m_name

TGTextEntry* FWGUIEventDataAdder::m_name
private

◆ m_parentFrame

TGFrame* FWGUIEventDataAdder::m_parentFrame
private

Definition at line 76 of file FWGUIEventDataAdder.h.

Referenced by createWindow().

◆ m_processName

std::string FWGUIEventDataAdder::m_processName
private

Definition at line 89 of file FWGUIEventDataAdder.h.

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

◆ m_productInstanceLabel

std::string FWGUIEventDataAdder::m_productInstanceLabel
private

Definition at line 88 of file FWGUIEventDataAdder.h.

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

◆ m_purpose

std::string FWGUIEventDataAdder::m_purpose
private

Definition at line 84 of file FWGUIEventDataAdder.h.

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

◆ m_search

TGTextEntry* FWGUIEventDataAdder::m_search
private

Definition at line 82 of file FWGUIEventDataAdder.h.

Referenced by createWindow(), and windowIsClosing().

◆ m_tableManager

DataAdderTableManager* FWGUIEventDataAdder::m_tableManager
private

◆ m_tableWidget

FWTableWidget* FWGUIEventDataAdder::m_tableWidget
private

Definition at line 94 of file FWGUIEventDataAdder.h.

Referenced by createWindow().

◆ m_type

std::string FWGUIEventDataAdder::m_type
private

Definition at line 86 of file FWGUIEventDataAdder.h.

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