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::FWTableView ( TEveWindowSlot *  iParent,
FWTableViewManager manager 
)

Definition at line 197 of file FWTableView.cc.

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().

199  m_iColl(-1),
200  m_manager(manager),
202  m_tableWidget(nullptr),
203  m_showColumnUI(false),
205  m_currentColumn(-1),
207 
208 {
209  m_eveWindow = iParent->MakeFrame(nullptr);
210  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
211  // TGHorizontalFrame *buttons = new TGHorizontalFrame(frame);
212  // frame->AddFrame(buttons, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
213 
214  // m_collection = new TGComboBox(buttons);
215  m_vert = new TGVerticalFrame(frame);
216  frame->AddFrame(m_vert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
217  TGHorizontalFrame *header = new TGHorizontalFrame(m_vert);
218  m_vert->AddFrame(header, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
219  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
221  header, arrow_right(bgIsBlack), arrow_right_disabled(bgIsBlack), arrow_right_disabled(bgIsBlack));
222  m_columnUIButton->Connect("Clicked()", "FWTableView", this, "toggleShowHide()");
223  header->AddFrame(m_columnUIButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 6, 10));
224 
225  TGCompositeFrame *labfr = new TGHorizontalFrame(header, 60, 25, kFixedSize);
226  TGLabel *label = new TGLabel(labfr, "Collection");
227  labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 3, 0, 0));
228  header->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
229 
230  m_collection = new TGComboBox(header);
231  updateItems();
232  header->AddFrame(m_collection, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
233  m_collection->Connect("Selected(Int_t)", "FWTableView", this, "selectCollection(Int_t)");
234  m_collection->Select(2, true);
235  m_column_control = new TGVerticalFrame(m_vert);
236  m_vert->AddFrame(m_column_control, new TGLayoutHints(kLHintsExpandX));
237  TGLabel *column_control_label = new TGLabel(m_column_control, "Column editor");
238  // column_control_label->SetBackgroundColor(bgIsBlack ? kBlack : kWhite);
239  // column_control_label->SetForegroundColor(bgIsBlack ? kWhite : kBlack);
240  // column_control_label->SetTextColor(bgIsBlack ? kWhite : kBlack);
241  m_column_control->AddFrame(column_control_label, new TGLayoutHints(kLHintsExpandX));
242  TGHorizontalFrame *column_control_fields = new TGHorizontalFrame(m_column_control);
243  m_column_control->AddFrame(column_control_fields, new TGLayoutHints(kLHintsExpandX));
244  m_column_name_field = new TGTextEntry(column_control_fields);
245  m_column_name_field->SetMaxWidth(10);
246  m_column_expr_field = new FWGUIValidatingTextEntry(column_control_fields);
247  // m_column_expr_field->SetEnabled(kFALSE);
249  m_column_prec_field = new TGTextEntry(column_control_fields);
250  m_column_prec_field->SetMaxWidth(10);
251  TGLabel *name_label = new TGLabel(column_control_fields, "Title");
252  TGLabel *expr_label = new TGLabel(column_control_fields, "Expression");
253  TGLabel *prec_label = new TGLabel(column_control_fields, "Precision");
254  column_control_fields->AddFrame(name_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
255  column_control_fields->AddFrame(m_column_name_field, new TGLayoutHints(kLHintsExpandX));
256  column_control_fields->AddFrame(expr_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
257  column_control_fields->AddFrame(m_column_expr_field, new TGLayoutHints(kLHintsExpandX));
258  column_control_fields->AddFrame(prec_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
259  column_control_fields->AddFrame(m_column_prec_field, new TGLayoutHints(kLHintsExpandX));
260  TGTextButton *add_button = new TGTextButton(column_control_fields, "Add");
261  TGTextButton *del_button = new TGTextButton(column_control_fields, "Delete");
262  TGTextButton *mod_button = new TGTextButton(column_control_fields, "Modify");
263  add_button->Connect("Clicked()", "FWTableView", this, "addColumn()");
264  del_button->Connect("Clicked()", "FWTableView", this, "deleteColumn()");
265  mod_button->Connect("Clicked()", "FWTableView", this, "modifyColumn()");
266  column_control_fields->AddFrame(add_button, new TGLayoutHints);
267  column_control_fields->AddFrame(del_button, new TGLayoutHints);
268  column_control_fields->AddFrame(mod_button, new TGLayoutHints);
272  m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(kWhite));
273  m_tableWidget->Connect(
274  "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)", "FWTableView", this, "modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
275  m_tableWidget->Connect("columnClicked(Int_t,Int_t,Int_t)", "FWTableView", this, "columnSelected(Int_t,Int_t,Int_t)");
276  m_vert->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
277  frame->MapSubwindows();
278  m_vert->HideFrame(m_column_control);
279  frame->Layout();
280  frame->MapWindow();
281 }
Color_t background() const
FWTableViewManager * m_manager
Definition: FWTableView.h:90
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:98
FWExpressionValidator * m_validator
Definition: FWTableView.h:97
void SetHeaderBackgroundColor(Pixel_t)
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
FWColorManager & colorManager() const
TGTextEntry * m_column_name_field
Definition: FWTableView.h:95
TGCompositeFrame * m_column_control
Definition: FWTableView.h:88
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
Definition: FWTableView.cc:149
char const * label
void disableGrowInWidth()
void updateItems()
Definition: FWTableView.cc:518
bool m_showColumnUI
Definition: FWTableView.h:93
void setValidator(FWValidatorBase *)
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
void resetColors(const class FWColorManager &)
Definition: FWTableView.cc:300
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:158
friend class FWTableViewTableManager
Definition: FWTableView.h:51
TGCompositeFrame * m_vert
Definition: FWTableView.h:88
TEveWindowFrame * m_eveWindow
Definition: FWTableView.h:86
int m_currentColumn
Definition: FWTableView.h:99
bool m_useColumnsFromConfig
Definition: FWTableView.h:100
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:96
FWCustomIconsButton * m_columnUIButton
Definition: FWTableView.h:94
TGComboBox * m_collection
Definition: FWTableView.h:87
FWViewBase(FWViewType::EType, unsigned int iVersion=1)
Definition: FWViewBase.cc:32
FWTableView::~FWTableView ( )
override

Definition at line 283 of file FWTableView.cc.

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

283  {
284  // take out composite frame and delete it directly ( without the timeout)
285  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
286  frame->RemoveFrame(m_vert);
287  delete m_vert;
288 
289  m_eveWindow->DestroyWindowAndSlot();
290  delete m_tableManager;
291  delete m_validator;
292 }
FWExpressionValidator * m_validator
Definition: FWTableView.h:97
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
TGCompositeFrame * m_vert
Definition: FWTableView.h:88
TEveWindowFrame * m_eveWindow
Definition: FWTableView.h:86
FWTableView::FWTableView ( const FWTableView )
privatedelete

Member Function Documentation

void FWTableView::addColumn ( )

Definition at line 626 of file FWTableView.cc.

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.

626  {
627  std::string name = m_column_name_field->GetText();
628  std::string expr = m_column_expr_field->GetText();
629  // convert the precision to a long int
630  char *endptr = nullptr;
631  int prec = (int)strtol(m_column_prec_field->GetText(), &endptr, 0);
632  if (name.empty() || expr.empty() || m_column_prec_field->GetText() == nullptr || *endptr != 0) {
633  fwLog(fwlog::kInfo) << "bad input\n";
634  fflush(stdout);
635  return;
636  }
637  fwLog(fwlog::kInfo) << "adding column " << name << ": " << expr << ", precision " << prec << std::endl;
638  fflush(stdout);
639  // m_manager->tableFormats(*item->modelType())
641  m_tableManager->m_tableFormats->push_back(e);
643  // change needs to be propagated to all tables, because all
644  // tables displaying objects of this type are affected
645  // MT -- this is NOT true!!! FIX
648 }
FWTableViewManager * m_manager
Definition: FWTableView.h:90
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:98
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
void forceLayout()
Definition: FWTableWidget.h:81
TGTextEntry * m_column_name_field
Definition: FWTableView.h:95
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
#define fwLog(_level_)
Definition: fwLog.h:45
int m_currentColumn
Definition: FWTableView.h:99
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:96
void FWTableView::addTo ( FWConfiguration iTo) const
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 319 of file FWTableView.cc.

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.

319  {
320  // are we the first FWTableView to go into the configuration? If
321  // we are, then we are responsible for writing out the list of
322  // types (which we do by letting FWTableViewManager::addToImpl
323  // write into our configuration)
324  if (this == m_manager->m_views.front().get())
325  m_manager->addToImpl(iTo);
326  // then there is the stuff we have to do anyway: remember what
327  // collection we display
330  if (m_manager->items()[m_iColl])
331  collectionName = m_manager->items()[m_iColl]->name();
332  else
333  collectionName = "NULL";
334 
335  FWConfiguration collection(collectionName);
336  main.addKeyValue(kCollection, collection);
338  main.addKeyValue(kSortColumn, sortColumn);
339  FWConfiguration descendingSort(m_tableWidget->descendingSort());
340  main.addKeyValue(kDescendingSort, descendingSort);
341  // FWConfiguration columns(1);
342  // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
343  // i = m_tableManager->m_tableFormats->begin(),
344  // iEnd = m_tableManager->m_tableFormats->end();
345  // i != iEnd; ++i) {
346  // columns.addValue(i->name);
347  // columns.addValue(i->expression);
348  // char prec[100];
349  // snprintf(prec, 100, "%d", i->precision);
350  // columns.addValue(prec);
351  // }
352  // main.addKeyValue(kColumns, columns);
354  // take care of parameters
356 }
static const std::string kDescendingSort
Definition: FWTableView.cc:192
void addTo(FWConfiguration &) const override
void addToImpl(FWConfiguration &) const
FWTableViewManager * m_manager
Definition: FWTableView.h:90
const Items & items() const
static const std::string kSortColumn
Definition: FWTableView.cc:191
bool descendingSort() const
Definition: FWTableWidget.h:88
static const std::string kCollection
Definition: FWTableView.cc:189
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
static const std::string kTableView
Definition: FWTableView.cc:188
int sortedColumn() const
Definition: FWTableWidget.h:87
Definition: main.py:1
void FWTableView::columnSelected ( Int_t  iCol,
Int_t  iButton,
Int_t  iKeyMod 
)

Definition at line 610 of file FWTableView.cc.

References mps_splice::entry, FWTableViewManager::TableEntry::expression, m_column_expr_field, m_column_name_field, m_column_prec_field, m_currentColumn, FWTableViewTableManager::m_tableFormats, m_tableManager, FWTableViewManager::TableEntry::name, and FWTableViewManager::TableEntry::precision.

610  {
611  if (iButton == 1 || iButton == 3)
612  m_currentColumn = iCol;
613  // update contents of the column editor
614  if (m_currentColumn >= 0 && m_currentColumn < (int)m_tableManager->m_tableFormats->size()) {
616  m_column_name_field->SetText(entry.name.c_str());
617  m_column_expr_field->SetText(entry.expression.c_str());
618  m_column_prec_field->SetText(Form("%d", entry.precision));
619  } else {
620  m_column_name_field->SetText("");
621  m_column_expr_field->SetText("");
622  m_column_prec_field->SetText("");
623  }
624 }
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:98
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
TGTextEntry * m_column_name_field
Definition: FWTableView.h:95
int m_currentColumn
Definition: FWTableView.h:99
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:96
void FWTableView::dataChanged ( )

Definition at line 550 of file FWTableView.cc.

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

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

550  {
551  // const FWEventItem *item = m_manager->items()[m_iColl];
554  // std::vector<FWExpressionEvaluator> &ev = m_evaluators;
555  // for (unsigned int i = 0; i < item->size(); ++i) {
556  // for (unsigned int j = 0; j < ev.size(); ++j) {
557  // printf("%s = %f\t", (*m_manager->tableFormats(item->modelType()->GetName())).second[j].name.c_str(),
558  // ev[j].evalExpression(item->modelData(i)));
559  // }
560  // printf("\n");
561  // }
562  // fflush(stdout);
563 }
void updateEvaluators()
Definition: FWTableView.cc:542
void dataChanged()
Called if mouse button pressed in Row Header, defaults is to do nothing.
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
void FWTableView::deleteColumn ( )

Definition at line 650 of file FWTableView.cc.

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.

650  {
651  if (m_currentColumn >= 0 && m_currentColumn < (int)m_tableManager->m_tableFormats->size()) {
653  m_column_name_field->SetText("");
654  m_column_expr_field->SetText("");
655  m_column_prec_field->SetText("");
656  m_currentColumn = -1;
657  }
658  // change needs to be propagated to all tables, because all
659  // tables displaying objects of this type are affected
660  // MT -- this is NOT true!!! FIX
663 }
FWTableViewManager * m_manager
Definition: FWTableView.h:90
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:98
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
void forceLayout()
Definition: FWTableWidget.h:81
TGTextEntry * m_column_name_field
Definition: FWTableView.h:95
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
int m_currentColumn
Definition: FWTableView.h:99
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:96
const FWEventItem * FWTableView::item ( ) const
void FWTableView::modelSelected ( Int_t  iRow,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
)

Definition at line 597 of file FWTableView.cc.

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

597  {
598  if (iKeyMod & kKeyControlMask) {
599  item()->toggleSelect(iRow);
600  } else {
601  FWChangeSentry sentry(*(item()->changeManager()));
603  item()->select(iRow);
604  }
605  if (iButton == kButton3) {
606  openSelectedModelContextMenu_(iGlobalX, iGlobalY);
607  }
608 }
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:57
const FWEventItem * item() const
Definition: FWTableView.cc:544
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:124
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:236
void select(int iIndex) const
Definition: FWEventItem.cc:224
void FWTableView::modifyColumn ( )

Definition at line 665 of file FWTableView.cc.

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.

665  {
666  std::string name = m_column_name_field->GetText();
667  std::string expr = m_column_expr_field->GetText();
668  // convert the precision to a long int
669  char *endptr = nullptr;
670  int prec = (int)strtol(m_column_prec_field->GetText(), &endptr, 0);
671  if (name.empty() || expr.empty() || m_column_prec_field->GetText() == nullptr || *endptr != 0) {
672  fwLog(fwlog::kInfo) << "bad input\n";
673  fflush(stdout);
674  return;
675  }
676  fwLog(fwlog::kInfo) << "modify column " << name << ": " << expr << ", precision " << prec << std::endl;
677  fflush(stdout);
678  // m_manager->tableFormats(*item->modelType())
681  // Change needs to be propagated to all tables, because all
682  // tables displaying objects of this type are affected
683  // MT -- this is NOT true!!! FIX
686 }
FWTableViewManager * m_manager
Definition: FWTableView.h:90
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:98
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
void forceLayout()
Definition: FWTableWidget.h:81
TGTextEntry * m_column_name_field
Definition: FWTableView.h:95
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
#define fwLog(_level_)
Definition: fwLog.h:45
int m_currentColumn
Definition: FWTableView.h:99
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:96
const FWTableView& FWTableView::operator= ( const FWTableView )
privatedelete
void FWTableView::resetColors ( const class FWColorManager )

Definition at line 300 of file FWTableView.cc.

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

Referenced by FWTableView().

300  {
301  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(manager.background()));
302  // m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(manager.background()));
303  // switch (manager.foreground()) {
304  // case FWColorManager::kBlackIndex:
305  // m_tableWidget->SetHeaderForegroundColor(gVirtualX->GetPixel(kBlack));
306  // break;
307  // default:
308  // m_tableWidget->SetHeaderForegroundColor(0xffffff);
309  // break;
310  // }
311  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(manager.foreground()));
312  // m_tableWidget->dataChanged();
313 }
void SetLineSeparatorColor(Pixel_t)
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
void SetBackgroundColor(Pixel_t) override
void FWTableView::saveImageTo ( const std::string &  iName) const
overridevirtual

Implements FWViewBase.

Definition at line 423 of file FWTableView.cc.

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().

423  {
424  TString format;
425  TString data;
426  FWTextTableCellRenderer *textRenderer;
427 
428  // calculate widths
429  int ndheader = TMath::Ceil(TMath::Log10(m_tableManager->numberOfRows()));
430 
431  std::vector<size_t> widths(m_tableManager->numberOfColumns());
432 
433  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c)
434  widths[c] = m_tableManager->m_tableFormats->at(c).name.size();
435 
436  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
437  for (int r = 0; r < m_tableManager->numberOfRows(); r++) {
438  textRenderer = (FWTextTableCellRenderer *)m_tableManager->cellRenderer(r, c); // setup cell renderer
439  size_t ss = textRenderer->data().size();
440  if (widths[c] < ss)
441  widths[c] = ss;
442  }
443  }
444 
445  int rlen = 0;
446  for (size_t c = 0; c < (size_t)m_tableManager->numberOfColumns(); ++c)
447  rlen += widths[c];
448  rlen += (m_tableManager->numberOfColumns() - 1) * 3;
449  rlen++;
450 
451  // header
452  printf("\n");
453  TString headerFormat;
454  headerFormat.Form("%%%ds", ndheader + 3);
455  data.Form(headerFormat, " ");
456  printf("%s", data.Data());
457 
458  int lastCol = m_tableManager->numberOfColumns() - 1;
459 
460  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
461  format.Form("%%%ds", (int)widths[c]);
462  data.Form(format, m_tableManager->m_tableFormats->at(c).name.c_str());
463 
464  if (c == lastCol)
465  printf("%s", data.Data());
466  else
467  printf("%s | ", data.Data());
468  }
469  printf("\n");
470 
471  std::string splitter(rlen, '-');
472  std::cout << splitter << std::endl;
473 
474  // body
475  headerFormat.Form("[%%%dd] ", ndheader);
476  for (int r = 0; r < m_tableManager->numberOfRows(); r++) {
477  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c) {
478  if (!c) {
479  data.Form(headerFormat, m_tableManager->unsortedRowNumber(r));
480  printf("%s", data.Data());
481  }
482  format.Form("%%%ds", (int)widths[c]);
483  textRenderer = (FWTextTableCellRenderer *)m_tableManager->cellRenderer(r, c); // setup cell renderer
484  data.Form(format, textRenderer->data().c_str());
485  if (c == lastCol)
486  printf("%s", data.Data());
487  else
488  printf("%s | ", data.Data());
489  }
490  printf("\n");
491  }
492 }
def splitter(iterator, n)
Definition: confdb.py:13
int numberOfColumns() const override
Number of columns in the table.
int unsortedRowNumber(int iSortedRowNumber) const override
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
const std::string & data()
int numberOfRows() const override
Number of rows in the table.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
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 569 of file FWTableView.cc.

