CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Friends
FWTableView Class Reference

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

Inheritance diagram for FWTableView:
FWViewBase FWConfigurableParameterizable FWParameterizable FWConfigurable

Public Member Functions

void addColumn ()
 
void addTo (FWConfiguration &) const override
 
void columnSelected (Int_t iCol, Int_t iButton, Int_t iKeyMod)
 
void dataChanged ()
 
void deleteColumn ()
 
 FWTableView (TEveWindowSlot *, FWTableViewManager *)
 
const FWEventItemitem () const
 
void modelSelected (Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
 
void modifyColumn ()
 
void resetColors (const class FWColorManager &)
 
void saveImageTo (const std::string &iName) const override
 
void selectCollection (Int_t)
 
void setBackgroundColor (Color_t)
 
void setFrom (const FWConfiguration &) override
 
void toggleShowHide ()
 
void updateEvaluators ()
 
void updateItems ()
 
 ~FWTableView () override
 
- Public Member Functions inherited from FWViewBase
virtual FWViewContextMenuHandlerBasecontextMenuHandler () const
 
void destroy ()
 
 FWViewBase (FWViewType::EType, unsigned int iVersion=1)
 
virtual void populateController (ViewerParameterGUI &) const
 
void promptForSaveImageTo (TGFrame *) const
 
FWViewType::EType typeId () const
 
const std::string & typeName () const
 
- Public Member Functions inherited from FWConfigurableParameterizable
 FWConfigurableParameterizable (unsigned int iVersion=1)
 
unsigned int version () const
 
 ~FWConfigurableParameterizable () override
 
- Public Member Functions inherited from FWParameterizable
void add (FWParameterBase *)
 
const_iterator begin () const
 
const_iterator end () const
 
 FWParameterizable ()
 
virtual ~FWParameterizable ()
 
- Public Member Functions inherited from FWConfigurable
 FWConfigurable ()
 
virtual ~FWConfigurable ()
 

Protected Attributes

TGComboBox * m_collection
 
TGCompositeFrame * m_column_control
 
FWGUIValidatingTextEntrym_column_expr_field
 
TGTextEntry * m_column_name_field
 
TGTextEntry * m_column_prec_field
 
FWCustomIconsButtonm_columnUIButton
 
int m_currentColumn
 
TEveWindowFrame * m_eveWindow
 
int m_iColl
 
FWTableViewManagerm_manager
 
bool m_showColumnUI
 
FWTableViewTableManagerm_tableManager
 
FWTableWidgetm_tableWidget
 
bool m_useColumnsFromConfig
 
FWExpressionValidatorm_validator
 
TGCompositeFrame * m_vert
 
- Protected Attributes inherited from FWViewBase
FWViewType m_type
 

Private Member Functions

 FWTableView (const FWTableView &)=delete
 
const FWTableViewoperator= (const FWTableView &)=delete
 

Friends

class FWTableViewTableManager
 

Additional Inherited Members

- Public Types inherited from FWParameterizable
typedef std::vector< FWParameterBase * >::const_iterator const_iterator
 
- Public Attributes inherited from FWViewBase
sigc::signal< void, const FWViewBase * > beingDestroyed_
 
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
 
- Protected Member Functions inherited from FWViewBase
 ~FWViewBase () override
 

Detailed Description

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

Usage: <usage>

Definition at line 50 of file FWTableView.h.

Constructor & Destructor Documentation

◆ FWTableView() [1/2]

FWTableView::FWTableView ( TEveWindowSlot *  iParent,
FWTableViewManager manager 
)

Definition at line 198 of file FWTableView.cc.

200  m_iColl(-1),
201  m_manager(manager),
203  m_tableWidget(nullptr),
204  m_showColumnUI(false),
206  m_currentColumn(-1),
208 
209 {
210  m_eveWindow = iParent->MakeFrame(nullptr);
211  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
212  // TGHorizontalFrame *buttons = new TGHorizontalFrame(frame);
213  // frame->AddFrame(buttons, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
214 
215  // m_collection = new TGComboBox(buttons);
216  m_vert = new TGVerticalFrame(frame);
217  frame->AddFrame(m_vert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
218  TGHorizontalFrame *header = new TGHorizontalFrame(m_vert);
219  m_vert->AddFrame(header, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
220  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
222  header, arrow_right(bgIsBlack), arrow_right_disabled(bgIsBlack), arrow_right_disabled(bgIsBlack));
223  m_columnUIButton->Connect("Clicked()", "FWTableView", this, "toggleShowHide()");
224  header->AddFrame(m_columnUIButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 10));
225 
226  TGCompositeFrame *labfr = new TGHorizontalFrame(header, 60, 25, kFixedSize);
227  TGLabel *label = new TGLabel(labfr, "Collection");
228  labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 3, 0, 0));
229  header->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
230 
231  m_collection = new TGComboBox(header);
232  updateItems();
233  header->AddFrame(m_collection, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
234  m_collection->Connect("Selected(Int_t)", "FWTableView", this, "selectCollection(Int_t)");
235  m_collection->Select(2, true);
236  m_column_control = new TGVerticalFrame(m_vert);
237  m_vert->AddFrame(m_column_control, new TGLayoutHints(kLHintsExpandX));
238  TGLabel *column_control_label = new TGLabel(m_column_control, "Column editor");
239  // column_control_label->SetBackgroundColor(bgIsBlack ? kBlack : kWhite);
240  // column_control_label->SetForegroundColor(bgIsBlack ? kWhite : kBlack);
241  // column_control_label->SetTextColor(bgIsBlack ? kWhite : kBlack);
242  m_column_control->AddFrame(column_control_label, new TGLayoutHints(kLHintsExpandX));
243  TGHorizontalFrame *column_control_fields = new TGHorizontalFrame(m_column_control);
244  m_column_control->AddFrame(column_control_fields, new TGLayoutHints(kLHintsExpandX));
245  m_column_name_field = new TGTextEntry(column_control_fields);
246  m_column_name_field->SetMaxWidth(10);
247  m_column_expr_field = new FWGUIValidatingTextEntry(column_control_fields);
248  // m_column_expr_field->SetEnabled(kFALSE);
250  m_column_prec_field = new TGTextEntry(column_control_fields);
251  m_column_prec_field->SetMaxWidth(10);
252  TGLabel *name_label = new TGLabel(column_control_fields, "Title");
253  TGLabel *expr_label = new TGLabel(column_control_fields, "Expression");
254  TGLabel *prec_label = new TGLabel(column_control_fields, "Precision");
255  column_control_fields->AddFrame(name_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
256  column_control_fields->AddFrame(m_column_name_field, new TGLayoutHints(kLHintsExpandX));
257  column_control_fields->AddFrame(expr_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
258  column_control_fields->AddFrame(m_column_expr_field, new TGLayoutHints(kLHintsExpandX));
259  column_control_fields->AddFrame(prec_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
260  column_control_fields->AddFrame(m_column_prec_field, new TGLayoutHints(kLHintsExpandX));
261  TGTextButton *add_button = new TGTextButton(column_control_fields, "Add");
262  TGTextButton *del_button = new TGTextButton(column_control_fields, "Delete");
263  TGTextButton *mod_button = new TGTextButton(column_control_fields, "Modify");
264  add_button->Connect("Clicked()", "FWTableView", this, "addColumn()");
265  del_button->Connect("Clicked()", "FWTableView", this, "deleteColumn()");
266  mod_button->Connect("Clicked()", "FWTableView", this, "modifyColumn()");
267  column_control_fields->AddFrame(add_button, new TGLayoutHints);
268  column_control_fields->AddFrame(del_button, new TGLayoutHints);
269  column_control_fields->AddFrame(mod_button, new TGLayoutHints);
273  m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(kWhite));
274  m_tableWidget->Connect(
275  "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)", "FWTableView", this, "modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
276  m_tableWidget->Connect("columnClicked(Int_t,Int_t,Int_t)", "FWTableView", this, "columnSelected(Int_t,Int_t,Int_t)");
277  m_vert->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
278  frame->MapSubwindows();
279  m_vert->HideFrame(m_column_control);
280  frame->Layout();
281  frame->MapWindow();
282 }

References arrow_right(), arrow_right_disabled(), FWColorManager::background(), FWViewManagerBase::colorManager(), FWTableWidget::disableGrowInWidth(), amptDefault_cfi::frame, RecoTauValidation_cfi::header, label, m_collection, m_column_control, m_column_expr_field, m_column_name_field, m_column_prec_field, m_columnUIButton, m_eveWindow, m_manager, m_tableManager, m_tableWidget, m_validator, m_vert, resetColors(), FWTableWidget::SetHeaderBackgroundColor(), FWGUIValidatingTextEntry::setValidator(), and updateItems().

◆ ~FWTableView()

FWTableView::~FWTableView ( )
override

Definition at line 284 of file FWTableView.cc.

284  {
285  // take out composite frame and delete it directly ( without the timeout)
286  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
287  frame->RemoveFrame(m_vert);
288  delete m_vert;
289 
290  m_eveWindow->DestroyWindowAndSlot();
291  delete m_tableManager;
292  delete m_validator;
293 }

References amptDefault_cfi::frame, m_eveWindow, m_tableManager, m_validator, and m_vert.

◆ FWTableView() [2/2]

FWTableView::FWTableView ( const FWTableView )
privatedelete

Member Function Documentation

◆ addColumn()

void FWTableView::addColumn ( )

Definition at line 627 of file FWTableView.cc.

627  {
628  std::string name = m_column_name_field->GetText();
629  std::string expr = m_column_expr_field->GetText();
630  // convert the precision to a long int
631  char *endptr = nullptr;
632  int prec = (int)strtol(m_column_prec_field->GetText(), &endptr, 0);
633  if (name.empty() || expr.empty() || m_column_prec_field->GetText() == nullptr || *endptr != 0) {
634  fwLog(fwlog::kInfo) << "bad input\n";
635  fflush(stdout);
636  return;
637  }
638  fwLog(fwlog::kInfo) << "adding column " << name << ": " << expr << ", precision " << prec << std::endl;
639  fflush(stdout);
640  // m_manager->tableFormats(*item->modelType())
642  m_tableManager->m_tableFormats->push_back(e);
644  // change needs to be propagated to all tables, because all
645  // tables displaying objects of this type are affected
646  // MT -- this is NOT true!!! FIX
649 }

References FWTableViewManager::dataChanged(), MillePedeFileConverter_cfg::e, jets_cff::expr, FWTableWidget::forceLayout(), fwLog, createfilelist::int, fwlog::kInfo, m_column_expr_field, m_column_name_field, m_column_prec_field, m_currentColumn, m_manager, FWTableViewTableManager::m_tableFormats, m_tableManager, m_tableWidget, Skims_PA_cff::name, mps_setup::stdout, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ addTo()

void FWTableView::addTo ( FWConfiguration iTo) const
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 320 of file FWTableView.cc.

320  {
321  // are we the first FWTableView to go into the configuration? If
322  // we are, then we are responsible for writing out the list of
323  // types (which we do by letting FWTableViewManager::addToImpl
324  // write into our configuration)
325  if (this == m_manager->m_views.front().get())
326  m_manager->addToImpl(iTo);
327  // then there is the stuff we have to do anyway: remember what
328  // collection we display
331  if (m_manager->items()[m_iColl])
332  collectionName = m_manager->items()[m_iColl]->name();
333  else
334  collectionName = "NULL";
335 
337  main.addKeyValue(kCollection, collection);
339  main.addKeyValue(kSortColumn, sortColumn);
340  FWConfiguration descendingSort(m_tableWidget->descendingSort());
341  main.addKeyValue(kDescendingSort, descendingSort);
342  // FWConfiguration columns(1);
343  // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
344  // i = m_tableManager->m_tableFormats->begin(),
345  // iEnd = m_tableManager->m_tableFormats->end();
346  // i != iEnd; ++i) {
347  // columns.addValue(i->name);
348  // columns.addValue(i->expression);
349  // char prec[100];
350  // snprintf(prec, 100, "%d", i->precision);
351  // columns.addValue(prec);
352  // }
353  // main.addKeyValue(kColumns, columns);
355  // take care of parameters
357 }

References FWConfiguration::addKeyValue(), FWConfigurableParameterizable::addTo(), FWTableViewManager::addToImpl(), universalConfigTemplate::collection, bysipixelclustmulteventfilter_cfi::collectionName, FWTableWidget::descendingSort(), FWTableViewManager::items(), kCollection, kDescendingSort, kSortColumn, kTableView, m_iColl, m_manager, m_tableWidget, FWTableViewManager::m_views, magneticFieldFilterJSON::main(), FWTableWidget::sortedColumn(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ columnSelected()

void FWTableView::columnSelected ( Int_t  iCol,
Int_t  iButton,
Int_t  iKeyMod 
)

Definition at line 611 of file FWTableView.cc.

611  {
612  if (iButton == 1 || iButton == 3)
613  m_currentColumn = iCol;
614  // update contents of the column editor
615  if (m_currentColumn >= 0 && m_currentColumn < (int)m_tableManager->m_tableFormats->size()) {
617  m_column_name_field->SetText(entry.name.c_str());
618  m_column_expr_field->SetText(entry.expression.c_str());
619  m_column_prec_field->SetText(Form("%d", entry.precision));
620  } else {
621  m_column_name_field->SetText("");
622  m_column_expr_field->SetText("");
623  m_column_prec_field->SetText("");
624  }
625 }

References mps_splice::entry, m_column_expr_field, m_column_name_field, m_column_prec_field, m_currentColumn, FWTableViewTableManager::m_tableFormats, and m_tableManager.

◆ dataChanged()

void FWTableView::dataChanged ( )

Definition at line 551 of file FWTableView.cc.

551  {
552  // const FWEventItem *item = m_manager->items()[m_iColl];
555  // std::vector<FWExpressionEvaluator> &ev = m_evaluators;
556  // for (unsigned int i = 0; i < item->size(); ++i) {
557  // for (unsigned int j = 0; j < ev.size(); ++j) {
558  // printf("%s = %f\t", (*m_manager->tableFormats(item->modelType()->GetName())).second[j].name.c_str(),
559  // ev[j].evalExpression(item->modelData(i)));
560  // }
561  // printf("\n");
562  // }
563  // fflush(stdout);
564 }

References FWTableViewTableManager::dataChanged(), m_tableManager, and updateEvaluators().

Referenced by FWTableViewManager::notifyViews(), and selectCollection().

◆ deleteColumn()

void FWTableView::deleteColumn ( )

Definition at line 651 of file FWTableView.cc.

651  {
652  if (m_currentColumn >= 0 && m_currentColumn < (int)m_tableManager->m_tableFormats->size()) {
654  m_column_name_field->SetText("");
655  m_column_expr_field->SetText("");
656  m_column_prec_field->SetText("");
657  m_currentColumn = -1;
658  }
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 }

References FWTableViewManager::dataChanged(), FWTableWidget::forceLayout(), m_column_expr_field, m_column_name_field, m_column_prec_field, m_currentColumn, m_manager, FWTableViewTableManager::m_tableFormats, m_tableManager, and m_tableWidget.

◆ item()

const FWEventItem * FWTableView::item ( ) const

◆ modelSelected()

void FWTableView::modelSelected ( Int_t  iRow,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
)

Definition at line 598 of file FWTableView.cc.

598  {
599  if (iKeyMod & kKeyControlMask) {
600  item()->toggleSelect(iRow);
601  } else {
602  FWChangeSentry sentry(*(item()->changeManager()));
604  item()->select(iRow);
605  }
606  if (iButton == kButton3) {
607  openSelectedModelContextMenu_(iGlobalX, iGlobalY);
608  }
609 }

References FWSelectionManager::clearSelection(), item(), FWViewBase::openSelectedModelContextMenu_, FWEventItem::select(), FWEventItem::selectionManager(), and FWEventItem::toggleSelect().

◆ modifyColumn()

void FWTableView::modifyColumn ( )

Definition at line 666 of file FWTableView.cc.

666  {
667  std::string name = m_column_name_field->GetText();
668  std::string expr = m_column_expr_field->GetText();
669  // convert the precision to a long int
670  char *endptr = nullptr;
671  int prec = (int)strtol(m_column_prec_field->GetText(), &endptr, 0);
672  if (name.empty() || expr.empty() || m_column_prec_field->GetText() == nullptr || *endptr != 0) {
673  fwLog(fwlog::kInfo) << "bad input\n";
674  fflush(stdout);
675  return;
676  }
677  fwLog(fwlog::kInfo) << "modify column " << name << ": " << expr << ", precision " << prec << std::endl;
678  fflush(stdout);
679  // m_manager->tableFormats(*item->modelType())
682  // Change needs to be propagated to all tables, because all
683  // tables displaying objects of this type are affected
684  // MT -- this is NOT true!!! FIX
687 }

References FWTableViewManager::dataChanged(), MillePedeFileConverter_cfg::e, jets_cff::expr, FWTableWidget::forceLayout(), fwLog, createfilelist::int, fwlog::kInfo, m_column_expr_field, m_column_name_field, m_column_prec_field, m_currentColumn, m_manager, FWTableViewTableManager::m_tableFormats, m_tableManager, m_tableWidget, Skims_PA_cff::name, mps_setup::stdout, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ operator=()

const FWTableView& FWTableView::operator= ( const FWTableView )
privatedelete

◆ resetColors()

void FWTableView::resetColors ( const class FWColorManager )

Definition at line 301 of file FWTableView.cc.

301  {
302  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(manager.background()));
303  // m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(manager.background()));
304  // switch (manager.foreground()) {
305  // case FWColorManager::kBlackIndex:
306  // m_tableWidget->SetHeaderForegroundColor(gVirtualX->GetPixel(kBlack));
307  // break;
308  // default:
309  // m_tableWidget->SetHeaderForegroundColor(0xffffff);
310  // break;
311  // }
312  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(manager.foreground()));
313  // m_tableWidget->dataChanged();
314 }

References FWColorManager::background(), FWColorManager::foreground(), m_tableWidget, FWTableWidget::SetBackgroundColor(), and FWTableWidget::SetLineSeparatorColor().

Referenced by FWTableView().

◆ saveImageTo()

void FWTableView::saveImageTo ( const std::string &  iName) const
overridevirtual

Implements FWViewBase.

Definition at line 424 of file FWTableView.cc.

424  {
425  TString format;
426  TString data;
427  FWTextTableCellRenderer *textRenderer;
428 
429  // calculate widths
430  int ndheader = TMath::Ceil(TMath::Log10(m_tableManager->numberOfRows()));
431 
432  std::vector<size_t> widths(m_tableManager->numberOfColumns());
433 
434  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c)
435  widths[c] = m_tableManager->m_tableFormats->at(c).name.size();
436 
437  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
438  for (int r = 0; r < m_tableManager->numberOfRows(); r++) {
439  textRenderer = (FWTextTableCellRenderer *)m_tableManager->cellRenderer(r, c); // setup cell renderer
440  size_t ss = textRenderer->data().size();
441  if (widths[c] < ss)
442  widths[c] = ss;
443  }
444  }
445 
446  int rlen = 0;
447  for (size_t c = 0; c < (size_t)m_tableManager->numberOfColumns(); ++c)
448  rlen += widths[c];
449  rlen += (m_tableManager->numberOfColumns() - 1) * 3;
450  rlen++;
451 
452  // header
453  printf("\n");
454  TString headerFormat;
455  headerFormat.Form("%%%ds", ndheader + 3);
456  data.Form(headerFormat, " ");
457  printf("%s", data.Data());
458 
459  int lastCol = m_tableManager->numberOfColumns() - 1;
460 
461  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
462  format.Form("%%%ds", (int)widths[c]);
463  data.Form(format, m_tableManager->m_tableFormats->at(c).name.c_str());
464 
465  if (c == lastCol)
466  printf("%s", data.Data());
467  else
468  printf("%s | ", data.Data());
469  }
470  printf("\n");
471 
472  std::string splitter(rlen, '-');
473  std::cout << splitter << std::endl;
474 
475  // body
476  headerFormat.Form("[%%%dd] ", ndheader);
477  for (int r = 0; r < m_tableManager->numberOfRows(); r++) {
478  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
479  if (!c) {
480  data.Form(headerFormat, m_tableManager->unsortedRowNumber(r));
481  printf("%s", data.Data());
482  }
483  format.Form("%%%ds", (int)widths[c]);
484  textRenderer = (FWTextTableCellRenderer *)m_tableManager->cellRenderer(r, c); // setup cell renderer
485  data.Form(format, textRenderer->data().c_str());
486  if (c == lastCol)
487  printf("%s", data.Data());
488  else
489  printf("%s | ", data.Data());
490  }
491  printf("\n");
492  }
493 }

