#include <Fireworks/FWInterface/interface/FWPSetTableManager.h>
Classes | |
struct | ModuleInfo |
struct | PathInfo |
struct | PathUpdate |
struct | PSetData |
Public Member Functions | |
virtual FWTableCellRendererBase * | cellRenderer (int iSortedRowNumber, int iCol) const |
std::vector< PSetData > & | data () |
FWPSetTableManager () | |
virtual std::vector< std::string > | getTitles () const |
returns the title names for each column | |
virtual void | implSort (int, bool) |
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'. | |
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 |
Number of columns in the table. | |
virtual int | numberOfRows () const |
Number of rows in the table. | |
virtual bool | rowIsSelected (int row) const |
std::vector< int > & | rowToIndex () |
int | selectedColumn () const |
int | selectedRow () const |
virtual const std::string | title () const |
virtual int | unsortedRowNumber (int unsorted) const |
when passed the index to the sorted order of the rows it returns the original row number from the underlying data | |
virtual void | updateFilter (const char *filter) |
virtual | ~FWPSetTableManager () |
Protected Member Functions | |
bool | applyEditor () |
void | cancelEditor () |
std::vector< PSetData > & | entries () |
std::vector< ModuleInfo > & | modules () |
void | setExpanded (int row) |
void | setSelection (int row, int column, int mask) |
void | update (std::vector< PathUpdate > &pathUpdates) |
void | updateSchedule (const edm::ScheduleInfo *info) |
Private Member Functions | |
template<class T > | |
void | createScalarString (PSetData &data, T v) |
template<typename T > | |
void | createVectorString (FWPSetTableManager::PSetData &data, const T &v, bool quotes) |
FWPSetTableManager (const FWPSetTableManager &) | |
void | handleEntry (const edm::Entry &entry, const std::string &key) |
void | handlePSet (const edm::ParameterSet &ps) |
void | handlePSetEntry (const edm::ParameterSetEntry &entry, const std::string &key) |
void | handleVPSetEntry (const edm::VParameterSetEntry &entry, const std::string &key) |
const FWPSetTableManager & | operator= (const FWPSetTableManager &) |
void | recalculateVisibility () |
void | setCellValueEditor (FWPSetCellEditor *editor) |
Private Attributes | |
std::vector< std::string > | m_availablePaths |
FWPSetCellEditor * | m_editor |
std::vector< PSetData > | m_entries |
std::string | m_filter |
std::vector< ModuleInfo > | m_modules |
std::vector< size_t > | m_parentStack |
std::map< std::string, size_t > | m_pathIndex |
std::vector< PathInfo > | m_paths |
FWTextTreeCellRenderer | m_renderer |
std::vector< int > | m_row_to_index |
int | m_selectedColumn |
int | m_selectedRow |
Friends | |
class | FWPathsPopup |
Description: [one line class summary]
Usage: <usage>
Definition at line 38 of file FWPSetTableManager.h.
FWPSetTableManager::FWPSetTableManager | ( | ) |
Definition at line 91 of file FWPSetTableManager.cc.
References FWTextTableCellRenderer::getDefaultHighlightGC(), m_renderer, recalculateVisibility(), FWTextTableCellRenderer::setHighlightContext(), and FWTableManagerBase::visualPropertiesChanged().
: m_selectedRow(-1) { TGGC* hc = new TGGC(FWTextTableCellRenderer::getDefaultHighlightGC()); hc->SetForeground(0xdddddd); m_renderer.setHighlightContext(hc); recalculateVisibility(); visualPropertiesChanged(); }
FWPSetTableManager::~FWPSetTableManager | ( | ) | [virtual] |
Definition at line 104 of file FWPSetTableManager.cc.
{ }
FWPSetTableManager::FWPSetTableManager | ( | const FWPSetTableManager & | ) | [private] |
bool FWPSetTableManager::applyEditor | ( | ) | [protected] |
This is invoked every single time the editor contents must be applied to the selected entry in the pset.
Definition at line 567 of file FWPSetTableManager.cc.
References FWPSetCellEditor::apply(), data(), ExpressReco_HICollisions_FallBack::e, m_editor, m_entries, m_modules, m_row_to_index, m_selectedColumn, m_selectedRow, FWPSetTableManager::PSetData::module, dbtoconf::parent, FWPSetTableManager::PSetData::parent, setSelection(), summarizeEdmComparisonLogfiles::success, and FWPSetTableManager::PSetData::value.
Referenced by FWPathsPopup::applyEditor(), and FWPathsPopup::updateFilterString().
{ if (!m_editor) return false; if (m_selectedRow == -1 ||m_selectedColumn != 1 ) return false; // printf("FWPSetTableManager::applyEditor() \n"); PSetData &data = m_entries[m_row_to_index[m_selectedRow]]; PSetData &parent = m_entries[data.parent]; bool success = false; try { success = m_editor->apply(data, parent); if (success) { data.value = m_editor->GetText(); m_modules[data.module].dirty = true; setSelection(-1, -1, 0); m_editor->UnmapWindow(); } } catch(cms::Exception &e) { m_editor->SetForegroundColor(gVirtualX->GetPixel(kRed)); } return success; }
void FWPSetTableManager::cancelEditor | ( | ) | [protected] |
Does not apply changes and closes window.
Definition at line 553 of file FWPSetTableManager.cc.
References m_editor, and setSelection().
Referenced by FWPathsPopup::HandleKey().
{ if (!m_editor) return; // printf("FWPSetTableManager::cancelEditor() \n"); setSelection(-1, -1, 0); m_editor->UnmapWindow(); }
FWTableCellRendererBase * FWPSetTableManager::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 717 of file FWPSetTableManager.cc.
References fireworks::boldGC(), FWPSetTableManager::PSetData::childMatches, data(), FWPSetTableManager::PSetData::editable, FWPSetTableManager::PSetData::expandedFilter, FWPSetTableManager::PSetData::expandedUser, fwLog, FWTextTableCellRenderer::getDefaultGC(), cmsRelvalreport::green(), FWTextTreeCellRenderer::iconWidth(), tablePrinter::indent(), fireworks::italicGC(), fwlog::kWarning, label, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_entries, m_filter, m_modules, m_paths, m_renderer, m_row_to_index, m_selectedColumn, m_selectedRow, FWPSetTableManager::PSetData::matches, reco_skim_cfg_mod::maxSize, FWPSetTableManager::PSetData::module, FWPSetTableManager::PathInfo::passed, FWPSetTableManager::ModuleInfo::passed, FWPSetTableManager::PSetData::path, path(), cmsRelvalreport::red(), FWTextTableCellRenderer::setData(), FWTextTableCellRenderer::setGraphicsContext(), FWTextTreeCellRenderer::setIndentation(), FWTextTreeCellRenderer::setIsOpen(), FWTextTreeCellRenderer::setIsParent(), FWTextTreeCellRenderer::showEditor(), TypeTrans::table_, FWPSetTableManager::PSetData::type, FWPSetTableManager::PSetData::value, and relativeConstraints::value.
{ static size_t maxSize = 512; // maximum string length static TGGC boldGC(fireworks::boldGC()); static TGGC italicGC(fireworks::italicGC()); static TGGC defaultGC(FWTextTableCellRenderer::getDefaultGC()); const static Pixel_t gray = 0x777777; const static Pixel_t red = gVirtualX->GetPixel(kRed-5); const static Pixel_t green = gVirtualX->GetPixel(kGreen-5); // return in case if nothing maches filter if (static_cast<int>(m_row_to_index.size()) <= iSortedRowNumber) { m_renderer.setData(std::string(), false); return &m_renderer; } int unsortedRow = m_row_to_index[iSortedRowNumber]; const PSetData& data = m_entries[unsortedRow]; std::string value; std::string label; TGGC* gc = 0; if (data.level == 0) { const PathInfo &path = m_paths[data.path]; label = data.label + " (" + data.value + ")"; gc = &boldGC; gc->SetForeground(path.passed ? green: red); } else if (data.level == 1) { // "passed" means if module made decision on path const ModuleInfo &module = m_modules[m_paths[data.path].moduleStart + data.module]; label = data.label + " (" + data.value + ")"; gc = (TGGC*)&boldGC; gc->SetForeground(module.passed ? green : red); } else { if (data.type > 0) label = data.label + " (" + sTypeTranslations.table_[data.type] + ")"; else label = data.label; value = data.value; if (data.editable) { gc = &defaultGC; } else { gc = &italicGC; gc->SetForeground(gray); } } // check string size and cut it if necessary (problems with X11) if (iCol == 1 && value.size() >= maxSize) { if (iSortedRowNumber == m_selectedRow) fwLog(fwlog::kWarning) << "label: " << label << " has too long value " << value << std::endl << std::endl; value = value.substr(0, maxSize); value += "[truncated]"; gc->SetForeground(gVirtualX->GetPixel(kMagenta)); } // debug // label = Form("%s m[%d] childm[%d] ", label.c_str(), data.matches, data.childMatches); // set text attributes m_renderer.setGraphicsContext(gc); bool selected = data.matches && (m_filter.empty() == false); m_renderer.setData(iCol ? value : label, selected); // set tree attributes bool isParent = false; bool isOpen = false; int indent = 0; if (iCol == 0) { if (m_filter.empty()) { size_t nextIdx = unsortedRow + 1; isParent = (nextIdx < m_entries.size() && m_entries[nextIdx].parent == (size_t)unsortedRow); isOpen = data.expandedUser; } else { isParent = data.childMatches; isOpen = data.expandedFilter && data.childMatches; } indent = data.level * 10 ; if (!isParent) indent += FWTextTreeCellRenderer::iconWidth(); } m_renderer.setIsParent(isParent); m_renderer.setIsOpen(isOpen); m_renderer.setIndentation(indent); // If we are rendering the selected cell, // we show the editor. bool showEdit = (iCol == 1 && iSortedRowNumber == m_selectedRow && iCol == m_selectedColumn && value.size() < maxSize); m_renderer.showEditor(data.editable && showEdit); return &m_renderer; } // cellRender()
void FWPSetTableManager::createScalarString | ( | PSetData & | data, |
T | v | ||
) | [private] |
Definition at line 185 of file FWPSetTableManager.cc.
References m_entries, v, and FWPSetTableManager::PSetData::value.
Referenced by handleEntry().
void FWPSetTableManager::createVectorString | ( | FWPSetTableManager::PSetData & | data, |
const T & | v, | ||
bool | quotes | ||
) | [private] |
Definition at line 194 of file FWPSetTableManager.cc.
References m_entries, and FWPSetTableManager::PSetData::value.
Referenced by handleEntry().
std::vector<PSetData>& FWPSetTableManager::data | ( | ) | [inline] |
Definition at line 109 of file FWPSetTableManager.h.
References m_entries.
Referenced by applyEditor(), FWPathsPopup::cellClicked(), cellRenderer(), handleEntry(), handlePSetEntry(), handleVPSetEntry(), recalculateVisibility(), setExpanded(), setSelection(), and updateFilter().
{ return m_entries; }
std::vector<PSetData>& FWPSetTableManager::entries | ( | ) | [inline, protected] |
Definition at line 147 of file FWPSetTableManager.h.
References m_entries.
Referenced by FWPathsPopup::scheduleReloadEvent().
{ return m_entries; }
std::vector< std::string > FWPSetTableManager::getTitles | ( | ) | const [virtual] |
returns the title names for each column
Implements FWTableManagerBase.
Definition at line 608 of file FWPSetTableManager.cc.
References numberOfColumns().
{ std::vector<std::string> returnValue; returnValue.reserve(numberOfColumns()); returnValue.push_back("Label"); returnValue.push_back("Value"); return returnValue; }
void FWPSetTableManager::handleEntry | ( | const edm::Entry & | entry, |
const std::string & | key | ||
) | [private] |
Definition at line 213 of file FWPSetTableManager.cc.
References createScalarString(), createVectorString(), data(), FWPSetTableManager::PSetData::editable, edm::Entry::getBool(), edm::Entry::getDouble(), edm::Entry::getESInputTag(), edm::Entry::getEventID(), edm::Entry::getEventRange(), edm::Entry::getFileInPath(), edm::Entry::getInputTag(), edm::Entry::getInt32(), edm::Entry::getLuminosityBlockID(), edm::Entry::getLuminosityBlockRange(), edm::Entry::getPSet(), edm::Entry::getString(), edm::Entry::getUInt32(), edm::Entry::getUInt64(), edm::Entry::getVDouble(), edm::Entry::getVESInputTag(), edm::Entry::getVEventID(), edm::Entry::getVEventRange(), edm::Entry::getVInputTag(), edm::Entry::getVInt32(), edm::Entry::getVInt64(), edm::Entry::getVLuminosityBlockID(), edm::Entry::getVLuminosityBlockRange(), edm::Entry::getVPSet(), edm::Entry::getVString(), edm::Entry::getVUInt32(), edm::Entry::getVUInt64(), handlePSet(), edm::Entry::isTracked(), combine::key, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_entries, m_modules, m_parentStack, FWPSetTableManager::PSetData::module, FWPSetTableManager::PSetData::parent, runregparse::ranges, o2o::tags, FWPSetTableManager::PSetData::tracked, FWPSetTableManager::PSetData::type, edm::Entry::typeCode(), and FWPSetTableManager::PSetData::value.
Referenced by handlePSet().
{ std::stringstream ss; FWPSetTableManager::PSetData data; data.label = key; data.tracked = entry.isTracked(); data.type = entry.typeCode(); data.level = m_parentStack.size(); data.parent = m_parentStack.back(); data.module = m_modules.size() - 1; data.type = entry.typeCode(); if (data.label[0] == '@' || data.level > 2) data.editable = false; else data.editable = true; switch(entry.typeCode()) { case 'b': { data.value = entry.getBool() ? "True" : "False"; m_entries.push_back(data); break; } case 'B': { data.value = entry.getBool() ? "True" : "False"; m_entries.push_back(data); break; } case 'i': { createVectorString(data, entry.getVInt32(), false); break; } case 'I': { createScalarString(data, entry.getInt32()); break; } case 'u': { createVectorString(data, entry.getVUInt32(), false); break; } case 'U': { createScalarString(data, entry.getUInt32()); break; } case 'l': { createVectorString(data, entry.getVInt64(), false); break; } case 'L': { createScalarString(data, entry.getInt32()); break; } case 'x': { createVectorString(data, entry.getVUInt64(), false); break; } case 'X': { createScalarString(data, entry.getUInt64()); break; } case 's': { createVectorString(data, entry.getVString(), false); break; } case 'S': { createScalarString(data, entry.getString()); break; } case 'd': { createVectorString(data, entry.getVDouble(), false); break; } case 'D': { createScalarString(data, entry.getDouble()); break; } case 'p': { std::vector<edm::ParameterSet> psets = entry.getVPSet(); for (size_t psi = 0, pse = psets.size(); psi != pse; ++psi) handlePSet(psets[psi]); break; } case 'P': { handlePSet(entry.getPSet()); break; } case 't': { data.value = entry.getInputTag().encode(); m_entries.push_back(data); break; } case 'v': { std::vector<std::string> tags; tags.resize(entry.getVInputTag().size()); for (size_t iti = 0, ite = tags.size(); iti != ite; ++iti) tags[iti] = entry.getVInputTag()[iti].encode(); createVectorString(data, tags, true); break; } case 'g': { data.value = entry.getESInputTag().encode(); m_entries.push_back(data); break; } case 'G': { std::vector<std::string> tags; tags.resize(entry.getVESInputTag().size()); for (size_t iti = 0, ite = tags.size(); iti != ite; ++iti) tags[iti] = entry.getVESInputTag()[iti].encode(); createVectorString(data, tags, true); break; } case 'F': { createScalarString(data, entry.getFileInPath().relativePath()); break; } case 'e': { data.editable = false; std::vector<edm::EventID> ids; ids.resize(entry.getVEventID().size()); for ( size_t iri = 0, ire = ids.size(); iri != ire; ++iri ) ids[iri] = entry.getVEventID()[iri]; createVectorString(data, ids, true); break; } case 'E': { data.editable = false; createScalarString(data, entry.getEventID()); break; } case 'm': { data.editable = false; std::vector<edm::LuminosityBlockID> ids; ids.resize(entry.getVLuminosityBlockID().size()); for ( size_t iri = 0, ire = ids.size(); iri != ire; ++iri ) ids[iri] = entry.getVLuminosityBlockID()[iri]; createVectorString(data, ids, true); break; } case 'M': { data.editable = false; createScalarString(data, entry.getLuminosityBlockID()); break; } case 'a': { data.editable = false; std::vector<edm::LuminosityBlockRange> ranges; ranges.resize(entry.getVLuminosityBlockRange().size()); for ( size_t iri = 0, ire = ranges.size(); iri != ire; ++iri ) ranges[iri] = entry.getVLuminosityBlockRange()[iri]; createVectorString(data, ranges, true); break; } case 'A': { data.editable = false; createScalarString(data, entry.getLuminosityBlockRange()); break; } case 'r': { data.editable = false; std::vector<edm::EventRange> ranges; ranges.resize(entry.getVEventRange().size()); for ( size_t iri = 0, ire = ranges.size(); iri != ire; ++iri ) ranges[iri] = entry.getVEventRange()[iri]; createVectorString(data, ranges, true); break; } case 'R': { data.editable = false; createScalarString(data, entry.getEventRange()); break; } default: { break; } } }
void FWPSetTableManager::handlePSet | ( | const edm::ParameterSet & | ps | ) | [private] |
Definition at line 169 of file FWPSetTableManager.cc.
References ExpressReco_HICollisions_FallBack::e, handleEntry(), handlePSetEntry(), handleVPSetEntry(), i, edm::ParameterSet::psetTable(), edm::ParameterSet::tbl(), and edm::ParameterSet::vpsetTable().
Referenced by handleEntry(), handlePSetEntry(), handleVPSetEntry(), and updateSchedule().
{ typedef edm::ParameterSet::table::const_iterator TIterator; for (TIterator i = ps.tbl().begin(), e = ps.tbl().end(); i != e; ++i) handleEntry(i->second, i->first); typedef edm::ParameterSet::psettable::const_iterator PSIterator; for (PSIterator i = ps.psetTable().begin(), e = ps.psetTable().end(); i != e; ++i) handlePSetEntry(i->second, i->first); typedef edm::ParameterSet::vpsettable::const_iterator VPSIterator; for (VPSIterator i = ps.vpsetTable().begin(), e = ps.vpsetTable().end(); i != e; ++i) handleVPSetEntry(i->second, i->first); }
void FWPSetTableManager::handlePSetEntry | ( | const edm::ParameterSetEntry & | entry, |
const std::string & | key | ||
) | [private] |
Definition at line 114 of file FWPSetTableManager.cc.
References data(), FWPSetTableManager::PSetData::editable, handlePSet(), edm::ParameterSetEntry::isTracked(), combine::key, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_entries, m_modules, m_parentStack, m_paths, FWPSetTableManager::PSetData::module, FWPSetTableManager::PSetData::parent, FWPSetTableManager::PSetData::path, FWPSetTableManager::PSetData::pset, edm::ParameterSetEntry::pset(), FWPSetTableManager::PSetData::tracked, and FWPSetTableManager::PSetData::type.
Referenced by handlePSet().
{ FWPSetTableManager::PSetData data; data.label = key; data.tracked = entry.isTracked(); data.level = m_parentStack.size(); data.parent = m_parentStack.back(); data.type = 'P'; data.module = m_modules.size() - 1; data.path = m_paths.size() - 1; data.pset = entry.pset(); data.editable = false; m_parentStack.push_back(m_entries.size()); m_entries.push_back(data); handlePSet(entry.pset()); m_parentStack.pop_back(); }
void FWPSetTableManager::handleVPSetEntry | ( | const edm::VParameterSetEntry & | entry, |
const std::string & | key | ||
) | [private] |
Definition at line 133 of file FWPSetTableManager.cc.
References data(), ExpressReco_HICollisions_FallBack::e, FWPSetTableManager::PSetData::editable, handlePSet(), i, edm::VParameterSetEntry::isTracked(), combine::key, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_entries, m_modules, m_parentStack, m_paths, FWPSetTableManager::PSetData::module, FWPSetTableManager::PSetData::parent, FWPSetTableManager::PSetData::path, FWPSetTableManager::PSetData::tracked, FWPSetTableManager::PSetData::type, and edm::VParameterSetEntry::vpset().
Referenced by handlePSet().
{ PSetData data; data.label = key; data.tracked = entry.isTracked(); data.level = m_parentStack.size(); data.parent = m_parentStack.back(); data.type = 'p'; data.module = m_modules.size() - 1; data.path = m_paths.size() - 1; data.editable = false; m_parentStack.push_back(m_entries.size()); m_entries.push_back(data); std::stringstream ss; for (size_t i = 0, e = entry.vpset().size(); i != e; ++i) { ss.str(""); ss << key << "[" << i << "]"; FWPSetTableManager::PSetData vdata; vdata.label = ss.str(); vdata.tracked = entry.isTracked(); vdata.level = m_parentStack.size(); vdata.parent = m_parentStack.back(); vdata.module = m_modules.size() - 1; vdata.path = m_paths.size() - 1; vdata.editable = false; m_parentStack.push_back(m_entries.size()); m_entries.push_back(vdata); handlePSet(entry.vpset()[i]); m_parentStack.pop_back(); } m_parentStack.pop_back(); }
void FWPSetTableManager::implSort | ( | int | iCol, |
bool | iSortOrder | ||
) | [virtual] |
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
Implements FWTableManagerBase.
Definition at line 689 of file FWPSetTableManager.cc.
Referenced by update().
{ }
std::vector< unsigned int > FWPSetTableManager::maxWidthForColumns | ( | ) | const [virtual] |
for each column in the table this returns the present maximum width for that column
Reimplemented from FWTableManagerBase.
Definition at line 675 of file FWPSetTableManager.cc.
References FWTableManagerBase::cellHeight(), and m_editor.
{ std::vector<unsigned int> ww = FWTableManagerBase::maxWidthForColumns(); if (ww.size() > 1 && ww[1] > 0) { // printf("dim W %d \n",ww[1]); // printf("dim H %d \n",cellHeight()); if (m_editor) m_editor->MoveResize(m_editor->GetX(),m_editor->GetY(), ww[1], cellHeight()); } return ww; }
std::vector<ModuleInfo>& FWPSetTableManager::modules | ( | ) | [inline, protected] |
Definition at line 146 of file FWPSetTableManager.h.
References m_modules.
Referenced by FWPathsPopup::scheduleReloadEvent().
{ return m_modules; }
int FWPSetTableManager::numberOfColumns | ( | ) | const [virtual] |
Number of columns in the table.
Implements FWTableManagerBase.
Definition at line 639 of file FWPSetTableManager.cc.
Referenced by getTitles().
{
return 2;
}
int FWPSetTableManager::numberOfRows | ( | ) | const [virtual] |
Number of rows in the table.
Implements FWTableManagerBase.
Definition at line 635 of file FWPSetTableManager.cc.
References m_row_to_index.
{ return m_row_to_index.size(); }
const FWPSetTableManager& FWPSetTableManager::operator= | ( | const FWPSetTableManager & | ) | [private] |
void FWPSetTableManager::recalculateVisibility | ( | ) | [private] |
Definition at line 918 of file FWPSetTableManager.cc.
References FWPSetTableManager::PSetData::childMatches, data(), ExpressReco_HICollisions_FallBack::e, i, m_entries, m_filter, m_row_to_index, FWPSetTableManager::PSetData::matches, FWPSetTableManager::PSetData::parent, and FWPSetTableManager::PSetData::visible.
Referenced by FWPSetTableManager(), setExpanded(), updateFilter(), and updateSchedule().
{ m_row_to_index.clear(); // Decide about visibility. // * If the items are toplevel and they match the filter, they get shown // in any case. // * If the item or any of its children match the filter, the item // is visible. // * If the filter is empty and the parent is expanded. for (size_t i = 0, e = m_entries.size(); i != e; ++i) { PSetData &data = m_entries[i]; if (data.parent == ((size_t) -1)) { data.visible = data.childMatches || data.matches || m_filter.empty(); } else { if (m_filter.empty()) { data.visible = m_entries[data.parent].expandedUser && m_entries[data.parent].visible; } else { data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible && (data.matches || data.childMatches); } } } // Put in the index only the entries which are visible. for (size_t i = 0, e = m_entries.size(); i != e; ++i) if (m_entries[i].visible) m_row_to_index.push_back(i); }
bool FWPSetTableManager::rowIsSelected | ( | int | row | ) | const [virtual] |
Definition at line 625 of file FWPSetTableManager.cc.
References m_selectedRow.
{ return m_selectedRow == row; }
std::vector<int>& FWPSetTableManager::rowToIndex | ( | ) | [inline] |
Definition at line 110 of file FWPSetTableManager.h.
References m_row_to_index.
Referenced by FWPathsPopup::cellClicked(), and setExpanded().
{ return m_row_to_index; }
int FWPSetTableManager::selectedColumn | ( | ) | const |
Definition at line 621 of file FWPSetTableManager.cc.
References m_selectedColumn.
Referenced by FWPathsPopup::cellClicked().
{ return m_selectedColumn; }
int FWPSetTableManager::selectedRow | ( | ) | const |
Definition at line 617 of file FWPSetTableManager.cc.
References m_selectedRow.
Referenced by FWPathsPopup::cellClicked().
{ return m_selectedRow; }
void FWPSetTableManager::setCellValueEditor | ( | FWPSetCellEditor * | editor | ) | [private] |
Definition at line 545 of file FWPSetTableManager.cc.
References idDealer::editor, m_editor, m_renderer, and FWTextTreeCellRenderer::setCellEditor().
Referenced by FWPathsPopup::FWPathsPopup().
{ m_editor = editor; m_renderer.setCellEditor(m_editor); }
void FWPSetTableManager::setExpanded | ( | int | row | ) | [protected] |
Definition at line 694 of file FWPSetTableManager.cc.
References FWPSetTableManager::PSetData::childMatches, data(), FWTableManagerBase::dataChanged(), FWPSetTableManager::PSetData::expandedFilter, FWPSetTableManager::PSetData::expandedUser, getHLTprescales::index, m_entries, m_filter, recalculateVisibility(), rowToIndex(), and FWTableManagerBase::visualPropertiesChanged().
Referenced by FWPathsPopup::cellClicked().
{ if (row == -1) return; int index = rowToIndex()[row]; PSetData& data = m_entries[index]; if (m_filter.empty() == false && data.childMatches == false) return; if (m_filter.empty()) data.expandedUser = !data.expandedUser; else data.expandedFilter = !data.expandedFilter; recalculateVisibility(); dataChanged(); visualPropertiesChanged(); }
void FWPSetTableManager::setSelection | ( | int | row, |
int | column, | ||
int | mask | ||
) | [protected] |
Definition at line 643 of file FWPSetTableManager.cc.
References FWTableManagerBase::cellHeight(), data(), FWPSetTableManager::PSetData::editable, m_editor, m_entries, m_row_to_index, m_selectedColumn, m_selectedRow, FWPSetTableManager::PSetData::value, and FWTableManagerBase::visualPropertiesChanged().
Referenced by applyEditor(), cancelEditor(), FWPathsPopup::cellClicked(), FWPathsPopup::HandleKey(), and FWPathsPopup::updateFilterString().
{ // printf("set selection %d %d mode %d\n", iRow, iColumn, mask); // Nothing changes if we clicked selected // twice the same cell. if (iRow == m_selectedRow && iColumn == m_selectedColumn) return; // Otherwise update the selection information // and notify observers. m_selectedRow = iRow; m_selectedColumn = iColumn; if (iColumn == 1 && iRow > 0 ) { int unsortedRow = m_row_to_index[iRow]; const PSetData& data = m_entries[unsortedRow]; if (m_editor && data.editable) { m_editor->MoveResize(0, cellHeight()*iRow, m_editor->GetWidth() , m_editor->GetHeight()); m_editor->MapWindow(); m_editor->SetText(data.value.c_str()); m_editor->SetFocus(); m_editor->SetCursorPosition(data.value.size()-1); } } else { if (m_editor) m_editor->UnmapWindow(); } visualPropertiesChanged(); }
const std::string FWPSetTableManager::title | ( | ) | const [virtual] |
Definition at line 604 of file FWPSetTableManager.cc.
{ return "Modules & their parameters"; }
int FWPSetTableManager::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 630 of file FWPSetTableManager.cc.
{
return unsorted;
}
void FWPSetTableManager::update | ( | std::vector< PathUpdate > & | pathUpdates | ) | [protected] |
Update the status of a given path. This is the information that changes on event by event basis.
Definition at line 507 of file FWPSetTableManager.cc.
References FWPSetTableManager::PathUpdate::choiceMaker, fwLog, implSort(), getHLTprescales::index, fwlog::kError, m_modules, m_pathIndex, m_paths, FWPSetTableManager::PathInfo::moduleEnd, FWPSetTableManager::PathInfo::moduleStart, FWPSetTableManager::PathInfo::passed, FWPSetTableManager::PathUpdate::passed, FWPSetTableManager::ModuleInfo::passed, FWPSetTableManager::PathUpdate::pathName, and pi.
Referenced by FWPathsPopup::postProcessEvent().
{ // Reset all the path / module status information, so that // by default paths and modules are considered "not passed". for (size_t pi = 0, pe = m_paths.size(); pi != pe; ++pi) m_paths[pi].passed = false; for (size_t mi = 0, me = m_modules.size(); mi != me; ++mi) m_modules[mi].passed = false; // Update whether or not a given path / module passed selection. for (size_t pui = 0, pue = pathUpdates.size(); pui != pue; ++pui) { PathUpdate &update = pathUpdates[pui]; std::map<std::string, size_t>::const_iterator index = m_pathIndex.find(update.pathName); if (index == m_pathIndex.end()) { fwLog(fwlog::kError) << "Path " << update.pathName << "cannot be found!" << std::endl; continue; } PathInfo &pathInfo = m_paths[index->second]; pathInfo.passed = update.passed; for (size_t mi = pathInfo.moduleStart, me = pathInfo.moduleEnd; mi != me; ++mi) { ModuleInfo &moduleInfo = m_modules[mi]; moduleInfo.passed = update.passed || ((mi-pathInfo.moduleStart) < update.choiceMaker); } } implSort(-1, true); }
void FWPSetTableManager::updateFilter | ( | const char * | filter | ) | [virtual] |
Definition at line 832 of file FWPSetTableManager.cc.
References data(), FWTableManagerBase::dataChanged(), ExpressReco_HICollisions_FallBack::e, align_tpl::filter, i, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_entries, m_filter, FWPSetTableManager::PSetData::matches, FWPSetTableManager::PSetData::parent, pi, recalculateVisibility(), svgfig::stack, and FWPSetTableManager::PSetData::value.
Referenced by FWPathsPopup::updateFilterString().
{ m_filter = filter; if (m_filter.empty()) { // collapse entries when filter is removed for (size_t i = 0, e = m_entries.size(); i != e; ++i) m_entries[i].expandedFilter = false; } else { // Decide whether or not items match the filter. for (size_t i = 0, e = m_entries.size(); i != e; ++i) { PSetData &data = m_entries[i]; // First of all decide whether or not we match // the filter. if (strstr(data.label.c_str(), m_filter.c_str()) || strstr(data.value.c_str(), m_filter.c_str()) ) data.matches = true; else data.matches = false; } // We reset whether or not a given parent has children that match the // filter, and we recompute the whole information by checking all the // children. for (size_t i = 0, e = m_entries.size(); i != e; ++i) m_entries[i].childMatches = false; std::vector<int> stack; int previousLevel = 0; for (size_t i = 0, e = m_entries.size(); i != e; ++i) { PSetData &data = m_entries[i]; // Top level. if (data.parent == (size_t)-1) { previousLevel = 0; // std::cout << "reset stack for top level " << data.label << std::endl; stack.clear(); continue; } // If the level is greater than the previous one, // it means we are among the children of the // previous level, hence we push the parent to // the stack. // If the level is not greater than the previous // one it means we have popped out n levels of // parents, where N is the difference between the // new and the old level. In this case we // pop up N parents from the stack. if (data.level > previousLevel) stack.push_back(data.parent); else for (size_t pi = 0, pe = previousLevel - data.level; pi != pe; ++pi) stack.pop_back(); if (data.matches && m_entries[stack.back()].childMatches == false) { // printf("match for %s with level %d\n",data.label.c_str(), data.level ); for (size_t pi = 0, pe = stack.size(); pi != pe; ++pi) { // printf("set child match to parent %s with level %d \n",m_entries[stack[pi]].label.c_str(), m_entries[stack[pi]].level); m_entries[stack[pi]].childMatches = true; } } previousLevel = data.level; } // expand to matching children for (size_t i = 0, e = m_entries.size(); i != e; ++i) m_entries[i].expandedFilter = m_entries[i].childMatches; } recalculateVisibility(); dataChanged(); } // updateFilter()
void FWPSetTableManager::updateSchedule | ( | const edm::ScheduleInfo * | info | ) | [protected] |
Definition at line 425 of file FWPSetTableManager.cc.
References edm::ScheduleInfo::availablePaths(), FWPSetTableManager::ModuleInfo::dirty, ExpressReco_HICollisions_FallBack::e, FWPSetTableManager::PSetData::editable, FWPSetTableManager::ModuleInfo::entry, FWPSetTableManager::PathInfo::entryId, handlePSet(), i, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_availablePaths, m_entries, m_filter, m_modules, m_parentStack, m_pathIndex, m_paths, FWPSetTableManager::PSetData::module, edm::ScheduleInfo::modulesInPath(), FWPSetTableManager::PathInfo::moduleStart, edm::ScheduleInfo::parametersForModule(), FWPSetTableManager::PSetData::parent, FWPSetTableManager::PathInfo::passed, FWPSetTableManager::ModuleInfo::passed, FWPSetTableManager::PSetData::path, FWPSetTableManager::ModuleInfo::path, pathName(), FWPSetTableManager::PSetData::pset, recalculateVisibility(), edm::ParameterSet::tbl(), and FWPSetTableManager::PSetData::value.
Referenced by FWPathsPopup::postProcessEvent().
{ if (!m_entries.empty()) return; // Execute only once since the schedule itself // cannot be altered. assert(m_availablePaths.empty()); info->availablePaths(m_availablePaths); for (size_t i = 0, e = m_availablePaths.size(); i != e; ++i) { PSetData pathEntry; const std::string &pathName = m_availablePaths[i]; pathEntry.label = pathName; m_pathIndex.insert(std::make_pair(pathName, m_paths.size())); pathEntry.value = "Path"; pathEntry.level= 0; pathEntry.parent = -1; pathEntry.path = i; pathEntry.editable = false; PathInfo pathInfo; pathInfo.entryId = m_entries.size(); pathInfo.passed = false; pathInfo.moduleStart = m_modules.size(); m_paths.push_back(pathInfo); m_parentStack.push_back(m_entries.size()); m_entries.push_back(pathEntry); std::vector<std::string> pathModules; info->modulesInPath(pathName, pathModules); for (size_t mi = 0, me = pathModules.size(); mi != me; ++mi) { PSetData moduleEntry; const edm::ParameterSet* ps = info->parametersForModule(pathModules[mi]); const edm::ParameterSet::table& pst = ps->tbl(); const edm::ParameterSet::table::const_iterator ti = pst.find("@module_edm_type"); if (ti == pst.end()) moduleEntry.value = "Unknown module name"; else moduleEntry.value = ti->second.getString(); moduleEntry.label = pathModules[mi]; moduleEntry.parent = m_parentStack.back(); moduleEntry.level = m_parentStack.size(); moduleEntry.module = mi; moduleEntry.path = i; moduleEntry.pset = *ps; moduleEntry.editable = false; ModuleInfo moduleInfo; moduleInfo.path = m_paths.size() - 1; moduleInfo.entry = m_entries.size(); moduleInfo.passed = false; moduleInfo.dirty = false; m_modules.push_back(moduleInfo); m_parentStack.push_back(m_entries.size()); m_entries.push_back(moduleEntry); handlePSet(moduleEntry.pset); m_parentStack.pop_back(); } m_paths.back().moduleEnd = m_modules.size(); m_parentStack.pop_back(); } // Nothing is expanded by default. for (size_t i = 0, e = m_entries.size(); i != e; ++i) m_entries[i].expandedUser = false; m_filter = ""; recalculateVisibility(); } //updateSchedule
friend class FWPathsPopup [friend] |
Definition at line 40 of file FWPSetTableManager.h.
std::vector<std::string> FWPSetTableManager::m_availablePaths [private] |
Definition at line 191 of file FWPSetTableManager.h.
Referenced by updateSchedule().
FWPSetCellEditor* FWPSetTableManager::m_editor [private] |
Definition at line 190 of file FWPSetTableManager.h.
Referenced by applyEditor(), cancelEditor(), FWPathsPopup::FWPathsPopup(), maxWidthForColumns(), setCellValueEditor(), and setSelection().
std::vector<PSetData> FWPSetTableManager::m_entries [private] |
Definition at line 180 of file FWPSetTableManager.h.
Referenced by applyEditor(), cellRenderer(), createScalarString(), createVectorString(), data(), entries(), handleEntry(), handlePSetEntry(), handleVPSetEntry(), recalculateVisibility(), setExpanded(), setSelection(), updateFilter(), and updateSchedule().
std::string FWPSetTableManager::m_filter [private] |
Definition at line 189 of file FWPSetTableManager.h.
Referenced by cellRenderer(), recalculateVisibility(), setExpanded(), updateFilter(), and updateSchedule().
std::vector<ModuleInfo> FWPSetTableManager::m_modules [private] |
Definition at line 183 of file FWPSetTableManager.h.
Referenced by applyEditor(), cellRenderer(), handleEntry(), handlePSetEntry(), handleVPSetEntry(), modules(), update(), and updateSchedule().
std::vector<size_t> FWPSetTableManager::m_parentStack [private] |
Definition at line 185 of file FWPSetTableManager.h.
Referenced by handleEntry(), handlePSetEntry(), handleVPSetEntry(), and updateSchedule().
std::map<std::string, size_t> FWPSetTableManager::m_pathIndex [private] |
Definition at line 184 of file FWPSetTableManager.h.
Referenced by update(), and updateSchedule().
std::vector<PathInfo> FWPSetTableManager::m_paths [private] |
Index in m_entries where to find paths
Definition at line 182 of file FWPSetTableManager.h.
Referenced by cellRenderer(), handlePSetEntry(), handleVPSetEntry(), update(), and updateSchedule().
FWTextTreeCellRenderer FWPSetTableManager::m_renderer [mutable, private] |
Definition at line 193 of file FWPSetTableManager.h.
Referenced by cellRenderer(), FWPSetTableManager(), and setCellValueEditor().
std::vector<int> FWPSetTableManager::m_row_to_index [private] |
Definition at line 186 of file FWPSetTableManager.h.
Referenced by applyEditor(), cellRenderer(), numberOfRows(), recalculateVisibility(), rowToIndex(), and setSelection().
int FWPSetTableManager::m_selectedColumn [private] |
Definition at line 188 of file FWPSetTableManager.h.
Referenced by applyEditor(), cellRenderer(), selectedColumn(), and setSelection().
int FWPSetTableManager::m_selectedRow [private] |
Definition at line 187 of file FWPSetTableManager.h.
Referenced by applyEditor(), cellRenderer(), rowIsSelected(), selectedRow(), and setSelection().