CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
virtual void addTo (FWConfiguration &) const
 
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 &)
 
virtual void saveImageTo (const std::string &iName) const
 
void selectCollection (Int_t)
 
void setBackgroundColor (Color_t)
 
virtual void setFrom (const FWConfiguration &)
 
void toggleShowHide ()
 
void updateEvaluators ()
 
void updateItems ()
 
virtual ~FWTableView ()
 
- Public Member Functions inherited from FWViewBase
virtual
FWViewContextMenuHandlerBase
contextMenuHandler () 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
 
virtual ~FWConfigurableParameterizable ()
 
- 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 &)
 
const FWTableViewoperator= (const FWTableView &)
 

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
virtual ~FWViewBase ()
 

Detailed Description

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

Usage: <usage>

Definition at line 51 of file FWTableView.h.

Constructor & Destructor Documentation

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

Definition at line 205 of file FWTableView.cc.

References arrow_right(), arrow_right_disabled(), FWColorManager::background(), FWViewManagerBase::colorManager(), 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().

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

Definition at line 293 of file FWTableView.cc.

References m_eveWindow, m_tableManager, m_validator, and m_vert.

294 {
295  // take out composite frame and delete it directly ( without the timeout)
296  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
297  frame->RemoveFrame(m_vert);
298  delete m_vert;
299 
300  m_eveWindow->DestroyWindowAndSlot();
301  delete m_tableManager;
302  delete m_validator;
303 }
FWExpressionValidator * m_validator
Definition: FWTableView.h:98
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
TGCompositeFrame * m_vert
Definition: FWTableView.h:89
TEveWindowFrame * m_eveWindow
Definition: FWTableView.h:87
FWTableView::FWTableView ( const FWTableView )
private

Member Function Documentation

void FWTableView::addColumn ( )

Definition at line 597 of file FWTableView.cc.

References FWTableViewManager::dataChanged(), FWTableWidget::forceLayout(), fwLog, 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, and mergeVDriftHistosByStation::name.

598 {
599  std::string name = m_column_name_field->GetText();
600  std::string expr = m_column_expr_field->GetText();
601  // convert the precision to a long int
602  char *endptr = 0;
603  int prec = (int) strtol(m_column_prec_field->GetText(), &endptr, 0);
604  if (name == "" || expr == "" ||
605  m_column_prec_field->GetText() == 0 || *endptr != 0) {
606  fwLog(fwlog::kInfo) << "bad input\n";
607  fflush(stdout);
608  return;
609  }
610  fwLog(fwlog::kInfo) << "adding column "<< name << ": " << expr << ", precision " << prec << std::endl;
611  fflush(stdout);
612 // m_manager->tableFormats(*item->modelType())
613  FWTableViewManager::TableEntry e = { expr, name, prec };
614  m_tableManager->m_tableFormats->push_back(e);
615  m_currentColumn = (int)m_tableManager->m_tableFormats->size() + 1;
616  // change needs to be propagated to all tables, because all
617  // tables displaying objects of this type are affected
618  // MT -- this is NOT true!!! FIX
621 }
FWTableViewManager * m_manager
Definition: FWTableView.h:91
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:99
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void forceLayout()
Definition: FWTableWidget.h:84
TGTextEntry * m_column_name_field
Definition: FWTableView.h:96
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
#define fwLog(_level_)
Definition: fwLog.h:51
int m_currentColumn
Definition: FWTableView.h:100
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:97
void FWTableView::addTo ( FWConfiguration iTo) const
virtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 335 of file FWTableView.cc.

References FWConfiguration::addKeyValue(), FWConfigurableParameterizable::addTo(), FWTableViewManager::addToImpl(), runEdmFileComparison::collection, FWTableWidget::descendingSort(), FWTableViewManager::items(), kCollection, kDescendingSort, kSortColumn, kTableView, m_iColl, m_manager, m_tableWidget, FWTableViewManager::m_views, main(), and FWTableWidget::sortedColumn().

