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 206 of file FWTableView.cc.

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

208  m_iColl(-1),
209  m_manager(manager),
211  m_tableWidget(0),
212  m_showColumnUI(false),
214  m_currentColumn(-1),
216 
217 {
218  m_eveWindow = iParent->MakeFrame(0);
219  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
220 // TGHorizontalFrame *buttons = new TGHorizontalFrame(frame);
221 // frame->AddFrame(buttons, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
222 
223 // m_collection = new TGComboBox(buttons);
224  m_vert = new TGVerticalFrame(frame);
225  frame->AddFrame(m_vert, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
226  TGHorizontalFrame *header = new TGHorizontalFrame(m_vert);
227  m_vert->AddFrame(header, new TGLayoutHints(kLHintsTop | kLHintsExpandX));
228  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
230  arrow_right(bgIsBlack),
231  arrow_right_disabled(bgIsBlack),
232  arrow_right_disabled(bgIsBlack));
233  m_columnUIButton->Connect("Clicked()", "FWTableView", this, "toggleShowHide()");
234  header->AddFrame(m_columnUIButton, new TGLayoutHints(kLHintsCenterY | kLHintsLeft,6,10));
235 
236  TGCompositeFrame *labfr = new TGHorizontalFrame(header, 60, 25, kFixedSize);
237  TGLabel *label = new TGLabel(labfr, "Collection");
238  labfr->AddFrame(label, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1,3,0,0));
239  header->AddFrame(labfr, new TGLayoutHints(kLHintsLeft));
240 
241  m_collection = new TGComboBox(header);
242  updateItems();
243  header->AddFrame(m_collection, new TGLayoutHints(kLHintsLeft | kLHintsExpandX | kLHintsExpandY));
244  m_collection->Connect("Selected(Int_t)", "FWTableView", this, "selectCollection(Int_t)");
245  m_collection->Select(2, true);
246  m_column_control = new TGVerticalFrame(m_vert);
247  m_vert->AddFrame(m_column_control, new TGLayoutHints(kLHintsExpandX));
248  TGLabel *column_control_label = new TGLabel(m_column_control, "Column editor");
249 // column_control_label->SetBackgroundColor(bgIsBlack ? kBlack : kWhite);
250 // column_control_label->SetForegroundColor(bgIsBlack ? kWhite : kBlack);
251 // column_control_label->SetTextColor(bgIsBlack ? kWhite : kBlack);
252  m_column_control->AddFrame(column_control_label, new TGLayoutHints(kLHintsExpandX));
253  TGHorizontalFrame *column_control_fields = new TGHorizontalFrame(m_column_control);
254  m_column_control->AddFrame(column_control_fields, new TGLayoutHints(kLHintsExpandX));
255  m_column_name_field = new TGTextEntry(column_control_fields);
256  m_column_name_field->SetMaxWidth(10);
257  m_column_expr_field = new FWGUIValidatingTextEntry(column_control_fields);
258 // m_column_expr_field->SetEnabled(kFALSE);
260  m_column_prec_field = new TGTextEntry(column_control_fields);
261  m_column_prec_field->SetMaxWidth(10);
262  TGLabel *name_label = new TGLabel(column_control_fields, "Title");
263  TGLabel *expr_label = new TGLabel(column_control_fields, "Expression");
264  TGLabel *prec_label = new TGLabel(column_control_fields, "Precision");
265  column_control_fields->AddFrame(name_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
266  column_control_fields->AddFrame(m_column_name_field, new TGLayoutHints(kLHintsExpandX));
267  column_control_fields->AddFrame(expr_label, new TGLayoutHints(kLHintsBottom, 1, 1, 2, 2));
268  column_control_fields->AddFrame(m_column_expr_field, new TGLayoutHints(kLHintsExpandX));
269  column_control_fields->AddFrame(prec_label, new TGLayoutHints( kLHintsBottom, 1, 1, 2, 2));
270  column_control_fields->AddFrame(m_column_prec_field, new TGLayoutHints(kLHintsExpandX));
271  TGTextButton *add_button = new TGTextButton(column_control_fields, "Add");
272  TGTextButton *del_button = new TGTextButton(column_control_fields, "Delete");
273  TGTextButton *mod_button = new TGTextButton(column_control_fields, "Modify");
274  add_button->Connect("Clicked()", "FWTableView", this, "addColumn()");
275  del_button->Connect("Clicked()", "FWTableView", this, "deleteColumn()");
276  mod_button->Connect("Clicked()", "FWTableView", this, "modifyColumn()");
277  column_control_fields->AddFrame(add_button, new TGLayoutHints);
278  column_control_fields->AddFrame(del_button, new TGLayoutHints);
279  column_control_fields->AddFrame(mod_button, new TGLayoutHints);
282  m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(kWhite));
283  m_tableWidget->Connect("rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)", "FWTableView",
284  this, "modelSelected(Int_t,Int_t,Int_t,Int_t,Int_t)");
285  m_tableWidget->Connect("columnClicked(Int_t,Int_t,Int_t)", "FWTableView",
286  this, "columnSelected(Int_t,Int_t,Int_t)");
287  m_vert->AddFrame(m_tableWidget, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
288  frame->MapSubwindows();
289  m_vert->HideFrame(m_column_control);
290  frame->Layout();
291  frame->MapWindow();
292 }
Color_t background() const
FWTableViewManager * m_manager
Definition: FWTableView.h:91
TGTextEntry * m_column_prec_field
Definition: FWTableView.h:99
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:151
void updateItems()
Definition: FWTableView.cc:546
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:314
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:162
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 294 of file FWTableView.cc.

