CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

FWCollectionSummaryTableManager Class Reference

#include <Fireworks/Core/interface/FWCollectionSummaryTableManager.h>

Inheritance diagram for FWCollectionSummaryTableManager:
FWTableManagerBase

List of all members.

Public Member Functions

virtual void buttonReleasedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const
 FWCollectionSummaryTableManager (FWEventItem *iCollection, const TGGC *iContext, const TGGC *iHighlightContext, FWCollectionSummaryWidget *)
virtual std::vector< std::string > getTitles () const
 returns the title names for each column
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false.
virtual int numberOfColumns () const
 Number of columns in the table.
virtual int numberOfRows () const
 Number of rows in the table.
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber.
virtual int unsortedRowNumber (int iSortedRowNumber) const
 when passed the index to the sorted order of the rows it returns the original row number from the underlying data
virtual ~FWCollectionSummaryTableManager ()

Protected Member Functions

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

Private Member Functions

void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
 FWCollectionSummaryTableManager (const FWCollectionSummaryTableManager &)
const
FWCollectionSummaryTableManager
operator= (const FWCollectionSummaryTableManager &)

Private Attributes

FWTextTableCellRenderer m_bodyRenderer
FWEventItemm_collection
FWCollectionSummaryModelCellRenderer m_renderer
std::vector< int > m_sortedToUnsortedIndicies
FWCollectionSummaryWidgetm_widget

Detailed Description

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

Usage: <usage>

Definition at line 36 of file FWCollectionSummaryTableManager.h.


Constructor & Destructor Documentation

FWCollectionSummaryTableManager::FWCollectionSummaryTableManager ( FWEventItem iCollection,
const TGGC *  iContext,
const TGGC *  iHighlightContext,
FWCollectionSummaryWidget iWidget 
)

Definition at line 36 of file FWCollectionSummaryTableManager.cc.

References FWEventItem::changed_, FWTableManagerBase::dataChanged(), dataChanged(), FWEventItem::itemChanged_, m_collection, and FWEventItem::modelType().

                                                                                                    :
   m_collection(iItem),
   m_renderer(iContext,iHighlightContext),
   m_bodyRenderer(iContext, iHighlightContext, FWTextTableCellRenderer::kJustifyRight),
   m_widget(iWidget)
{
   m_collection->changed_.connect(boost::bind(&FWTableManagerBase::dataChanged,this));
   m_collection->itemChanged_.connect(boost::bind(&FWCollectionSummaryTableManager::dataChanged,this));
   
   //try to find the default columns
   std::vector<std::pair<std::string,std::string> > s_names;
   ROOT::Reflex::Type type = ROOT::Reflex::Type::ByTypeInfo(*(m_collection->modelType()->GetTypeInfo()));

   
   dataChanged();
}
FWCollectionSummaryTableManager::~FWCollectionSummaryTableManager ( ) [virtual]

Definition at line 59 of file FWCollectionSummaryTableManager.cc.

{
}
FWCollectionSummaryTableManager::FWCollectionSummaryTableManager ( const FWCollectionSummaryTableManager ) [private]

Member Function Documentation

