CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Friends

FWTriggerTableViewTableManager Class Reference

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

Inheritance diagram for FWTriggerTableViewTableManager:
FWTableManagerBase

List of all members.

Public Member Functions

virtual FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
 FWTriggerTableViewTableManager (const FWTriggerTableView *)
virtual std::vector< std::string > getTitles () const
 returns the title names for each column
virtual int numberOfColumns () const
 Number of columns in the table.
virtual int numberOfRows () const
 Number of rows in the table.
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 ~FWTriggerTableViewTableManager ()

Protected Member Functions

virtual void implSort (int iCol, bool iSortOrder)

Protected Attributes

TGGC * m_graphicsContext
FWTextTableCellRendererm_renderer
std::vector< int > m_sortedToUnsortedIndices
const FWTriggerTableViewm_view

Friends

class FWTriggerTableView

Detailed Description

Definition at line 32 of file FWTriggerTableViewTableManager.h.


Constructor & Destructor Documentation

FWTriggerTableViewTableManager::FWTriggerTableViewTableManager ( const FWTriggerTableView view)

Definition at line 9 of file FWTriggerTableViewTableManager.cc.

References m_graphicsContext, m_renderer, FWTriggerTableView::m_tableWidget, and m_view.

   : m_view(view),
     m_graphicsContext(0),
     m_renderer(0)
{
   GCValues_t gc = *(m_view->m_tableWidget->GetWhiteGC().GetAttributes());
   m_graphicsContext = gClient->GetResourcePool()->GetGCPool()->GetGC(&gc,kTRUE);
   m_renderer = new FWTextTableCellRenderer(m_graphicsContext,m_graphicsContext);
}
FWTriggerTableViewTableManager::~FWTriggerTableViewTableManager ( ) [virtual]

Definition at line 19 of file FWTriggerTableViewTableManager.cc.

References m_renderer.

{
   delete m_renderer;
}

Member Function Documentation

FWTableCellRendererBase * FWTriggerTableViewTableManager::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 60 of file FWTriggerTableViewTableManager.cc.

References FWTriggerTableView::backgroundColor(), FWTriggerTableView::m_columns, m_graphicsContext, m_renderer, m_view, FWTextTableCellRenderer::setData(), and unsortedRowNumber().

{
   const int realRowNumber = unsortedRowNumber(iSortedRowNumber);
   const int acceptColumn = 1;
   if ( !m_view->m_columns.empty() &&
        int(m_view->m_columns.size())>iCol &&
        int(m_view->m_columns.front().values.size())>realRowNumber ) {
      bool accepted = std::string(m_view->m_columns.at(acceptColumn).values.at(realRowNumber)) == "1";
      if ((m_view->backgroundColor() == kBlack) == accepted)
        m_graphicsContext->SetForeground(0xe0e0e0);
      else
        m_graphicsContext->SetForeground(0x404040);
      m_renderer->setData(m_view->m_columns.at(iCol).values.at(realRowNumber), false);
   } else {
      m_renderer->setData("invalid", false);
   }
   return m_renderer;
}
void FWTriggerTableViewTableManager::dataChanged ( void  )

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

Reimplemented from FWTableManagerBase.

Definition at line 81 of file FWTriggerTableViewTableManager.cc.

References i, m_sortedToUnsortedIndices, and numberOfRows().

Referenced by FWTriggerTableView::dataChanged(), and FWHLTTriggerTableView::fillTable().

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

returns the title names for each column

Implements FWTableManagerBase.

Definition at line 40 of file FWTriggerTableViewTableManager.cc.

References i, FWTriggerTableView::m_columns, m_view, n, numberOfColumns(), and runTheMatrix::ret.

{
   unsigned int n = numberOfColumns();
   std::vector<std::string> ret;
   ret.reserve(n);
   for (unsigned int i = 0; i < n; ++i) {
      ret.push_back(m_view->m_columns.at(i).title);
   }
   return ret;
}
void FWTriggerTableViewTableManager::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 112 of file FWTriggerTableViewTableManager.cc.

References FWTriggerTableView::m_columns, m_sortedToUnsortedIndices, and m_view.

{
   if(sortOrder) {
      std::multimap<std::string,int,std::greater<std::string> > ordered;
      doSort(col, m_view->m_columns, ordered, m_sortedToUnsortedIndices);
   } else {
      std::multimap<std::string,int> ordered;
      doSort(col, m_view->m_columns, ordered, m_sortedToUnsortedIndices);
   }
}
int FWTriggerTableViewTableManager::numberOfColumns ( ) const [virtual]

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 34 of file FWTriggerTableViewTableManager.cc.

References FWTriggerTableView::m_columns, and m_view.

Referenced by getTitles(), and FWTriggerTableView::setFrom().

{
   return m_view->m_columns.size();
}
int FWTriggerTableViewTableManager::numberOfRows ( ) const [virtual]

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 25 of file FWTriggerTableViewTableManager.cc.

References FWTriggerTableView::m_columns, and m_view.

Referenced by dataChanged().

{
   if ( !m_view->m_columns.empty() )
      return m_view->m_columns.front().values.size();
   else
      return 0;
}
int FWTriggerTableViewTableManager::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 52 of file FWTriggerTableViewTableManager.cc.

References m_sortedToUnsortedIndices.

Referenced by cellRenderer().

{
   if (iSortedRowNumber >= (int)m_sortedToUnsortedIndices.size())
      return 0;
   return m_sortedToUnsortedIndices[iSortedRowNumber];
}

Friends And Related Function Documentation

friend class FWTriggerTableView [friend]

Definition at line 33 of file FWTriggerTableViewTableManager.h.


Member Data Documentation

Definition at line 52 of file FWTriggerTableViewTableManager.h.

Referenced by dataChanged(), implSort(), and unsortedRowNumber().