CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/Fireworks/TableWidget/src/FWAdapterHeaderTableManager.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     TableWidget
00004 // Class  :     FWAdapterHeaderTableManager
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Mon Feb  2 16:44:45 EST 2009
00011 // $Id: FWAdapterHeaderTableManager.cc,v 1.3 2012/02/22 00:15:44 amraktad Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "Fireworks/TableWidget/src/FWAdapterHeaderTableManager.h"
00018 #include "Fireworks/TableWidget/interface/FWColumnLabelCellRenderer.h"
00019 //
00020 // constants, enums and typedefs
00021 //
00022 
00023 //
00024 // static data member definitions
00025 //
00026 
00027 //
00028 // constructors and destructor
00029 //
00030 FWAdapterHeaderTableManager::FWAdapterHeaderTableManager(const FWTableManagerBase* iTable) :
00031 m_table(iTable), 
00032 m_renderer(new FWColumnLabelCellRenderer(&(FWTextTableCellRenderer::getDefaultGC()), iTable->cellDataIsSortable())), 
00033 m_sortedColumn(-1),
00034 m_descendingSort(true) 
00035 {}
00036 
00037 // FWAdapterHeaderTableManager::FWAdapterHeaderTableManager(const FWAdapterHeaderTableManager& rhs)
00038 // {
00039 //    // do actual copying here;
00040 // }
00041 
00042 FWAdapterHeaderTableManager::~FWAdapterHeaderTableManager()
00043 {
00044 }
00045 
00046 //
00047 // assignment operators
00048 //
00049 // const FWAdapterHeaderTableManager& FWAdapterHeaderTableManager::operator=(const FWAdapterHeaderTableManager& rhs)
00050 // {
00051 //   //An exception safe implementation is
00052 //   FWAdapterHeaderTableManager temp(rhs);
00053 //   swap(rhs);
00054 //
00055 //   return *this;
00056 // }
00057 
00058 //
00059 // member functions
00060 //
00061 void 
00062 FWAdapterHeaderTableManager::implSort(int col, bool sortOrder) 
00063 { 
00064    m_sortedColumn=col;
00065    m_descendingSort=sortOrder;
00066 }
00067 
00068 //
00069 // const member functions
00070 //
00071 int 
00072 FWAdapterHeaderTableManager::numberOfRows() const { return 1;}
00073 
00074 int 
00075 FWAdapterHeaderTableManager::numberOfColumns() const { return m_table->numberOfColumns();}
00076 
00077 int 
00078 FWAdapterHeaderTableManager::unsortedRowNumber(int iRow) const
00079 {
00080    return iRow;
00081 }
00082 
00083 
00084 std::vector<std::string> 
00085 FWAdapterHeaderTableManager::getTitles() const {
00086    return m_table->getTitles();
00087 }
00088 
00089 FWTableCellRendererBase* 
00090 FWAdapterHeaderTableManager::cellRenderer(int /*iRow*/, int iCol) const
00091 {
00092    if(iCol==m_sortedColumn) {
00093       if(m_descendingSort) {
00094          m_renderer->setSortOrder(fireworks::table::kDescendingSort);         
00095       } else {
00096          m_renderer->setSortOrder(fireworks::table::kAscendingSort);         
00097       }
00098    } else {
00099       m_renderer->setSortOrder(fireworks::table::kNotSorted);
00100    }
00101    if(iCol < m_table->numberOfColumns()) {
00102       m_renderer->setData( *(getTitles().begin()+iCol),false );
00103    } else {
00104       m_renderer->setData("",false);
00105    }
00106    return m_renderer;
00107 }
00108 
00109 //
00110 // static member functions
00111 //