References HltBtagPostValidation_cff::c, FWTableViewTableManager::cellRenderer(), gather_cfg::cout, FWTextTableCellRenderer::data(), data, dqm-mbProfile::format, FWTableViewTableManager::m_tableFormats, m_tableManager, FWTableViewTableManager::numberOfColumns(), FWTableViewTableManager::numberOfRows(), alignCSCRings::r, confdb::splitter(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and FWTableViewTableManager::unsortedRowNumber().

◆ selectCollection()

void FWTableView::selectCollection ( Int_t  i_coll)

Select the collection to be displayed by the table view and updates the evaluators required to retrieve the data from the event.

Definition at line 570 of file FWTableView.cc.

570  {
571  // printf("selected collection %d, ", i_coll);
572  const FWEventItem *item = m_manager->items()[i_coll];
573  assert(nullptr != item);
574  // printf("%s\n", item->modelType()->GetName());
575  m_iColl = i_coll;
576  // m_validator = new FWExpressionValidator;
577  // m_column_expr_field->setValidator(m_validator);
578  if (m_validator != nullptr) {
579  // std::cout << "setting validator to " << item->modelType()->GetName() << std::endl;
580  m_validator->setType(edm::TypeWithDict(*(item->modelType()->GetTypeInfo())));
581  } else {
582  // std::cout << "can't set null validator\n";
583  }
584  if (not m_useColumnsFromConfig) {
586  fwLog(fwlog::kInfo) << "No table format for objects of this type " << item->modelType()->GetName() << std::endl;
587  m_tableManager->m_tableFormats->clear();
588  } else {
590  }
591  }
592  // columnSelected(-1, 1, 0);
593  if (m_tableWidget)
595  dataChanged();
596 }