336 {
337  // are we the first FWTableView to go into the configuration? If
338  // we are, then we are responsible for writing out the list of
339  // types (which we do by letting FWTableViewManager::addToImpl
340  // write into our configuration)
341  if (this == m_manager->m_views.front().get())
342  m_manager->addToImpl(iTo);
343  // then there is the stuff we have to do anyway: remember what
344  // collection we display
346  std::string collectionName;
347  if (m_manager->items()[m_iColl])
348  collectionName = m_manager->items()[m_iColl]->name();
349  else
350  collectionName = "NULL";
351 
352  FWConfiguration collection(collectionName);
353  main.addKeyValue(kCollection, collection);
355  main.addKeyValue(kSortColumn, sortColumn);
356  FWConfiguration descendingSort(m_tableWidget->descendingSort());
357  main.addKeyValue(kDescendingSort, descendingSort);
358 // FWConfiguration columns(1);
359 // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
360 // i = m_tableManager->m_tableFormats->begin(),
361 // iEnd = m_tableManager->m_tableFormats->end();
362 // i != iEnd; ++i) {
363 // columns.addValue(i->name);
364 // columns.addValue(i->expression);
365 // char prec[100];
366 // snprintf(prec, 100, "%d", i->precision);
367 // columns.addValue(prec);
368 // }
369 // main.addKeyValue(kColumns, columns);
371  // take care of parameters
373 }
static const std::string kDescendingSort
Definition: FWTableView.cc:200
void addToImpl(FWConfiguration &) const
FWTableViewManager * m_manager
Definition: FWTableView.h:91
int main(int argc, char **argv)
const Items & items() const
static const std::string kSortColumn
Definition: FWTableView.cc:199
bool descendingSort() const
Definition: FWTableWidget.h:91
static const std::string kCollection
Definition: FWTableView.cc:197
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
static const std::string kTableView
Definition: FWTableView.cc:196
int sortedColumn() const
Definition: FWTableWidget.h:90
virtual void addTo(FWConfiguration &) const
void FWTableView::columnSelected ( Int_t  iCol,
Int_t  iButton,
Int_t  iKeyMod 
)

Definition at line 578 of file FWTableView.cc.

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

579 {
580  if (iButton == 1 || iButton == 3)
581  m_currentColumn = iCol;
582  // update contents of the column editor
583  if (m_currentColumn >= 0 &&
587  m_column_name_field->SetText(entry.name.c_str());
588  m_column_expr_field->SetText(entry.expression.c_str());
589  m_column_prec_field->SetText(Form("%d", entry.precision));
590  } else {
591  m_column_name_field->SetText("");
592  m_column_expr_field->SetText("");
593  m_column_prec_field->SetText("");
594  }
595 }
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:99
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
TGTextEntry * m_column_name_field
Definition: FWTableView.h:96
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
int m_currentColumn
Definition: FWTableView.h:100
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:97
void FWTableView::dataChanged ( )

Definition at line 515 of file FWTableView.cc.

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

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

516 {
517 // const FWEventItem *item = m_manager->items()[m_iColl];
520 // std::vector<FWExpressionEvaluator> &ev = m_evaluators;
521 // for (unsigned int i = 0; i < item->size(); ++i) {
522 // for (unsigned int j = 0; j < ev.size(); ++j) {
523 // printf("%s = %f\t", (*m_manager->tableFormats(item->modelType()->GetName())).second[j].name.c_str(),
524 // ev[j].evalExpression(item->modelData(i)));
525 // }
526 // printf("\n");
527 // }
528 // fflush(stdout);
529 }
void updateEvaluators()
Definition: FWTableView.cc:503
void dataChanged()
Called if mouse button pressed in Row Header, defaults is to do nothing.
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void FWTableView::deleteColumn ( )

Definition at line 623 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.

624 {
625  if (m_currentColumn >= 0 &&
629  m_column_name_field->SetText("");
630  m_column_expr_field->SetText("");
631  m_column_prec_field->SetText("");
632  m_currentColumn = -1;
633  }
634  // change needs to be propagated to all tables, because all
635  // tables displaying objects of this type are affected
636  // MT -- this is NOT true!!! FIX
639 }
FWTableViewManager * m_manager
Definition: FWTableView.h:91
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:99
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void forceLayout()
Definition: FWTableWidget.h:84
TGTextEntry * m_column_name_field
Definition: FWTableView.h:96
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
int m_currentColumn
Definition: FWTableView.h:100
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:97
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 564 of file FWTableView.cc.

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

565 {
566  if(iKeyMod & kKeyControlMask) {
567  item()->toggleSelect(iRow);
568  } else {
569  FWChangeSentry sentry(*(item()->changeManager()));
571  item()->select(iRow);
572  }
573  if(iButton == kButton3) {
574  openSelectedModelContextMenu_(iGlobalX,iGlobalY);
575  }
576 }
const FWEventItem * item() const
Definition: FWTableView.cc:508
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:133
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:274
void select(int iIndex) const
Definition: FWEventItem.cc:260
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:57
void FWTableView::modifyColumn ( )

Definition at line 641 of file FWTableView.cc.