References m_eveWindow, m_tableManager, m_validator, and m_vert.

295 {
296  // take out composite frame and delete it directly ( without the timeout)
297  TGCompositeFrame *frame = m_eveWindow->GetGUICompositeFrame();
298  frame->RemoveFrame(m_vert);
299  delete m_vert;
300 
301  m_eveWindow->DestroyWindowAndSlot();
302  delete m_tableManager;
303  delete m_validator;
304 }
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 667 of file FWTableView.cc.

References FWTableViewManager::dataChanged(), alignCSCRings::e, 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.

668 {
669  std::string name = m_column_name_field->GetText();
670  std::string expr = m_column_expr_field->GetText();
671  // convert the precision to a long int
672  char *endptr = 0;
673  int prec = (int) strtol(m_column_prec_field->GetText(), &endptr, 0);
674  if (name == "" || expr == "" ||
675  m_column_prec_field->GetText() == 0 || *endptr != 0) {
676  fwLog(fwlog::kInfo) << "bad input\n";
677  fflush(stdout);
678  return;
679  }
680  fwLog(fwlog::kInfo) << "adding column "<< name << ": " << expr << ", precision " << prec << std::endl;
681  fflush(stdout);
682 // m_manager->tableFormats(*item->modelType())
683  FWTableViewManager::TableEntry e = { expr, name, prec };
684  m_tableManager->m_tableFormats->push_back(e);
685  m_currentColumn = (int)m_tableManager->m_tableFormats->size() + 1;
686  // change needs to be propagated to all tables, because all
687  // tables displaying objects of this type are affected
688  // MT -- this is NOT true!!! FIX
691 }
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 336 of file FWTableView.cc.

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

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

649 {
650  if (iButton == 1 || iButton == 3)
651  m_currentColumn = iCol;
652  // update contents of the column editor
653  if (m_currentColumn >= 0 &&
657  m_column_name_field->SetText(entry.name.c_str());
658  m_column_expr_field->SetText(entry.expression.c_str());
659  m_column_prec_field->SetText(Form("%d", entry.precision));
660  } else {
661  m_column_name_field->SetText("");
662  m_column_expr_field->SetText("");
663  m_column_prec_field->SetText("");
664  }
665 }
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 585 of file FWTableView.cc.

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

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

