CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
FWTableManagerBase Class Referenceabstract

#include <Fireworks/TableWidget/interface/FWTableManagerBase.h>

Inheritance diagram for FWTableManagerBase:
DataAdderTableManager FWAdapterHeaderTableManager FWAdapterRowHeaderTableManager FWCollectionSummaryTableManager FWGeometryTableManagerBase FWPSetTableManager FWTableViewTableManager FWTriggerTableViewTableManager

Public Member Functions

virtual void buttonPressedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 Called if mouse button pressed in Row Header, defaults is to do nothing. More...
 
virtual void buttonReleasedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 
virtual bool cellDataIsSortable () const
 
virtual unsigned int cellHeight () const
 require all cells to be the same height More...
 
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const =0
 
 ClassDefOverride (FWTableManagerBase, 0)
 
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes. More...
 
 FWTableManagerBase ()
 
virtual std::vector< std::string > getTitles () const =0
 returns the title names for each column More...
 
virtual bool hasLabelHeaders () const
 
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false. More...
 
virtual std::vector< unsigned int > maxWidthForColumns () const
 for each column in the table this returns the present maximum width for that column More...
 
virtual int numberOfColumns () const =0
 Number of columns in the table. More...
 
virtual int numberOfRows () const =0
 Number of rows in the table. More...
 
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber. More...
 
void sort (int iCol, bool iSortOrder)
 Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true'. More...
 
int sortColumn (void)
 The current sort column. More...
 
bool sortOrder (void)
 The current sort order for the table. More...
 
virtual int unsortedRowNumber (int iSortedRowNumber) const =0
 when passed the index to the sorted order of the rows it returns the original row number from the underlying data More...
 
void visualPropertiesChanged ()
 Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes. More...
 
 ~FWTableManagerBase () override
 

Protected Member Functions

virtual void implSort (int iCol, bool iSortOrder)=0
 Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'. More...
 

Private Attributes

int m_sortColumn
 
bool m_sortOrder
 

Detailed Description

Description: Base class for classes that work as interfaces that translate underlying data into a table form

Usage: Classes which inherit from FWTableManagerBase are used as adapters to allow external data to be shown in tabular form via the FWTableWidget. The table is made of three parts 1) The column headers: Each column is described by a 'title' and the title is drawn in the column header 2) The body: the actual data of the table laid out in rows and columns 3) the row headers: optional identifier for a row. If given, the row header will always be visible on the screen if any part of the row is visible

The FWTableWidget actually draws the cells in the table by asking the FWTableManagerBase for a FWTableCellRendererBase for a particular cell. The renderer will then be asked to draw the cell into the appropriate part of the graphics window. Therfore it is the FWTableManagerBase's responsibility to create FWTableCellRendererBases which are appropriate for the data to be shown in each cell of the table. See the documentation of FWTableCellRendererBase for further information.

FWTableManagerBase must also be able to sort the rows of data based on the values in a specified column.

Definition at line 44 of file FWTableManagerBase.h.

Constructor & Destructor Documentation

◆ FWTableManagerBase()

FWTableManagerBase::FWTableManagerBase ( )

Definition at line 30 of file FWTableManagerBase.cc.

30 : m_sortColumn(-1), m_sortOrder(false) {}

◆ ~FWTableManagerBase()

FWTableManagerBase::~FWTableManagerBase ( )
override

Definition at line 37 of file FWTableManagerBase.cc.

37 {}

Member Function Documentation

◆ buttonPressedInRowHeader()

void FWTableManagerBase::buttonPressedInRowHeader ( Int_t  row,
Event_t *  event,
Int_t  relX,
Int_t  relY 
)
virtual

Called if mouse button pressed in Row Header, defaults is to do nothing.

Definition at line 112 of file FWTableManagerBase.cc.

112 {}

◆ buttonReleasedInRowHeader()

void FWTableManagerBase::buttonReleasedInRowHeader ( Int_t  row,
Event_t *  event,
Int_t  relX,
Int_t  relY 
)
virtual

◆ cellDataIsSortable()

virtual bool FWTableManagerBase::cellDataIsSortable ( ) const
inlinevirtual

Reimplemented in FWGeometryTableManagerBase, and FWPSetTableManager.

Definition at line 81 of file FWTableManagerBase.h.

81 { return true; }