void FWCollectionSummaryTableManager::buttonReleasedInRowHeader ( Int_t  row,
Event_t *  event,
Int_t  relX,
Int_t  relY 
) [virtual]
FWTableCellRendererBase * FWCollectionSummaryTableManager::cellRenderer ( int  iSortedRowNumber,
int  iCol 
) const [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

Implements FWTableManagerBase.

Definition at line 160 of file FWCollectionSummaryTableManager.cc.

References getHLTprescales::index, m_bodyRenderer, m_collection, m_sortedToUnsortedIndicies, FWEventItem::modelData(), FWEventItem::modelInfo(), FWItemValueGetter::numValues(), FWItemValueGetter::precision(), alignCSCRings::s, FWTextTableCellRenderer::setData(), FWEventItem::size(), v, FWItemValueGetter::valueFor(), and FWEventItem::valueGetter().

{
   if(!m_collection->valueGetter().numValues()) {
      return 0;
   }
   if(iSortedRowNumber >= static_cast<int>(m_collection->size())) {
      m_bodyRenderer.setData("",false);
      return &m_bodyRenderer;
   }
   int index = m_sortedToUnsortedIndicies[iSortedRowNumber];
   std::stringstream s;
   s.setf(std::ios_base::fixed,std::ios_base::floatfield);
   s.precision( m_collection->valueGetter().precision(iCol));
   double v = m_collection->valueGetter().valueFor(m_collection->modelData(index), iCol);
   s <<v;
   m_bodyRenderer.setData(s.str(), m_collection->modelInfo(index).isSelected());
   return &m_bodyRenderer;
}
void FWCollectionSummaryTableManager::dataChanged ( void  ) [private]

Classes which inherit from FWTableManagerBase must call this when their underlying data changes.

Reimplemented from FWTableManagerBase.

Definition at line 198 of file FWCollectionSummaryTableManager.cc.

References i, m_collection, m_sortedToUnsortedIndicies, and FWEventItem::size().

Referenced by FWCollectionSummaryTableManager().

std::vector< std::string > FWCollectionSummaryTableManager::getTitles ( ) const [virtual]

returns the title names for each column

Implements FWTableManagerBase.

Definition at line 145 of file FWCollectionSummaryTableManager.cc.

References FWItemValueGetter::getTitles(), m_collection, and FWEventItem::valueGetter().

                                                 {



   //return titles;
      return  m_collection->valueGetter().getTitles();
}
bool FWCollectionSummaryTableManager::hasRowHeaders ( ) const [virtual]

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

Reimplemented from FWTableManagerBase.

Definition at line 180 of file FWCollectionSummaryTableManager.cc.

{
   return true;
}
void FWCollectionSummaryTableManager::implSort ( int  iCol,
bool  iSortOrder 
) [protected, virtual]

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

Implements FWTableManagerBase.

Definition at line 99 of file FWCollectionSummaryTableManager.cc.

References m_collection, m_sortedToUnsortedIndicies, alignCSCRings::s, and FWEventItem::valueGetter().

{
   if(iSortOrder) {
      std::multimap<double,int, std::greater<double> > s;
      doSort(*m_collection, m_collection->valueGetter(), iCol, s, m_sortedToUnsortedIndicies);
   } else {
      std::multimap<double,int, std::less<double> > s;
      doSort(*m_collection, m_collection->valueGetter(), iCol, s, m_sortedToUnsortedIndicies);
   }
}
int FWCollectionSummaryTableManager::numberOfColumns ( ) const [virtual]

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 140 of file FWCollectionSummaryTableManager.cc.

References m_collection, FWItemValueGetter::numValues(), and FWEventItem::valueGetter().

int FWCollectionSummaryTableManager::numberOfRows ( ) const [virtual]

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 134 of file FWCollectionSummaryTableManager.cc.

References m_collection, and FWEventItem::size().

{
   return m_collection->size();
}
const FWCollectionSummaryTableManager& FWCollectionSummaryTableManager::operator= ( const FWCollectionSummaryTableManager ) [private]
FWTableCellRendererBase * FWCollectionSummaryTableManager::rowHeader ( int  iSortedRowNumber) const [virtual]

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

Reimplemented from FWTableManagerBase.

Definition at line 186 of file FWCollectionSummaryTableManager.cc.

References getHLTprescales::index, m_collection, m_renderer, m_sortedToUnsortedIndicies, FWCollectionSummaryModelCellRenderer::setData(), and FWEventItem::size().

{
   if(iSortedRowNumber >= static_cast<int>(m_collection->size())) {
      return 0;
   }
   int index = m_sortedToUnsortedIndicies[iSortedRowNumber];
   m_renderer.setData(m_collection,
                      index);
   return &m_renderer;
}
int FWCollectionSummaryTableManager::unsortedRowNumber ( int  iSortedRowNumber) const [virtual]

when passed the index to the sorted order of the rows it returns the original row number from the underlying data

Implements FWTableManagerBase.

Definition at line 154 of file FWCollectionSummaryTableManager.cc.

References m_sortedToUnsortedIndicies.

Referenced by buttonReleasedInRowHeader().

{
   return m_sortedToUnsortedIndicies[iSortedRowNumber];
}

Member Data Documentation

Definition at line 71 of file FWCollectionSummaryTableManager.h.

Referenced by cellRenderer().

Definition at line 70 of file FWCollectionSummaryTableManager.h.

Referenced by buttonReleasedInRowHeader(), and rowHeader().

Definition at line 72 of file FWCollectionSummaryTableManager.h.

Referenced by buttonReleasedInRowHeader().