586 {
587 // const FWEventItem *item = m_manager->items()[m_iColl];
590 // std::vector<FWExpressionEvaluator> &ev = m_evaluators;
591 // for (unsigned int i = 0; i < item->size(); ++i) {
592 // for (unsigned int j = 0; j < ev.size(); ++j) {
593 // printf("%s = %f\t", (*m_manager->tableFormats(item->modelType()->GetName())).second[j].name.c_str(),
594 // ev[j].evalExpression(item->modelData(i)));
595 // }
596 // printf("\n");
597 // }
598 // fflush(stdout);
599 }
void updateEvaluators()
Definition: FWTableView.cc:573
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 693 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.

694 {
695  if (m_currentColumn >= 0 &&
699  m_column_name_field->SetText("");
700  m_column_expr_field->SetText("");
701  m_column_prec_field->SetText("");
702  m_currentColumn = -1;
703  }
704  // change needs to be propagated to all tables, because all
705  // tables displaying objects of this type are affected
706  // MT -- this is NOT true!!! FIX
709 }
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 634 of file FWTableView.cc.

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

635 {
636  if(iKeyMod & kKeyControlMask) {
637  item()->toggleSelect(iRow);
638  } else {
639  FWChangeSentry sentry(*(item()->changeManager()));
641  item()->select(iRow);
642  }
643  if(iButton == kButton3) {
644  openSelectedModelContextMenu_(iGlobalX,iGlobalY);
645  }
646 }
const FWEventItem * item() const
Definition: FWTableView.cc:578
FWSelectionManager * selectionManager() const
Definition: FWEventItem.h:134
void toggleSelect(int iIndex) const
Definition: FWEventItem.cc:265
void select(int iIndex) const
Definition: FWEventItem.cc:251
sigc::signal< void, Int_t, Int_t > openSelectedModelContextMenu_
Definition: FWViewBase.h:57
void FWTableView::modifyColumn ( )

Definition at line 711 of file FWTableView.cc.

References FWTableViewManager::dataChanged(), alignCSCRings::e, 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.

712 {
713  std::string name = m_column_name_field->GetText();
714  std::string expr = m_column_expr_field->GetText();
715  // convert the precision to a long int
716  char *endptr = 0;
717  int prec = (int) strtol(m_column_prec_field->GetText(), &endptr, 0);
718  if (name == "" || expr == "" ||
719  m_column_prec_field->GetText() == 0 || *endptr != 0) {
720  fwLog(fwlog::kInfo) << "bad input\n";
721  fflush(stdout);
722  return;
723  }
724  fwLog(fwlog::kInfo) << "modify column "<< name << ": " << expr << ", precision " << prec << std::endl;
725  fflush(stdout);
726 // m_manager->tableFormats(*item->modelType())
727  FWTableViewManager::TableEntry e = { expr, name, prec };
729  // Change needs to be propagated to all tables, because all
730  // tables displaying objects of this type are affected
731  // MT -- this is NOT true!!! FIX
734 }
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 314 of file FWTableView.cc.

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

Referenced by FWTableView().

315 {
316  m_tableWidget->SetBackgroundColor(gVirtualX->GetPixel(manager.background()));
317 // m_tableWidget->SetHeaderBackgroundColor(gVirtualX->GetPixel(manager.background()));
318 // switch (manager.foreground()) {
319 // case FWColorManager::kBlackIndex:
320 // m_tableWidget->SetHeaderForegroundColor(gVirtualX->GetPixel(kBlack));
321 // break;
322 // default:
323 // m_tableWidget->SetHeaderForegroundColor(0xffffff);
324 // break;
325 // }
326  m_tableWidget->SetLineSeparatorColor(gVirtualX->GetPixel(manager.foreground()));
327 // m_tableWidget->dataChanged();
328 }
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 443 of file FWTableView.cc.

References trackerHits::c, FWTableViewTableManager::cellRenderer(), gather_cfg::cout, FWTextTableCellRenderer::data(), data, cmsPerfStripChart::format, FWTableViewTableManager::m_tableFormats, m_tableManager, FWTableViewTableManager::numberOfColumns(), FWTableViewTableManager::numberOfRows(), alignCSCRings::r, confdb::splitter(), and FWTableViewTableManager::unsortedRowNumber().