Referenced by FWTableWidget::FWTableWidget().

◆ cellHeight()

unsigned int FWTableManagerBase::cellHeight ( ) const
virtual

require all cells to be the same height

Definition at line 75 of file FWTableManagerBase.cc.

75  {
77  if (cr) {
78  return cr->height();
79  }
80  if (hasRowHeaders()) {
81  cr = rowHeader(0);
82  if (cr) {
83  return cr->height();
84  }
85  }
86  return 0;
87 }

References cellRenderer(), hasRowHeaders(), FWTableCellRendererBase::height(), and rowHeader().

Referenced by FWTabularWidget::dataChanged(), FWTabularWidget::FWTabularWidget(), FWPSetTableManager::maxWidthForColumns(), and FWPSetTableManager::setSelection().

◆ cellRenderer()

virtual FWTableCellRendererBase* FWTableManagerBase::cellRenderer ( int  iSortedRowNumber,
int  iCol 
) const
pure virtual

Returns the particular renderer used to handle the requested cell. Arguments: iSortedRowNumber: the row number from the present sort (i.e. the cell number of the view) iCol: the column number of the cell. The returned value must be used immediately and not held onto since the same Renderer can be used for subsequent calls

Implemented in DataAdderTableManager, FWPSetTableManager, FWGeometryTableManager, FWOverlapTableManager, FWTableViewTableManager, FWCollectionSummaryTableManager, FWTriggerTableViewTableManager, FWAdapterHeaderTableManager, and FWAdapterRowHeaderTableManager.

Referenced by cellHeight(), FWTabularWidget::DoRedraw(), FWTabularWidget::HandleButton(), and maxWidthForColumns().

◆ ClassDefOverride()

FWTableManagerBase::ClassDefOverride ( FWTableManagerBase  ,
 
)

◆ dataChanged()

void FWTableManagerBase::dataChanged ( void  )

◆ getTitles()

virtual std::vector<std::string> FWTableManagerBase::getTitles ( ) const
pure virtual

◆ hasLabelHeaders()

bool FWTableManagerBase::hasLabelHeaders ( ) const
virtual

Definition at line 107 of file FWTableManagerBase.cc.

107 { return true; }

◆ hasRowHeaders()

bool FWTableManagerBase::hasRowHeaders ( ) const
virtual

Returns 'true' if this table has row headers. Defaults return value is false.

Reimplemented in FWTableViewTableManager, and FWCollectionSummaryTableManager.

Definition at line 109 of file FWTableManagerBase.cc.

109 { return false; }

Referenced by cellHeight().

◆ implSort()

virtual void FWTableManagerBase::implSort ( int  iCol,
bool  iSortOrder 
)
protectedpure virtual

Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.

Implemented in FWGeometryTableManagerBase, FWPSetTableManager, FWTableViewTableManager, FWCollectionSummaryTableManager, FWTriggerTableViewTableManager, DataAdderTableManager, FWAdapterHeaderTableManager, and FWAdapterRowHeaderTableManager.

Referenced by dataChanged(), and sort().

◆ maxWidthForColumns()

std::vector< unsigned int > FWTableManagerBase::maxWidthForColumns ( ) const
virtual

for each column in the table this returns the present maximum width for that column

Reimplemented in FWPSetTableManager.

Definition at line 89 of file FWTableManagerBase.cc.

89  {
90  std::vector<unsigned int> returnValue;
91  returnValue.reserve(numberOfColumns());
92  const int numCols = numberOfColumns();
93  const int numRows = numberOfRows();
94  for (int col = 0; col < numCols; ++col) {
95  unsigned int max = 0;
96  for (int row = 0; row < numRows; ++row) {
97  unsigned int width = cellRenderer(row, col)->width();
98  if (width > max) {
99  max = width;
100  }
101  }
102  returnValue.push_back(max);
103  }
104  return returnValue;
105 }

References cellRenderer(), cuy::col, SiStripPI::max, numberOfColumns(), numberOfRows(), ApeEstimator_cff::width, and FWTableCellRendererBase::width().

Referenced by FWTabularWidget::dataChanged(), FWTabularWidget::FWTabularWidget(), and FWPSetTableManager::maxWidthForColumns().

◆ numberOfColumns()

virtual int FWTableManagerBase::numberOfColumns ( ) const
pure virtual

