15 #include <sigc++/signal.h> 16 #include <boost/bind.hpp> 22 #include "TGTextEntry.h" 102 virtual std::vector<std::string>
getTitles()
const override {
103 std::vector<std::string> returnValue;
105 returnValue.push_back(
"Purpose");
106 returnValue.push_back(
"Module Label");
107 returnValue.push_back(
"Product Instance Label");
108 returnValue.push_back(
"Process Name");
109 returnValue.push_back(
"C++ Class");
137 return "Viewable Collections";
183 size_t found = source.find(
remove);
184 if (found == std::string::npos)
186 source.erase(found,
remove.
size());
210 SortAndFilter(
const char *
filter,
int column,
bool order,
211 const std::vector<FWJobMetadataManager::Data> &
data)
218 m_weights.resize(data.size());
223 for (
size_t i = 0,
e = m_weights.size();
i !=
e; ++
i)
224 m_weights[
i] = matchesFilter(m_data[
i]);
235 strip(str,
"vector<");
236 strip(str,
"clonepolicy");
237 strip(str,
"ownvector");
238 strip(str,
"rangemap<");
239 strip(str,
"strictweakordering<");
240 strip(str,
"sortedcollection<");
241 strip(str,
"reco::");
242 strip(str,
"edmnew::");
249 const char *
begin = up.c_str();
255 if ((!
m_filter.empty()) && str.empty())
261 if (strstr(begin,
m_filter.c_str()))
274 std::vector<unsigned int> scores;
281 std::sort(scores.begin(), scores.end());
282 return scores.back();
288 bool operator()(
const int &aIndex,
const int &bIndex)
293 return m_weights[aIndex] >= m_weights[bIndex];
308 const std::vector<FWJobMetadataManager::Data> &m_data;
309 std::vector<unsigned int> m_weights;
312 void doSort(
int column,
315 const std::vector<FWJobMetadataManager::Data>& iData,
316 std::vector<int>& oRowToIndex)
318 std::vector<int> ordered;
319 ordered.reserve(iData.size());
321 for (
size_t i = 0,
e = iData.size();
i !=
e; ++
i)
322 ordered.push_back(
i);
324 SortAndFilter
sorter(filter, column, descentSort, iData);
326 std::stable_sort(ordered.begin(), ordered.end(),
sorter);
329 oRowToIndex.reserve(ordered.size());
331 for (
size_t i = 0,
e = ordered.size();
i !=
e; ++
i)
332 if (sorter.matchesFilter(iData[ordered[
i]]) != 0)
333 oRowToIndex.push_back(ordered[i]);
352 UInt_t iWidth,UInt_t iHeight,
358 m_metadataManager(iMetadataManager),
359 m_parentFrame(iParent)
401 TClass* theClass = TClass::GetClass(
m_type.c_str());
406 if(moduleLabel.empty()) {
416 TString
msg(
"Event item '");
418 msg +=
"' is already registered. Please use another name.";
420 new TGMsgBox(gClient->GetDefaultRoot(),
m_frame,
421 "Error - Name conflict",
msg, kMBIconExclamation, kMBOk);
434 if((*it) && largest < (*it)->layer()) {
435 largest = (*it)->layer();
501 m_frame->Connect(
"CloseWindow()",
"FWGUIEventDataAdder",
this,
"windowIsClosing()");
504 TGTextButton *cancelButton, *resetButton;
511 .
addLabel(
"Viewable Collections", 8)
519 "instead only get this data " 520 "from the most recent Process",
529 m_search->Connect(
"TextChanged(const char *)",
"FWGUIEventDataAdder",
530 this,
"updateFilterString(const char *)");
535 m_tableWidget->Connect(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
536 "FWGUIEventDataAdder",
this,
537 "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)");
541 resetButton->SetEnabled(
true);
542 resetButton->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"resetNameEntry()");
544 cancelButton->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"windowIsClosing()");
545 cancelButton->SetEnabled(
true);
546 m_apply->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"addNewItem()");
547 m_applyAndClose->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"addNewItemAndClose()");
549 m_frame->SetWindowName(
"Add Collection");
574 if(-1 != iSelectedIndex) {
576 m_purpose = metadata[iSelectedIndex].purpose_;
577 m_type = metadata[iSelectedIndex].type_;
583 if(strlen(
m_name->GetText())==0 || oldModuleLabel ==
m_name->GetText()) {
593 bool isMostRecentProcess =
true;
595 for(std::vector<FWJobMetadataManager::Data>::iterator it = metadata.begin(), itEnd = metadata.end();
596 it != itEnd && isMostRecentProcess;
598 if(index == iSelectedIndex) {
continue;}
612 if(it->processName_ == processName)
614 isMostRecentProcess =
false;
620 if(isMostRecentProcess) {
635 if(iButton==kButton1) {
FWDialogBuilder & spaceUp(size_t spacing=3)
FWTextTableCellRenderer m_renderer
TGTextButton * m_applyAndClose
virtual void implSort(int col, bool sortOrder) override
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'...
bool sortOrder(void)
The current sort order for the table.
virtual bool rowIsSelected(int row) const
void setSelection(int row, int mask)
FWEventItemsManager * m_manager
FWDialogBuilder & addLabel(const char *text, size_t fontSize=12, size_t weight=0, TGLabel **out=0)
std::vector< int > m_row_to_index
void metadataUpdatedSlot(void)
void sort(int iCol, bool iSortOrder)
Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder...
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
std::string m_processName
virtual const std::string title() const
FWDialogBuilder & addTable(FWTableManagerBase *manager, FWTableWidget **out=0)
static const FWDisplayProperties defaultProperties
virtual int unsortedRowNumber(int iSortedRowNumber) const override
when passed the index to the sorted order of the rows it returns the original row number from the und...
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
FWJobMetadataManager * m_metadataManager
virtual ~FWGUIEventDataAdder()
std::string m_productInstanceLabel
FWDialogBuilder & frameSpaceDown(size_t spacing=3)
FWGUIEventDataAdder(UInt_t w, UInt_t, FWEventItemsManager *, TGFrame *, FWJobMetadataManager *)
virtual std::vector< std::string > getTitles() const override
returns the title names for each column
void updateFilterString(const char *str)
FWDialogBuilder & addTextButton(const char *text, TGTextButton **out=0)
FWDialogBuilder & frameSpaceUpDown(size_t spacing=3)
virtual void sortWithFilter(const char *filter)
TGCheckButton * m_doNotUseProcessName
TGTransientFrame * m_frame
const FWEventItem * find(const std::string &iName) const
void changeSelection(int iRow)
FWDialogBuilder & hSpacer(size_t size=0)
FWDialogBuilder & addTextEntry(const char *defaultText, TGTextEntry **out)
void setData(const std::string &, bool isSelected)
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
virtual int numberOfColumns() const override
Number of columns in the table.
FWDialogBuilder & floatLeft(size_t spacing=3)
FWDialogBuilder & expand(size_t expandX=true, size_t expandY=false)
virtual int numberOfRows() const override
Number of rows in the table.
static const std::string & dataForColumn(const FWJobMetadataManager::Data &iData, int iCol)
char data[epos_bytes_allocation]
sigc::signal< void, int > indexSelected_
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
const FWEventItem * add(const FWPhysicsObjectDesc &iItem, const FWConfiguration *pbConf=0)
FWTableWidget * m_tableWidget
DataAdderTableManager * m_tableManager
void rowClicked(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
FWDialogBuilder & addCheckbox(const char *text, TGCheckButton **out=0)
DataAdderTableManager(FWJobMetadataManager *manager)
FWDialogBuilder & indent(int left=2, int right=-1)
std::vector< FWEventItem * >::const_iterator const_iterator
static std::string const source
void newIndexSelected(int)
FWDialogBuilder & spaceDown(size_t spacing=3)
FWJobMetadataManager * m_manager
static const unsigned int kNColumns
const_iterator end() const
void addNewItemAndClose()
FWDialogBuilder & spaceRight(size_t spacing=3)
std::string m_moduleLabel