CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

FWTableManagerBase Class Reference

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

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

List of all members.

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.
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
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const =0
 ClassDef (FWTableManagerBase, 0)
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
 FWTableManagerBase ()
virtual std::vector< std::string > getTitles () const =0
 returns the title names for each column
virtual bool hasLabelHeaders () const
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false.
virtual std::vector< unsigned int > maxWidthForColumns () const
 for each column in the table this returns the present maximum width for that column
virtual int numberOfColumns () const =0
 Number of columns in the table.
virtual int numberOfRows () const =0
 Number of rows in the table.
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber.
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'.
int sortColumn (void)
 The current sort column.
bool sortOrder (void)
 The current sort order for the table.
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
void visualPropertiesChanged ()
 Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes.
virtual ~FWTableManagerBase ()

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

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 45 of file FWTableManagerBase.h.


Constructor & Destructor Documentation

FWTableManagerBase::FWTableManagerBase ( )

Definition at line 32 of file FWTableManagerBase.cc.

                                      :
m_sortColumn(-1),
m_sortOrder(false)
{
}
FWTableManagerBase::~FWTableManagerBase ( ) [virtual]

Definition at line 43 of file FWTableManagerBase.cc.

{
}

Member Function Documentation

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 138 of file FWTableManagerBase.cc.

{
}
void FWTableManagerBase::buttonReleasedInRowHeader ( Int_t  row,
Event_t *  event,
Int_t  relX,
Int_t  relY 
) [virtual]
virtual bool FWTableManagerBase::cellDataIsSortable ( ) const [inline, virtual]

Reimplemented in FWGeometryTableManagerBase.

Definition at line 84 of file FWTableManagerBase.h.

References funct::true.

Referenced by FWTableWidget::FWTableWidget().

{ return true ; } 
unsigned int FWTableManagerBase::cellHeight ( ) const [virtual]

require all cells to be the same height

Definition at line 89 of file FWTableManagerBase.cc.

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

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

{
   FWTableCellRendererBase* cr = cellRenderer(0,0);
   if(cr) {
      return cr->height();
   }
   if(hasRowHeaders()) {
      cr = rowHeader(0);
      if(cr) {
         return cr->height();
      }
   }
   return 0;
}
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 FWTableViewTableManager, FWTriggerTableViewTableManager, FWCollectionSummaryTableManager, FWGeometryTableManager, DataAdderTableManager, FWOverlapTableManager, FWPSetTableManager, FWAdapterHeaderTableManager, and FWAdapterRowHeaderTableManager.

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

FWTableManagerBase::ClassDef ( FWTableManagerBase  ,
 
)
void FWTableManagerBase::dataChanged ( void  )
virtual std::vector<std::string> FWTableManagerBase::getTitles ( ) const [pure virtual]
bool FWTableManagerBase::hasLabelHeaders ( ) const [virtual]

Definition at line 123 of file FWTableManagerBase.cc.

{
   return true;
}
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 128 of file FWTableManagerBase.cc.

Referenced by cellHeight().

{
   return false;
}
virtual void FWTableManagerBase::implSort ( int  iCol,
bool  iSortOrder 
) [protected, pure virtual]

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

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

Referenced by dataChanged(), and sort().

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 104 of file FWTableManagerBase.cc.

References cellRenderer(), max(), numberOfColumns(), numberOfRows(), tablePrinter::width, and FWTableCellRendererBase::width().

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

{
   std::vector<unsigned int> returnValue;
   returnValue.reserve(numberOfColumns());
   const int numCols= numberOfColumns();
   const int numRows = numberOfRows();
   for(int col = 0; col < numCols; ++col) {
      unsigned int max = 0;
      for(int row=0; row < numRows; ++row) {
         unsigned int width = cellRenderer(row,col)->width();
         if(width > max) {
            max = width;
         }
      }
      returnValue.push_back(max);
   }
   return returnValue;
}
virtual int FWTableManagerBase::numberOfColumns ( ) const [pure virtual]
virtual int FWTableManagerBase::numberOfRows ( ) const [pure virtual]
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 132 of file FWTableManagerBase.cc.

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

{
   return 0;
}
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 63 of file FWTableManagerBase.cc.

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

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

int FWTableManagerBase::sortColumn ( void  ) [inline]

The current sort column.

Definition at line 109 of file FWTableManagerBase.h.

References m_sortColumn.

{ return m_sortColumn; }
bool FWTableManagerBase::sortOrder ( void  ) [inline]

The current sort order for the table.

Definition at line 106 of file FWTableManagerBase.h.

References m_sortOrder.

Referenced by DataAdderTableManager::implSort(), FWAdapterHeaderTableManager::implSort(), sort(), and DataAdderTableManager::sortWithFilter().

{ return m_sortOrder; }
virtual int FWTableManagerBase::unsortedRowNumber ( int  iSortedRowNumber) const [pure virtual]
void FWTableManagerBase::visualPropertiesChanged ( )

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

Definition at line 81 of file FWTableManagerBase.cc.

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

{
   Emit("visualPropertiesChanged()");
}

Member Data Documentation

Definition at line 121 of file FWTableManagerBase.h.

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

Definition at line 122 of file FWTableManagerBase.h.

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