◆ numberOfRows()

virtual int FWTableManagerBase::numberOfRows ( ) const
pure virtual

◆ rowHeader()

FWTableCellRendererBase * FWTableManagerBase::rowHeader ( int  iSortedRowNumber) const
virtual

Returns the renderer for the row header for the sorted row number iSortedRowNumber.

Reimplemented in FWTableViewTableManager, and FWCollectionSummaryTableManager.

Definition at line 110 of file FWTableManagerBase.cc.

110 { return nullptr; }

Referenced by cellHeight(), and FWAdapterRowHeaderTableManager::cellRenderer().

◆ sort()

void FWTableManagerBase::sort ( int  iCol,
bool  iSortOrder 
)

Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true'.

Definition at line 54 of file FWTableManagerBase.cc.

54  {
55  if (col <= numberOfColumns()) {
56  m_sortColumn = col;
60  }
61 }

References cuy::col, implSort(), m_sortColumn, m_sortOrder, numberOfColumns(), sortOrder(), and visualPropertiesChanged().

Referenced by FWGUIEventDataAdder::metadataUpdatedSlot(), FWTableWidget::sort(), and DataAdderTableManager::sortWithFilter().

◆ sortColumn()

int FWTableManagerBase::sortColumn ( void  )
inline

The current sort column.

Definition at line 105 of file FWTableManagerBase.h.

105 { return m_sortColumn; }

References m_sortColumn.

◆ sortOrder()

bool FWTableManagerBase::sortOrder ( void  )
inline

◆ unsortedRowNumber()

virtual int FWTableManagerBase::unsortedRowNumber ( int  iSortedRowNumber) const
pure virtual

◆ visualPropertiesChanged()

void FWTableManagerBase::visualPropertiesChanged ( )

Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes.

Definition at line 70 of file FWTableManagerBase.cc.

70 { Emit("visualPropertiesChanged()"); }

Referenced by DataAdderTableManager::changeSelection(), FWGeometryTableManagerBase::firstColumnClicked(), FWPSetTableManager::FWPSetTableManager(), FWGeometryTableManagerBase::redrawTable(), FWPSetTableManager::setExpanded(), FWPSetTableManager::setSelection(), and sort().

Member Data Documentation

◆ m_sortColumn

int FWTableManagerBase::m_sortColumn
private

Definition at line 117 of file FWTableManagerBase.h.

Referenced by dataChanged(), sort(), and sortColumn().

◆ m_sortOrder

bool FWTableManagerBase::m_sortOrder
private

Definition at line 118 of file FWTableManagerBase.h.

Referenced by dataChanged(), sort(), and sortOrder().

FWTableManagerBase::cellRenderer
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const =0
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
cuy.col
col
Definition: cuy.py:1010
FWTableCellRendererBase::width
virtual UInt_t width() const =0
returns the minimum width of the cell to which the renderer is representing
FWTableManagerBase::numberOfRows
virtual int numberOfRows() const =0
Number of rows in the table.
FWTableManagerBase::visualPropertiesChanged
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e....
Definition: FWTableManagerBase.cc:70
FWTableManagerBase::hasRowHeaders
virtual bool hasRowHeaders() const
Returns 'true' if this table has row headers. Defaults return value is false.
Definition: FWTableManagerBase.cc:109
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FWTableManagerBase::numberOfColumns
virtual int numberOfColumns() const =0
Number of columns in the table.
FWTableManagerBase::implSort
virtual void implSort(int iCol, bool iSortOrder)=0
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
FWTableCellRendererBase
Definition: FWTableCellRendererBase.h:44
FWTableCellRendererBase::height
virtual UInt_t height() const =0
returns the minimum height of the cell to which the renderer is representing
FWTableManagerBase::sortOrder
bool sortOrder(void)
The current sort order for the table.
Definition: FWTableManagerBase.h:102
FWTableManagerBase::rowHeader
virtual FWTableCellRendererBase * rowHeader(int iSortedRowNumber) const
Returns the renderer for the row header for the sorted row number iSortedRowNumber.
Definition: FWTableManagerBase.cc:110
FWTableManagerBase::m_sortOrder
bool m_sortOrder
Definition: FWTableManagerBase.h:118
FWTableManagerBase::m_sortColumn
int m_sortColumn
Definition: FWTableManagerBase.h:117