References cms::cuda::assert(), dataChanged(), FWTableWidget::forceLayout(), fwLog, item(), FWTableViewManager::items(), fwlog::kInfo, m_iColl, m_manager, FWTableViewManager::m_tableFormats, FWTableViewTableManager::m_tableFormats, m_tableManager, m_tableWidget, m_useColumnsFromConfig, m_validator, FWEventItem::modelType(), edm::second(), FWExpressionValidator::setType(), and FWTableViewManager::tableFormats().

◆ setBackgroundColor()

void FWTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 295 of file FWTableView.cc.

295  {
296  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
297  // m_tableWidget->SetBackgroundColor(TColor::Number2Pixel(iColor));
298  // m_viewer->GetGLViewer()->SetClearColor(iColor);
299 }

References m_tableWidget, and FWTableWidget::SetBackgroundColor().

◆ setFrom()

void FWTableView::setFrom ( const FWConfiguration iFrom)
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 359 of file FWTableView.cc.

359  {
360  if (this == m_manager->m_views.front().get())
361  m_manager->setFrom(iFrom);
362  try {
363  const FWConfiguration *main = iFrom.valueForKey(kTableView);
364  assert(main != nullptr);
365  // use the columns from the config, not the default columns for
366  // the collection type
367  // m_useColumnsFromConfig = true;
368  // m_tableManager->m_tableFormats->clear();
369  // const FWConfiguration *columns = main->valueForKey(kColumns);
370  // for (FWConfiguration::StringValuesIt it = columns->stringValues()->begin(),
371  // itEnd = columns->stringValues()->end(); it != itEnd; ++it) {
372  // const std::string &name = *it++;
373  // const std::string &expr = *it++;
374  // int prec = atoi(it->c_str());
375  // FWTableViewManager::TableEntry e = { expr, name, prec };
376  // m_tableManager->m_tableFormats->push_back(e);
377  // }
378  const FWConfiguration *collection = main->valueForKey(kCollection);
379  const std::string &collectionName = collection->value();
380  // find item
381  for (std::vector<const FWEventItem *>::const_iterator it = m_manager->items().begin(),
382  itEnd = m_manager->items().end();
383  it != itEnd;
384  ++it) {
385  if (*it && (*it)->name() == collectionName) {
386  m_collection->Select(it - m_manager->items().begin(), true);
387  break;
388  }
389  }
390  const FWConfiguration *sortColumn = main->valueForKey(kSortColumn);
391  const FWConfiguration *descendingSort = main->valueForKey(kDescendingSort);
392  if (sortColumn != nullptr && descendingSort != nullptr) {
393  unsigned int sort = sortColumn->version();
394  bool descending = descendingSort->version();
395  if (sort < ((unsigned int)m_tableManager->numberOfColumns()))
396  m_tableWidget->sort(sort, descending);
397  }
398  } catch (...) {
399  // configuration doesn't contain info for the table. Be forgiving.
400  std::cerr << "This configuration file contains tables, but no column information. "
401  "(It is probably old.) Using defaults."
402  << std::endl;
403  }
404 
405  // main.addKeyValue(kCollection, collection);
406  // FWConfiguration columns(1);
407  // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
408  // i = m_tableManager->m_tableFormats->begin(),
409  // iEnd = m_tableManager->m_tableFormats->end();
410  // i != iEnd; ++i) {
411  // columns.addValue(i->name);
412  // columns.addValue(i->expression);
413  // columns.addValue(Form("%d", i->precision));
414  // }
415  // main.addKeyValue(kColumns, columns);
416  // iTo.addKeyValue(kTableView, main);
417  // // take care of parameters
418  // FWConfigurableParameterizable::addTo(iTo);
419 
420  // take care of parameters
422 }