References FWTableViewManager::dataChanged(), FWTableWidget::forceLayout(), fwLog, 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, and mergeVDriftHistosByStation::name.

642 {
643  std::string name = m_column_name_field->GetText();
644  std::string expr = m_column_expr_field->GetText();
645  // convert the precision to a long int
646  char *endptr = 0;
647  int prec = (int) strtol(m_column_prec_field->GetText(), &endptr, 0);
648  if (name == "" || expr == "" ||
649  m_column_prec_field->GetText() == 0 || *endptr != 0) {
650  fwLog(fwlog::kInfo) << "bad input\n";
651  fflush(stdout);
652  return;
653  }
654  fwLog(fwlog::kInfo) << "modify column "<< name << ": " << expr << ", precision " << prec << std::endl;
655  fflush(stdout);
656 // m_manager->tableFormats(*item->modelType())
657  FWTableViewManager::TableEntry e = { expr, name, prec };
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 }
FWTableViewManager * m_manager
Definition: FWTableView.h:91
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:99
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void forceLayout()
Definition: FWTableWidget.h:84
TGTextEntry * m_column_name_field
Definition: FWTableView.h:96
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
#define fwLog(_level_)
Definition: fwLog.h:51
int m_currentColumn
Definition: FWTableView.h:100
FWGUIValidatingTextEntry * m_column_expr_field
Definition: FWTableView.h:97
const FWTableView& FWTableView::operator= ( const FWTableView )
private
void FWTableView::resetColors ( const class FWColorManager )

Definition at line 313 of file FWTableView.cc.

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

Referenced by FWTableView().

314 {
315  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(manager.background()));
316 // m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(manager.background()));
317 // switch (manager.foreground()) {
318 // case FWColorManager::kBlackIndex:
319 // m_tableWidget->SetHeaderForegroundColor(gVirtualX->GetPixel(kBlack));
320 // break;
321 // default:
322 // m_tableWidget->SetHeaderForegroundColor(0xffffff);
323 // break;
324 // }
325  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(manager.foreground()));
326 // m_tableWidget->dataChanged();
327 }
void SetBackgroundColor(Pixel_t)
void SetLineSeparatorColor(Pixel_t)
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
void FWTableView::saveImageTo ( const std::string &  iName) const
virtual

Implements FWViewBase.

Definition at line 442 of file FWTableView.cc.

443 {
444 // bool succeeded = m_viewer->GetGLViewer()->SavePicture(iName.c_str());
445 // if(!succeeded) {
446 // throw std::runtime_error("Unable to save picture");
447 // }
448 }
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 536 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().

537 {
538 // printf("selected collection %d, ", i_coll);
539  const FWEventItem *item = m_manager->items()[i_coll];
540  assert(0!=item);
541 // printf("%s\n", item->modelType()->GetName());
542  m_iColl = i_coll;
543 // m_validator = new FWExpressionValidator;
544 // m_column_expr_field->setValidator(m_validator);
545  if (m_validator != 0) {
546 // std::cout << "setting validator to " << item->modelType()->GetName() << std::endl;
547  m_validator->setType(ROOT::Reflex::Type::ByTypeInfo(*(item->modelType()->GetTypeInfo())));
548  } else {
549 // std::cout << "can't set null validator\n";
550  }
551  if (not m_useColumnsFromConfig) {
552  if (m_manager->tableFormats(*item->modelType()) == m_manager->m_tableFormats.end()) {
553  fwLog(fwlog::kInfo) << "No table format for objects of this type " << item->modelType()->GetName() << std::endl;
554  m_tableManager->m_tableFormats->clear();
555  } else {
557  }
558  }
559 // columnSelected(-1, 1, 0);
561  dataChanged();
562 }
FWTableViewManager * m_manager
Definition: FWTableView.h:91
FWExpressionValidator * m_validator
Definition: FWTableView.h:98
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void forceLayout()
Definition: FWTableWidget.h:84
U second(std::pair< T, U > const &p)
const Items & items() const
const FWEventItem * item() const
Definition: FWTableView.cc:508
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
#define fwLog(_level_)
Definition: fwLog.h:51
bool m_useColumnsFromConfig
Definition: FWTableView.h:101
const TClass * modelType() const
Definition: FWEventItem.cc:561
void dataChanged()
Definition: FWTableView.cc:515
TableSpecs::iterator tableFormats(const Reflex::Type &key)
void setType(const ROOT::Reflex::Type &)
void FWTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 306 of file FWTableView.cc.

References m_tableWidget, and FWTableWidget::SetBackgroundColor().

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