References 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().

569  {
570  // printf("selected collection %d, ", i_coll);
571  const FWEventItem *item = m_manager->items()[i_coll];
572  assert(nullptr != item);
573  // printf("%s\n", item->modelType()->GetName());
574  m_iColl = i_coll;
575  // m_validator = new FWExpressionValidator;
576  // m_column_expr_field->setValidator(m_validator);
577  if (m_validator != nullptr) {
578  // std::cout << "setting validator to " << item->modelType()->GetName() << std::endl;
579  m_validator->setType(edm::TypeWithDict(*(item->modelType()->GetTypeInfo())));
580  } else {
581  // std::cout << "can't set null validator\n";
582  }
583  if (not m_useColumnsFromConfig) {
584  if (m_manager->tableFormats(*item->modelType()) == m_manager->m_tableFormats.end()) {
585  fwLog(fwlog::kInfo) << "No table format for objects of this type " << item->modelType()->GetName() << std::endl;
586  m_tableManager->m_tableFormats->clear();
587  } else {
589  }
590  }
591  // columnSelected(-1, 1, 0);
592  if (m_tableWidget)
594  dataChanged();
595 }
void setType(const edm::TypeWithDict &)
FWTableViewManager * m_manager
Definition: FWTableView.h:90
FWExpressionValidator * m_validator
Definition: FWTableView.h:97
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
void forceLayout()
Definition: FWTableWidget.h:81
U second(std::pair< T, U > const &p)
TableSpecs::iterator tableFormats(const edm::TypeWithDict &key)
const Items & items() const
const FWEventItem * item() const
Definition: FWTableView.cc:544
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
#define fwLog(_level_)
Definition: fwLog.h:45
bool m_useColumnsFromConfig
Definition: FWTableView.h:100
const TClass * modelType() const
Definition: FWEventItem.cc:464
void dataChanged()
Definition: FWTableView.cc:550
void FWTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 294 of file FWTableView.cc.