References cms::cuda::assert(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, universalConfigTemplate::collection, bysipixelclustmulteventfilter_cfi::collectionName, FWTableViewManager::items(), kCollection, kDescendingSort, kSortColumn, kTableView, m_collection, m_manager, m_tableManager, m_tableWidget, FWTableViewManager::m_views, FWTableViewTableManager::numberOfColumns(), FWConfigurableParameterizable::setFrom(), FWTableViewManager::setFrom(), FWTableWidget::sort(), AlCaHLTBitMon_QueryRunRegistry::string, FWConfiguration::valueForKey(), and FWConfiguration::version().

◆ toggleShowHide()

void FWTableView::toggleShowHide ( )

Definition at line 495 of file FWTableView.cc.

495  {
497  const TGPicture *picture = nullptr;
498  const TGPicture *down = nullptr;
499  const TGPicture *disabled = nullptr;
500  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
501  if (m_showColumnUI) {
502  picture = arrow_down(bgIsBlack);
503  down = arrow_down_disabled(bgIsBlack);
504  disabled = arrow_down_disabled(bgIsBlack);
505  m_vert->ShowFrame(m_column_control);
506  } else {
507  picture = arrow_right(bgIsBlack);
508  down = arrow_right_disabled(bgIsBlack);
509  disabled = arrow_right_disabled(bgIsBlack);
510  m_vert->HideFrame(m_column_control);
511  }
512  m_vert->Layout();
514 }

References arrow_down(), arrow_down_disabled(), arrow_right(), arrow_right_disabled(), FWColorManager::background(), FWViewManagerBase::colorManager(), mps_check::disabled, down, m_column_control, m_columnUIButton, m_manager, m_showColumnUI, m_vert, and FWCustomIconsButton::swapIcons().

◆ updateEvaluators()

void FWTableView::updateEvaluators ( )

Definition at line 543 of file FWTableView.cc.

References m_tableManager, and FWTableViewTableManager::updateEvaluators().

Referenced by dataChanged().

◆ updateItems()

void FWTableView::updateItems ( void  )

Reconstructs the combo box using the information coming from FWEventItemsManager.

Definition at line 519 of file FWTableView.cc.

519  {
520  int selected = m_collection->GetSelected();
521  m_collection->RemoveAll();
522  int index = 0;
523 
524  for (size_t i = 0, e = m_manager->items().size(); i != e; ++i) {
525  const FWEventItem *item = m_manager->items()[i];
526  if (item)
527  m_collection->AddEntry(item->name().c_str(), i);
528 
529  if (m_iColl == index && nullptr == item) {
530  //the collection we were showing is now gone
531  m_iColl = -1;
532  selected = -1;
533  }
534  }
535 
536  if (selected != -1 && selected < m_collection->GetNumberOfEntries())
537  m_collection->Select(selected, false);
538 
539  TGListBox *lb = m_collection->GetListBox();
540  lb->SetHeight(TMath::Min(lb->GetNumberOfEntries() * lb->GetItemVsize() + 2 * lb->GetBorderWidth(), 200u));
541 }

References MillePedeFileConverter_cfg::e, mps_fire::i, item(), FWTableViewManager::items(), m_collection, m_iColl, m_manager, Min(), and FWEventItem::name().

Referenced by FWTableView(), and FWTableViewManager::notifyViews().

Friends And Related Function Documentation

◆ FWTableViewTableManager

friend class FWTableViewTableManager
friend

Definition at line 51 of file FWTableView.h.

Member Data Documentation

◆ m_collection

TGComboBox* FWTableView::m_collection
protected

Definition at line 87 of file FWTableView.h.

Referenced by FWTableView(), setFrom(), and updateItems().

◆ m_column_control

TGCompositeFrame * FWTableView::m_column_control
protected

Definition at line 88 of file FWTableView.h.

Referenced by FWTableView(), and toggleShowHide().

◆ m_column_expr_field

FWGUIValidatingTextEntry* FWTableView::m_column_expr_field
protected

Definition at line 96 of file FWTableView.h.

Referenced by addColumn(), columnSelected(), deleteColumn(), FWTableView(), and modifyColumn().

◆ m_column_name_field

TGTextEntry* FWTableView::m_column_name_field
protected

Definition at line 95 of file FWTableView.h.

Referenced by addColumn(), columnSelected(), deleteColumn(), FWTableView(), and modifyColumn().

◆ m_column_prec_field

TGTextEntry* FWTableView::m_column_prec_field
protected

Definition at line 98 of file FWTableView.h.

Referenced by addColumn(), columnSelected(), deleteColumn(), FWTableView(), and modifyColumn().

◆ m_columnUIButton

FWCustomIconsButton* FWTableView::m_columnUIButton
protected

Definition at line 94 of file FWTableView.h.

Referenced by FWTableView(), and toggleShowHide().

◆ m_currentColumn

int FWTableView::m_currentColumn
protected

Definition at line 99 of file FWTableView.h.

Referenced by addColumn(), columnSelected(), deleteColumn(), and modifyColumn().

◆ m_eveWindow

TEveWindowFrame* FWTableView::m_eveWindow
protected

Definition at line 86 of file FWTableView.h.

Referenced by FWTableView(), and ~FWTableView().

◆ m_iColl

int FWTableView::m_iColl
protected

◆ m_manager

FWTableViewManager* FWTableView::m_manager
protected

◆ m_showColumnUI

bool FWTableView::m_showColumnUI
protected

Definition at line 93 of file FWTableView.h.

Referenced by toggleShowHide().

◆ m_tableManager

FWTableViewTableManager* FWTableView::m_tableManager
protected

◆ m_tableWidget

FWTableWidget* FWTableView::m_tableWidget
protected

◆ m_useColumnsFromConfig

bool FWTableView::m_useColumnsFromConfig
protected

Definition at line 100 of file FWTableView.h.

Referenced by selectCollection().

◆ m_validator

FWExpressionValidator* FWTableView::m_validator
protected

Definition at line 97 of file FWTableView.h.

Referenced by FWTableView(), selectCollection(), and ~FWTableView().

◆ m_vert

TGCompositeFrame* FWTableView::m_vert
protected

Definition at line 88 of file FWTableView.h.

Referenced by FWTableView(), toggleShowHide(), and ~FWTableView().

FWTableViewTableManager::cellRenderer
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
Definition: FWTableViewTableManager.cc:73
splitter
Definition: splitter.py:1
FWGUIValidatingTextEntry::setValidator
void setValidator(FWValidatorBase *)
Definition: FWGUIValidatingTextEntry.cc:78
FWTableViewTableManager::dataChanged
void dataChanged()
Called if mouse button pressed in Row Header, defaults is to do nothing.
Definition: FWTableViewTableManager.cc:201
FWTableView::m_columnUIButton
FWCustomIconsButton * m_columnUIButton
Definition: FWTableView.h:94
FWTableView::m_collection
TGComboBox * m_collection
Definition: FWTableView.h:87
FWTableWidget::SetBackgroundColor
void SetBackgroundColor(Pixel_t) override
Definition: FWTableWidget.cc:173
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:428
FWTableView::m_iColl
int m_iColl
Definition: FWTableView.h:89
FWTableViewTableManager::m_tableFormats
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
Definition: FWTableViewTableManager.h:110
FWTableViewManager::addToImpl
void addToImpl(FWConfiguration &) const
Definition: FWTableViewManager.cc:440
arrow_right
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
Definition: FWTableView.cc:150
FWViewManagerBase::colorManager
FWColorManager & colorManager() const
Definition: FWViewManagerBase.cc:123
FWEventItem::toggleSelect
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:236
mps_splice.entry
entry
Definition: mps_splice.py:68
FWTableView::m_validator
FWExpressionValidator * m_validator
Definition: FWTableView.h:97
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FWExpressionValidator
Definition: FWExpressionValidator.h:34
arrow_down_disabled
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:177
FWTableView::m_column_name_field
TGTextEntry * m_column_name_field
Definition: FWTableView.h:95
FWTableWidget::sort
void sort(UInt_t iColumn, bool iDescendingSort)
Definition: FWTableWidget.cc:161
FWTableViewManager::items
const Items & items() const
Definition: FWTableViewManager.h:70
cms::cuda::assert
assert(be >=bs)
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
FWTableView::m_column_control
TGCompositeFrame * m_column_control
Definition: FWTableView.h:88
kCollection
static const std::string kCollection
Definition: FWTableView.cc:190
arrow_down
static const TGPicture * arrow_down(bool iBackgroundIsBlack)
Definition: FWTableView.cc:168
FWTableView::m_manager
FWTableViewManager * m_manager
Definition: FWTableView.h:90
FWEventItem::selectionManager
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:124
FWTextTableCellRenderer
Definition: FWTextTableCellRenderer.h:32
FWTableViewTableManager::unsortedRowNumber
int unsortedRowNumber(int iSortedRowNumber) const override
Definition: FWTableViewTableManager.cc:67
FWSelectionManager::clearSelection
void clearSelection()
Definition: FWSelectionManager.cc:63
FWGUIValidatingTextEntry
Definition: FWGUIValidatingTextEntry.h:35
kTableView
static const std::string kTableView
Definition: FWTableView.cc:189
FWEventItem::select
void select(int iIndex) const
Definition: FWEventItem.cc:224
FWConfigurableParameterizable::setFrom
void setFrom(const FWConfiguration &) override
Definition: FWConfigurableParameterizable.cc:56
FWTableView::m_showColumnUI
bool m_showColumnUI
Definition: FWTableView.h:93
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
FWTableWidget::disableGrowInWidth
void disableGrowInWidth()
Definition: FWTableWidget.cc:498
down
Definition: BitonicSort.h:7
FWTableViewTableManager::numberOfRows
int numberOfRows() const override
Number of rows in the table.
Definition: FWTableViewTableManager.cc:47
FWTableView::m_tableWidget
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
FWCustomIconsButton::swapIcons
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
Definition: FWCustomIconsButton.cc:78
FWTableWidget
Definition: FWTableWidget.h:35
dqm-mbProfile.format
format
Definition: dqm-mbProfile.py:16
FWTableView::m_tableManager
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
FWChangeSentry
Definition: FWModelChangeManager.h:68
FWTableViewTableManager::updateEvaluators
void updateEvaluators()
Definition: FWTableViewTableManager.cc:224
FWEventItem::modelType
const TClass * modelType() const
Definition: FWEventItem.cc:464
FWViewBase::openSelectedModelContextMenu_
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:57
FWConfiguration::valueForKey
const FWConfiguration * valueForKey(const std::string &iKey) const
Definition: FWConfiguration.cc:122
bysipixelclustmulteventfilter_cfi.collectionName
collectionName
Definition: bysipixelclustmulteventfilter_cfi.py:5
confdb.splitter
def splitter(iterator, n)
Definition: confdb.py:13
FWTableWidget::sortedColumn
int sortedColumn() const
Definition: FWTableWidget.h:87
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::TypeWithDict
Definition: TypeWithDict.h:38
FWCustomIconsButton
Definition: FWCustomIconsButton.h:29
mps_setup.stdout
stdout
Definition: mps_setup.py:250
FWTableView::m_eveWindow
TEveWindowFrame * m_eveWindow
Definition: FWTableView.h:86
FWTableView::updateItems
void updateItems()
Definition: FWTableView.cc:519
FWTextTableCellRenderer::data
const std::string & data()
Definition: FWTextTableCellRenderer.h:56
kSortColumn
static const std::string kSortColumn
Definition: FWTableView.cc:192
FWTableView::item
const FWEventItem * item() const
Definition: FWTableView.cc:545
FWTableViewManager::setFrom
void setFrom(const FWConfiguration &) override
Definition: FWTableViewManager.cc:461
createfilelist.int
int
Definition: createfilelist.py:10
FWTableViewManager::m_tableFormats
TableSpecs m_tableFormats
Definition: FWTableViewManager.h:95
FWTableWidget::forceLayout
void forceLayout()
Definition: FWTableWidget.h:81
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
mps_check.disabled
string disabled
Definition: mps_check.py:68
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
FWConfiguration::version
unsigned int version() const
Definition: FWConfiguration.h:49
FWTableViewTableManager::numberOfColumns
int numberOfColumns() const override
Number of columns in the table.
Definition: FWTableViewTableManager.cc:54
main
Definition: main.py:1
FWTableViewManager::TableEntry
Definition: FWTableViewManager.h:43
alignCSCRings.r
r
Definition: alignCSCRings.py:93
FWTableWidget::descendingSort
bool descendingSort() const
Definition: FWTableWidget.h:88
FWConfiguration::addKeyValue
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
Definition: FWConfiguration.cc:58
fwlog::kInfo
Definition: fwLog.h:35
FWTableView::dataChanged
void dataChanged()
Definition: FWTableView.cc:551
FWTableView::resetColors
void resetColors(const class FWColorManager &)
Definition: FWTableView.cc:301
FWEventItem
Definition: FWEventItem.h:56
FWTableView::m_useColumnsFromConfig
bool m_useColumnsFromConfig
Definition: FWTableView.h:100
FWTableWidget::SetLineSeparatorColor
void SetLineSeparatorColor(Pixel_t)
Definition: FWTableWidget.cc:209
FWConfigurableParameterizable::addTo
void addTo(FWConfiguration &) const override
Definition: FWConfigurableParameterizable.cc:67
jets_cff.expr
expr
Definition: jets_cff.py:483
FWTableViewManager::tableFormats
TableSpecs::iterator tableFormats(const edm::TypeWithDict &key)
Definition: FWTableViewManager.cc:276
FWTableView::FWTableViewTableManager
friend class FWTableViewTableManager
Definition: FWTableView.h:51
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
FWViewBase::FWViewBase
FWViewBase(FWViewType::EType, unsigned int iVersion=1)
Definition: FWViewBase.cc:32
arrow_right_disabled
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:159
format
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FWTableWidget::SetHeaderBackgroundColor
void SetHeaderBackgroundColor(Pixel_t)
Definition: FWTableWidget.cc:188
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
kDescendingSort
static const std::string kDescendingSort
Definition: FWTableView.cc:193
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
FWEventItem::name
const std::string & name() const
Definition: FWEventItem.cc:435
FWExpressionValidator::setType
void setType(const edm::TypeWithDict &)
Definition: FWExpressionValidator.cc:191
FWConfiguration
Definition: FWConfiguration.h:31
FWTableView::m_vert
TGCompositeFrame * m_vert
Definition: FWTableView.h:88
Min
T Min(T a, T b)
Definition: MathUtil.h:39
FWTableView::updateEvaluators
void updateEvaluators()
Definition: FWTableView.cc:543
FWTableViewManager::dataChanged
void dataChanged()
Definition: FWTableViewManager.cc:416
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
FWTableView::m_column_prec_field
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:98
FWTableView::m_currentColumn
int m_currentColumn
Definition: FWTableView.h:99
label
const char * label
Definition: PFTauDecayModeTools.cc:11
FWColorManager::background
Color_t background() const
Definition: FWColorManager.h:55
magneticFieldFilterJSON.main
def main(argv=None)
Definition: magneticFieldFilterJSON.py:22
FWTableViewManager::m_views
Views m_views
Definition: FWTableViewManager.h:93
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FWTableView::m_column_expr_field
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:96
FWViewType::kTable
Definition: FWViewType.h:39