444 {
445  TString format;
446  TString data;
447  FWTextTableCellRenderer* textRenderer;
448 
449  // calculate widths
450  int ndheader = TMath::Ceil(TMath::Log10(m_tableManager->numberOfRows()));
451 
452  std::vector<size_t> widths(m_tableManager->numberOfColumns());
453 
454  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
455  widths[c] = m_tableManager->m_tableFormats->at(c).name.size();
456 
457  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
458  {
459  for (int r = 0; r < m_tableManager->numberOfRows(); r++ )
460  {
461  textRenderer = (FWTextTableCellRenderer*) m_tableManager->cellRenderer(r, c); // setup cell renderer
462  size_t ss = textRenderer->data().size();
463  if (widths[c] < ss) widths[c] = ss;
464  }
465  }
466 
467  int rlen = 0;
468  for (size_t c = 0; c < (size_t)m_tableManager->numberOfColumns(); ++c )
469  rlen += widths[c];
470  rlen += (m_tableManager->numberOfColumns() -1 )*3 ;
471  rlen++;
472 
473 
474  // header
475  printf("\n");
476  TString headerFormat;
477  headerFormat.Form("%%%ds",ndheader +3);
478  data.Form(headerFormat, " ");
479  printf("%s", data.Data());
480 
481  int lastCol = m_tableManager->numberOfColumns() -1;
482 
483  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
484  {
485  format.Form("%%%ds", (int)widths[c]);
486  data.Form(format, m_tableManager->m_tableFormats->at(c).name.c_str());
487 
488  if (c == lastCol)
489  printf("%s", data.Data());
490  else
491  printf("%s | ", data.Data());
492  }
493  printf("\n");
494 
495  std::string splitter(rlen, '-');
496  std::cout << splitter << std::endl;
497 
498  // body
499  headerFormat.Form("[%%%dd] ",ndheader );
500  for (int r = 0; r < m_tableManager->numberOfRows(); r++ )
501  {
502  for (int c = 0; c < m_tableManager->numberOfColumns(); ++c )
503  {
504  if (!c) {
505  data.Form(headerFormat, m_tableManager->unsortedRowNumber(r));
506  printf("%s", data.Data());
507  }
508  format.Form("%%%ds", (int)widths[c]);
509  textRenderer = (FWTextTableCellRenderer*) m_tableManager->cellRenderer(r, c); // setup cell renderer
510  data.Form(format, textRenderer->data().c_str());
511  if (c == lastCol)
512  printf("%s", data.Data());
513  else
514  printf("%s | ", data.Data());
515  }
516  printf("\n");
517  }
518 }
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
virtual int unsortedRowNumber(int iSortedRowNumber) const
virtual int numberOfRows() const
Number of rows in the table.
std::vector< FWTableViewManager::TableEntry > * m_tableFormats
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
string format
Some error handling for the usage.
virtual int numberOfColumns() const
Number of columns in the table.
def splitter
Definition: confdb.py:11
const std::string & data()
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple cout
Definition: gather_cfg.py:121
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 606 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().

607 {
608 // printf("selected collection %d, ", i_coll);
609  const FWEventItem *item = m_manager->items()[i_coll];
610  assert(0!=item);
611 // printf("%s\n", item->modelType()->GetName());
612  m_iColl = i_coll;
613 // m_validator = new FWExpressionValidator;
614 // m_column_expr_field->setValidator(m_validator);
615  if (m_validator != 0) {
616 // std::cout << "setting validator to " << item->modelType()->GetName() << std::endl;
617  m_validator->setType(Reflex::Type::ByTypeInfo(*(item->modelType()->GetTypeInfo())));
618  } else {
619 // std::cout << "can't set null validator\n";
620  }
621  if (not m_useColumnsFromConfig) {
622  if (m_manager->tableFormats(*item->modelType()) == m_manager->m_tableFormats.end()) {
623  fwLog(fwlog::kInfo) << "No table format for objects of this type " << item->modelType()->GetName() << std::endl;
624  m_tableManager->m_tableFormats->clear();
625  } else {
627  }
628  }
629 // columnSelected(-1, 1, 0);
631  dataChanged();
632 }
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:578
FWTableWidget * m_tableWidget
Definition: FWTableView.h:93
void setType(const Reflex::Type &)
#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:585
TableSpecs::iterator tableFormats(const Reflex::Type &key)
void FWTableView::setBackgroundColor ( Color_t  iColor)