References m_tableWidget, and FWTableWidget::SetBackgroundColor().

Referenced by Vispa.Plugins.EdmBrowser.EventContentView.LabelItem::__init__().

294  {
295  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
296  // m_tableWidget->SetBackgroundColor(TColor::Number2Pixel(iColor));
297  // m_viewer->GetGLViewer()->SetClearColor(iColor);
298 }
FWTableWidget * m_tableWidget
Definition: FWTableView.h:92
void SetBackgroundColor(Pixel_t) override
void FWTableView::setFrom ( const FWConfiguration iFrom)
overridevirtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 358 of file FWTableView.cc.

References beam_dqm_sourceclient-live_cfg::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::value(), FWConfiguration::valueForKey(), and FWConfiguration::version().

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

Definition at line 494 of file FWTableView.cc.

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().

494  {
496  const TGPicture *picture = nullptr;
497  const TGPicture *down = nullptr;
498  const TGPicture *disabled = nullptr;
499  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
500  if (m_showColumnUI) {
501  picture = arrow_down(bgIsBlack);
502  down = arrow_down_disabled(bgIsBlack);
503  disabled = arrow_down_disabled(bgIsBlack);
504  m_vert->ShowFrame(m_column_control);
505  } else {
506  picture = arrow_right(bgIsBlack);
507  down = arrow_right_disabled(bgIsBlack);
508  disabled = arrow_right_disabled(bgIsBlack);
509  m_vert->HideFrame(m_column_control);
510  }
511  m_vert->Layout();
512  m_columnUIButton->swapIcons(picture, down, disabled);
513 }
Color_t background() const
FWTableViewManager * m_manager
Definition: FWTableView.h:90
static const TGPicture * arrow_down(bool iBackgroundIsBlack)
Definition: FWTableView.cc:167
string disabled
Definition: mps_check.py:68
FWColorManager & colorManager() const
TGCompositeFrame * m_column_control
Definition: FWTableView.h:88
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
Definition: FWTableView.cc:149
bool m_showColumnUI
Definition: FWTableView.h:93
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:158
TGCompositeFrame * m_vert
Definition: FWTableView.h:88
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:176
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
FWCustomIconsButton * m_columnUIButton
Definition: FWTableView.h:94
void FWTableView::updateEvaluators ( )