307 {
308  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(iColor));
309 // m_tableWidget->SetBackgroundColor(TColor::Number2Pixel(iColor));
310 // m_viewer->GetGLViewer()->SetClearColor(iColor);
311 }
void SetBackgroundColor(Pixel_t)
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
void FWTableView::setFrom ( const FWConfiguration iFrom)
virtual

Reimplemented from FWConfigurableParameterizable.

Definition at line 376 of file FWTableView.cc.

References benchmark_cfg::cerr, runEdmFileComparison::collection, FWTableViewManager::items(), kCollection, kDescendingSort, kSortColumn, kTableView, m_collection, m_manager, m_tableManager, m_tableWidget, FWTableViewManager::m_views, main(), FWTableViewTableManager::numberOfColumns(), FWConfigurableParameterizable::setFrom(), FWTableViewManager::setFrom(), FWTableWidget::sort(), python.multivaluedict::sort(), FWConfiguration::value(), FWConfiguration::valueForKey(), and FWConfiguration::version().

377 {
378  if (this == m_manager->m_views.front().get())
379  m_manager->setFrom(iFrom);
380  try {
381  const FWConfiguration *main = iFrom.valueForKey(kTableView);
382  assert(main != 0);
383  // use the columns from the config, not the default columns for
384  // the collection type
385 // m_useColumnsFromConfig = true;
386 // m_tableManager->m_tableFormats->clear();
387 // const FWConfiguration *columns = main->valueForKey(kColumns);
388 // for (FWConfiguration::StringValuesIt it = columns->stringValues()->begin(),
389 // itEnd = columns->stringValues()->end(); it != itEnd; ++it) {
390 // const std::string &name = *it++;
391 // const std::string &expr = *it++;
392 // int prec = atoi(it->c_str());
393 // FWTableViewManager::TableEntry e = { expr, name, prec };
394 // m_tableManager->m_tableFormats->push_back(e);
395 // }
397  const std::string &collectionName = collection->value();
398  // find item
399  for (std::vector<const FWEventItem *>::const_iterator
400  it = m_manager->items().begin(),
401  itEnd = m_manager->items().end();
402  it != itEnd; ++it) {
403  if (*it && (*it)->name() == collectionName) {
404  m_collection->Select(it - m_manager->items().begin(), true);
405  break;
406  }
407  }
408  const FWConfiguration *sortColumn = main->valueForKey(kSortColumn);
409  const FWConfiguration *descendingSort = main->valueForKey(kDescendingSort);
410  if (sortColumn != 0 && descendingSort != 0) {
411  unsigned int sort = sortColumn->version();
412  bool descending = descendingSort->version();
413  if (sort < (( unsigned int) m_tableManager->numberOfColumns()))
414  m_tableWidget->sort(sort, descending);
415  }
416  } catch (...) {
417  // configuration doesn't contain info for the table. Be forgiving.
418  std::cerr << "This configuration file contains tables, but no column information. "
419  "(It is probably old.) Using defaults." << std::endl;
420  }
421 
422 // main.addKeyValue(kCollection, collection);
423 // FWConfiguration columns(1);
424 // for (std::vector<FWTableViewManager::TableEntry>::const_iterator
425 // i = m_tableManager->m_tableFormats->begin(),
426 // iEnd = m_tableManager->m_tableFormats->end();
427 // i != iEnd; ++i) {
428 // columns.addValue(i->name);
429 // columns.addValue(i->expression);
430 // columns.addValue(Form("%d", i->precision));
431 // }
432 // main.addKeyValue(kColumns, columns);
433 // iTo.addKeyValue(kTableView, main);
434 // // take care of parameters
435 // FWConfigurableParameterizable::addTo(iTo);
436 
437  // take care of parameters
439 }
static const std::string kDescendingSort
Definition: FWTableView.cc:200
FWTableViewManager * m_manager
Definition: FWTableView.h:91
void setFrom(const FWConfiguration &)
virtual void setFrom(const FWConfiguration &)
unsigned int version() const
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
virtual int numberOfColumns() const
Number of columns in the table.
int main(int argc, char **argv)
const Items & items() const
void sort(UInt_t iColumn, bool iDescendingSort)
static const std::string kSortColumn
Definition: FWTableView.cc:199
static const std::string kCollection
Definition: FWTableView.cc:197
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
static const std::string kTableView
Definition: FWTableView.cc:196
const std::string & value(unsigned int iIndex=0) const
const FWConfiguration * valueForKey(const std::string &iKey) const
TGComboBox * m_collection
Definition: FWTableView.h:88
void FWTableView::toggleShowHide ( )

