15 #include <sigc++/signal.h> 22 #include "TGTextEntry.h" 90 std::vector<std::string>
getTitles()
const override {
91 std::vector<std::string> returnValue;
93 returnValue.push_back(
"Purpose");
94 returnValue.push_back(
"Module Label");
95 returnValue.push_back(
"Product Instance Label");
96 returnValue.push_back(
"Process Name");
97 returnValue.push_back(
"C++ Class");
163 if (
found == std::string::npos)
186 class SortAndFilter {
188 SortAndFilter(
const char *
filter,
int column,
bool order,
const std::vector<FWJobMetadataManager::Data> &
data)
191 m_weights.resize(
data.size());
196 for (
size_t i = 0,
e = m_weights.size();
i !=
e; ++
i)
197 m_weights[
i] = matchesFilter(m_data[
i]);
220 const char *
begin =
up.c_str();
226 if ((!m_filter.empty()) &&
str.empty())
232 if (strstr(
begin, m_filter.c_str()))
244 std::vector<unsigned int> scores;
249 scores.push_back(
matches(
data.productInstanceLabel_));
252 return scores.back();
258 bool operator()(
const int &aIndex,
const int &bIndex) {
262 return m_weights[aIndex] >= m_weights[bIndex];
278 const std::vector<FWJobMetadataManager::Data> &m_data;
279 std::vector<unsigned int> m_weights;
285 const std::vector<FWJobMetadataManager::Data> &iData,
286 std::vector<int> &oRowToIndex) {
287 std::vector<int> ordered;
288 ordered.reserve(iData.size());
290 for (
size_t i = 0,
e = iData.size();
i !=
e; ++
i)
291 ordered.push_back(
i);
293 SortAndFilter
sorter(
filter, column, descentSort, iData);
295 std::stable_sort(ordered.begin(), ordered.end(),
sorter);
298 oRowToIndex.reserve(ordered.size());
300 for (
size_t i = 0,
e = ordered.size();
i !=
e; ++
i)
301 if (
sorter.matchesFilter(iData[ordered[
i]]) != 0)
302 oRowToIndex.push_back(ordered[
i]);
323 : m_manager(iManager), m_metadataManager(iMetadataManager), m_parentFrame(iParent) {
361 TClass *theClass = TClass::GetClass(
m_type.c_str());
362 if (
nullptr == theClass) {
376 TString
msg(
"Event item '");
378 msg +=
"' is already registered. Please use another name.";
380 new TGMsgBox(gClient->GetDefaultRoot(),
m_frame,
"Error - Name conflict",
msg, kMBIconExclamation, kMBOk);
390 if ((*
it) && largest < (*it)->layer()) {
391 largest = (*it)->layer();
450 m_frame->Connect(
"CloseWindow()",
"FWGUIEventDataAdder",
this,
"windowIsClosing()");
453 TGTextButton *cancelButton, *resetButton;
464 .
addLabel(
"Viewable Collections", 8)
479 "Do not use Process Name and " 480 "instead only get this data " 481 "from the most recent Process",
497 m_search->Connect(
"TextChanged(const char *)",
"FWGUIEventDataAdder",
this,
"updateFilterString(const char *)");
502 m_tableWidget->Connect(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
503 "FWGUIEventDataAdder",
505 "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)");
509 resetButton->SetEnabled(
true);
510 resetButton->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"resetNameEntry()");
512 cancelButton->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"windowIsClosing()");
513 cancelButton->SetEnabled(
true);
514 m_apply->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"addNewItem()");
515 m_applyAndClose->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"addNewItemAndClose()");
517 m_frame->SetWindowName(
"Add Collection");
536 if (-1 != iSelectedIndex) {
545 if (strlen(
m_name->GetText()) == 0 || oldModuleLabel ==
m_name->GetText()) {
555 bool isMostRecentProcess =
true;
557 for (std::vector<FWJobMetadataManager::Data>::iterator
it =
metadata.begin(), itEnd =
metadata.end();
558 it != itEnd && isMostRecentProcess;
560 if (
index == iSelectedIndex) {
573 isMostRecentProcess =
false;
579 if (isMostRecentProcess) {
592 if (iButton == kButton1) {
FWDialogBuilder & spaceUp(size_t spacing=3)
FWTextTableCellRenderer m_renderer
TGTextButton * m_applyAndClose
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.
void setSelection(int row, int mask)
FWEventItemsManager * m_manager
FWDialogBuilder & addTextButton(const char *text, TGTextButton **out=nullptr)
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
int numberOfColumns() const override
Number of columns in the table.
FWDialogBuilder & addLabel(const char *text, size_t fontSize=12, size_t weight=0, TGLabel **out=nullptr)
static const FWDisplayProperties defaultProperties
FWDialogBuilder & addCheckbox(const char *text, TGCheckButton **out=nullptr)
const FWEventItem * find(const std::string &iName) const
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 const std::string title() const
FWJobMetadataManager * m_metadataManager
virtual ~FWGUIEventDataAdder()
std::string m_productInstanceLabel
FWDialogBuilder & frameSpaceDown(size_t spacing=3)
FWGUIEventDataAdder(UInt_t w, UInt_t, FWEventItemsManager *, TGFrame *, FWJobMetadataManager *)
void updateFilterString(const char *str)
FWDialogBuilder & frameSpaceUpDown(size_t spacing=3)
virtual void sortWithFilter(const char *filter)
std::vector< std::string > getTitles() const override
returns the title names for each column
FWEventItem * add(const FWPhysicsObjectDesc &iItem, const FWConfiguration *pbConf=nullptr, bool doSetEvent=true)
TGCheckButton * m_doNotUseProcessName
TGTransientFrame * m_frame
void changeSelection(int iRow)
int numberOfRows() const override
Number of rows in the table.
FWDialogBuilder & hSpacer(size_t size=0)
FWDialogBuilder & addTextEntry(const char *defaultText, TGTextEntry **out)
void setData(const std::string &, bool isSelected)
FWDialogBuilder & floatLeft(size_t spacing=3)
FWDialogBuilder & addTable(FWTableManagerBase *manager, FWTableWidget **out=nullptr)
FWDialogBuilder & expand(size_t expandX=true, size_t expandY=false)
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
sigc::signal< void(int)> indexSelected_
static const std::string & dataForColumn(const FWJobMetadataManager::Data &iData, int iCol)
virtual bool rowIsSelected(int row) const
char data[epos_bytes_allocation]
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
FWTableWidget * m_tableWidget
DataAdderTableManager * m_tableManager
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
void rowClicked(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
const_iterator end() const
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
void addNewItemAndClose()
FWDialogBuilder & spaceRight(size_t spacing=3)
std::string m_moduleLabel