Definition at line 307 of file FWTableView.cc.

References m_tableWidget, and FWTableWidget::SetBackgroundColor().

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

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

Reimplemented from FWConfigurableParameterizable.

Definition at line 377 of file FWTableView.cc.

References dtNoiseDBValidation_cfg::cerr, runEdmFileComparison::collection, ecaldqm::collectionName, 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().

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

522 {
524  const TGPicture* picture = 0;
525  const TGPicture* down = 0;
526  const TGPicture* disabled = 0;
527  const bool bgIsBlack = m_manager->colorManager().background() == kBlack;
528  if (m_showColumnUI) {
529  picture = arrow_down(bgIsBlack);
530  down = arrow_down_disabled(bgIsBlack);
531  disabled = arrow_down_disabled(bgIsBlack);
532  m_vert->ShowFrame(m_column_control);
533  } else {
534  picture = arrow_right(bgIsBlack);
535  down = arrow_right_disabled(bgIsBlack);
536  disabled = arrow_right_disabled(bgIsBlack);
537  m_vert->HideFrame(m_column_control);
538  }
539  m_vert->Layout();
540  m_columnUIButton->swapIcons(picture,down,disabled);
541 }
Color_t background() const
FWTableViewManager * m_manager
Definition: FWTableView.h:91
static const TGPicture * arrow_down(bool iBackgroundIsBlack)
Definition: FWTableView.cc:173
FWColorManager & colorManager() const
TGCompositeFrame * m_column_control
Definition: FWTableView.h:89
static const TGPicture * arrow_right(bool iBackgroundIsBlack)
Definition: FWTableView.cc:151
bool m_showColumnUI
Definition: FWTableView.h:94
static const TGPicture * arrow_right_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:162
TGCompositeFrame * m_vert
Definition: FWTableView.h:89
static const TGPicture * arrow_down_disabled(bool iBackgroundIsBlack)
Definition: FWTableView.cc:184
void swapIcons(const TGPicture *&iUpIcon, const TGPicture *&iDownIcon, const TGPicture *&iDisabledIcon)
FWCustomIconsButton * m_columnUIButton
Definition: FWTableView.h:95
void FWTableView::updateEvaluators ( )

Definition at line 573 of file FWTableView.cc.

References m_tableManager, and FWTableViewTableManager::updateEvaluators().

Referenced by dataChanged().

574 {
576 }
FWTableViewTableManager * m_tableManager
Definition: FWTableView.h:92
void FWTableView::updateItems ( void  )

Reconstructs the combo box using the information coming from FWEventItemsManager.

Definition at line 546 of file FWTableView.cc.

References alignCSCRings::e, 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().

547 {
548  int selected = m_collection->GetSelected();
549  m_collection->RemoveAll();
550  int index = 0;
551 
552  for (size_t i = 0, e = m_manager->items().size(); i != e; ++i)
553  {
554  const FWEventItem *item = m_manager->items()[i];
555  if (item)
556  m_collection->AddEntry(item->name().c_str(), i);
557 
558  if (m_iColl == index && 0 == item)
559  {
560  //the collection we were showing is now gone
561  m_iColl = -1;
562  selected = -1;
563  }
564  }
565 
566  if (selected != -1 && selected < m_collection->GetNumberOfEntries())
567  m_collection->Select(selected, false);
568 
569  TGListBox *lb = m_collection->GetListBox();
570  lb->SetHeight(TMath::Min(lb->GetNumberOfEntries()*lb->GetItemVsize() + 2*lb->GetBorderWidth(), 200u));
571 }
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:578
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().