|
|
Go to the documentation of this file.
15 #include <sigc++/signal.h>
16 #include <boost/bind.hpp>
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_));
251 std::sort(scores.begin(), scores.end());
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;
282 void doSort(
int column,
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();
449 m_frame->Connect(
"CloseWindow()",
"FWGUIEventDataAdder",
this,
"windowIsClosing()");
452 TGTextButton *cancelButton, *resetButton;
463 .
addLabel(
"Viewable Collections", 8)
478 "Do not use Process Name and "
479 "instead only get this data "
480 "from the most recent Process",
496 m_search->Connect(
"TextChanged(const char *)",
"FWGUIEventDataAdder",
this,
"updateFilterString(const char *)");
501 m_tableWidget->Connect(
"rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)",
502 "FWGUIEventDataAdder",
504 "rowClicked(Int_t,Int_t,Int_t,Int_t,Int_t)");
508 resetButton->SetEnabled(
true);
509 resetButton->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"resetNameEntry()");
511 cancelButton->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"windowIsClosing()");
512 cancelButton->SetEnabled(
true);
513 m_apply->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"addNewItem()");
514 m_applyAndClose->Connect(
"Clicked()",
"FWGUIEventDataAdder",
this,
"addNewItemAndClose()");
516 m_frame->SetWindowName(
"Add Collection");
535 if (-1 != iSelectedIndex) {
544 if (strlen(
m_name->GetText()) == 0 || oldModuleLabel ==
m_name->GetText()) {
554 bool isMostRecentProcess =
true;
556 for (std::vector<FWJobMetadataManager::Data>::iterator it =
metadata.begin(), itEnd =
metadata.end();
557 it != itEnd && isMostRecentProcess;
559 if (
index == iSelectedIndex) {
572 isMostRecentProcess =
false;
578 if (isMostRecentProcess) {
591 if (iButton == kButton1) {
void sort(int iCol, bool iSortOrder)
Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder...
virtual ~FWGUIEventDataAdder()
virtual const std::string title() const
FWEventItem * add(const FWPhysicsObjectDesc &iItem, const FWConfiguration *pbConf=nullptr, bool doSetEvent=true)
FWJobMetadataManager * m_metadataManager
std::string m_productInstanceLabel
int numberOfColumns() const override
Number of columns in the table.
virtual void sortWithFilter(const char *filter)
FWDialogBuilder & indent(int left=2, int right=-1)
FWDialogBuilder & floatLeft(size_t spacing=3)
FWTextTableCellRenderer m_renderer
TGCheckButton * m_doNotUseProcessName
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
FWDialogBuilder & addTextButton(const char *text, TGTextButton **out=nullptr)
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e....
FWGUIEventDataAdder(UInt_t w, UInt_t, FWEventItemsManager *, TGFrame *, FWJobMetadataManager *)
TGTextButton * m_applyAndClose
DataAdderTableManager(FWJobMetadataManager *manager)
FWDialogBuilder & spaceDown(size_t spacing=3)
static const std::string source
void newIndexSelected(int)
std::vector< std::string > getTitles() const override
returns the title names for each column
int numberOfRows() const override
Number of rows in the table.
FWDialogBuilder & expand(size_t expandX=true, size_t expandY=false)
std::string m_moduleLabel
void addNewItemAndClose()
void metadataUpdatedSlot(void)
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
DataAdderTableManager * m_tableManager
void rowClicked(Int_t iRow, Int_t iButton, Int_t iKeyMod, Int_t, Int_t)
const_iterator end() const
static const FWDisplayProperties defaultProperties
const FWEventItem * find(const std::string &iName) const
std::vector< FWEventItem * >::const_iterator const_iterator
FWDialogBuilder & spaceUp(size_t spacing=3)
TGTransientFrame * m_frame
bool sortOrder(void)
The current sort order for the table.
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'.
void setData(const std::string &, bool isSelected)
void setSelection(int row, int mask)
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...
FWDialogBuilder & spaceRight(size_t spacing=3)
const_iterator begin() const
NOTE: iterator is allowed to return a null object for items that have been removed.
FWDialogBuilder & hSpacer(size_t size=0)
FWTableWidget * m_tableWidget
FWDialogBuilder & frameSpaceUpDown(size_t spacing=3)
void updateFilterString(const char *str)
def remove(d, key, TELL=False)
static const unsigned int kNColumns
FWEventItemsManager * m_manager
FWJobMetadataManager * m_manager
char data[epos_bytes_allocation]
FWDialogBuilder & addTable(FWTableManagerBase *manager, FWTableWidget **out=nullptr)
FWDialogBuilder & frameSpaceDown(size_t spacing=3)
sigc::signal< void, int > indexSelected_
std::vector< int > m_row_to_index
static const std::string & dataForColumn(const FWJobMetadataManager::Data &iData, int iCol)
std::string m_processName
void changeSelection(int iRow)
virtual bool rowIsSelected(int row) const
FWDialogBuilder & addTextEntry(const char *defaultText, TGTextEntry **out)
FWDialogBuilder & addLabel(const char *text, size_t fontSize=12, size_t weight=0, TGLabel **out=nullptr)
FWDialogBuilder & addCheckbox(const char *text, TGCheckButton **out=nullptr)