Definition at line 451 of file FWTableView.cc.

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

452 {
454  const TGPicture* picture = 0;
455  const TGPicture* down = 0;
456  const TGPicture* disabled = 0;
457  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
458  if (m_showColumnUI) {
459  picture = arrow_down(bgIsBlack);
460  down = arrow_down_disabled(bgIsBlack);
461  disabled = arrow_down_disabled(bgIsBlack);
462  m_vert->ShowFrame(m_column_control);
463  } else {
464  picture = arrow_right(bgIsBlack);
465  down = arrow_right_disabled(bgIsBlack);
466  disabled = arrow_right_disabled(bgIsBlack);
467  m_vert->HideFrame(m_column_control);
468  }
469  m_vert->Layout();
470  m_columnUIButton->swapIcons(picture,down,disabled);
471 }
Color_t background() const
FWTableViewManager * m_manager
Definition: FWTableView.h:91
static const TGPicture * arrow_down(bool iBackgroundIsBlack)
Definition: FWTableView.cc:172
FWColorManager & colorManager() const
TGCompositeFrame * m_column_control
Definition: FWTableView.h:89
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
Definition: FWTableView.cc:150
bool m_showColumnUI
Definition: FWTableView.h:94
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:161
TGCompositeFrame * m_vert
Definition: FWTableView.h:89
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:183
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
FWCustomIconsButton * m_columnUIButton
Definition: FWTableView.h:95
void FWTableView::updateEvaluators ( )

Definition at line 503 of file FWTableView.cc.

References m_tableManager, and FWTableViewTableManager::updateEvaluators().

Referenced by dataChanged().

504 {
506 }
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void FWTableView::updateItems ( void  )

Reconstructs the combo box using the information coming from FWEventItemsManager.

Definition at line 476 of file FWTableView.cc.

References i, getHLTprescales::index, item(), FWTableViewManager::items(), m_collection, m_iColl, m_manager, siStripFEDMonitor_P5_cff::Min, and FWEventItem::name().

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

477 {
478  int selected = m_collection->GetSelected();
479  m_collection->RemoveAll();
480  int index = 0;
481 
482  for (size_t i = 0, e = m_manager->items().size(); i != e; ++i)
483  {
484  const FWEventItem *item = m_manager->items()[i];
485  if (item)
486  m_collection->AddEntry(item->name().c_str(), i);
487 
488  if (m_iColl == index && 0 == item)
489  {
490  //the collection we were showing is now gone
491  m_iColl = -1;
492  selected = -1;
493  }
494  }
495 
496  if (selected != -1 && selected < m_collection->GetNumberOfEntries())
497  m_collection->Select(selected, false);
498 
499  TGListBox *lb = m_collection->GetListBox();
500  lb->SetHeight(TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
501 }
int i
Definition: DBlmapReader.cc:9
FWTableViewManager * m_manager
Definition: FWTableView.h:91
const std::string & name() const
Definition: FWEventItem.cc:500
const Items & items() const
const FWEventItem * item() const
Definition: FWTableView.cc:508
TGComboBox * m_collection
Definition: FWTableView.h:88

Friends And Related Function Documentation

friend class FWTableViewTableManager
friend

Definition at line 52 of file FWTableView.h.

Member Data Documentation

TGComboBox* FWTableView::m_collection
protected

Definition at line 88 of file FWTableView.h.

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

TGCompositeFrame * FWTableView::m_column_control
protected

Definition at line 89 of file FWTableView.h.

Referenced by FWTableView(), and toggleShowHide().

FWGUIValidatingTextEntry* FWTableView::m_column_expr_field
protected

Definition at line 97 of file FWTableView.h.

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

TGTextEntry* FWTableView::m_column_name_field
protected

Definition at line 96 of file FWTableView.h.

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

TGTextEntry* FWTableView::m_column_prec_field
protected

Definition at line 99 of file FWTableView.h.

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

FWCustomIconsButton* FWTableView::m_columnUIButton
protected

Definition at line 95 of file FWTableView.h.

Referenced by FWTableView(), and toggleShowHide().

int FWTableView::m_currentColumn
protected

Definition at line 100 of file FWTableView.h.

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

TEveWindowFrame* FWTableView::m_eveWindow
protected

Definition at line 87 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 94 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 101 of file FWTableView.h.

Referenced by selectCollection().

FWExpressionValidator* FWTableView::m_validator
protected

Definition at line 98 of file FWTableView.h.

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

TGCompositeFrame* FWTableView::m_vert
protected

Definition at line 89 of file FWTableView.h.

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