Definition at line 542 of file FWTableView.cc.

References m_tableManager, and FWTableViewTableManager::updateEvaluators().

Referenced by dataChanged().

FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:91
void FWTableView::updateItems ( void  )

Reconstructs the combo box using the information coming from FWEventItemsManager.

Definition at line 518 of file FWTableView.cc.

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().

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

Friends And Related Function Documentation

friend class FWTableViewTableManager
friend

Definition at line 51 of file FWTableView.h.

Member Data Documentation

TGComboBox* FWTableView::m_collection
protected

Definition at line 87 of file FWTableView.h.

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

TGCompositeFrame * FWTableView::m_column_control
protected

Definition at line 88 of file FWTableView.h.

Referenced by FWTableView(), and toggleShowHide().

FWGUIValidatingTextEntry* FWTableView::m_column_expr_field
protected

Definition at line 96 of file FWTableView.h.

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

TGTextEntry* FWTableView::m_column_name_field
protected

Definition at line 95 of file FWTableView.h.

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

TGTextEntry* FWTableView::m_column_prec_field
protected

Definition at line 98 of file FWTableView.h.

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

FWCustomIconsButton* FWTableView::m_columnUIButton
protected

Definition at line 94 of file FWTableView.h.

Referenced by FWTableView(), and toggleShowHide().

int FWTableView::m_currentColumn
protected

Definition at line 99 of file FWTableView.h.

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

TEveWindowFrame* FWTableView::m_eveWindow
protected

Definition at line 86 of file FWTableView.h.

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

int FWTableView::m_iColl
protected
FWTableViewManager* FWTableView::m_manager
protected
bool FWTableView::m_showColumnUI
protected

Definition at line 93 of file FWTableView.h.

Referenced by toggleShowHide().

FWTableViewTableManager* FWTableView::m_tableManager
protected
FWTableWidget* FWTableView::m_tableWidget
protected
bool FWTableView::m_useColumnsFromConfig
protected

Definition at line 100 of file FWTableView.h.

Referenced by selectCollection().

FWExpressionValidator* FWTableView::m_validator
protected

Definition at line 97 of file FWTableView.h.

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

TGCompositeFrame* FWTableView::m_vert
protected

Definition at line 88 of file FWTableView.h.

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