31 #include "WColumnPropertyHandler.h"
36 m_protonData( protonData ),
37 m_properties( properties ),
38 m_dataUpdate( dataUpdate )
46 this, boost::placeholders::_1 );
53 std::string columnName = std::get< 0 >( selectorElement );
56 std::map< WPropSelection, std::string >::value_type(
addHeaderProperty( selectorElement, notifier ), columnName )
74 std::vector< std::string > header =
m_protonData->getHeaderFromType( typeNames );
76 for( std::vector<std::string>::iterator colName = header.begin(); colName != header.end(); colName++ )
78 possibleSelectionsUsingTypes->addItem(
ItemType::create( *colName, *colName,
"", NULL ) );
81 possibleSelectionsUsingTypes->addItem(
ItemType::create(
"- no selection -",
"- no selection -",
"", NULL ) );
83 return possibleSelectionsUsingTypes;
88 std::vector< std::string > headerToSearch =
m_protonData->getCSVHeader()->at( 0 );
90 std::string refheader = headerToSearch.at( index );
92 std::vector< std::string > singleSelectorContent =
m_protonData->getHeaderFromType( typeName );
94 size_t indexCounter = 0;
96 for( std::vector<std::string>::iterator colName = singleSelectorContent.begin(); colName != singleSelectorContent.end(); colName++ )
98 if( *colName == refheader )
111 std::string columnName = std::get< 0 >( ndst );
112 std::string description = std::get< 1 >( ndst );
113 std::string defName = std::get< 2 >( ndst );
114 std::list< std::string > type = std::get< 3 >( ndst );
118 int indexSingleSelector = index < 0 ? -1 :
getFilterIndex( index, type );
124 WItemSelector selector = index < 0 ? possibleSelectionsUsingTypes->getSelectorLast() :
125 possibleSelectionsUsingTypes->getSelector( indexSingleSelector );
142 std::string columnName;
148 if( property == elem->first )
150 selector = &elem->first->get(
true );
151 columnName = elem->second;
156 if( selector != NULL )
158 std::string selectedValue = selector->
at( 0 )->getAs<
ItemType >()->getValue();
void propertyNotifier(WPropertyBase::SPtr property)
Event function when WItemSelection is triggered.
std::tuple< std::string, std::string, std::string, std::list< std::string > > NameDescriptionSearchTyp
tuple with 3 string as value
std::map< WPropSelection, std::string >::iterator PropMapEntry
Reresents an entry in a < WPropSelection, string > map.
WPropertyGroup::SPtr m_properties
A property variable that is generated by the WModul.
WPropSelection addHeaderProperty(WColumnPropertyHandler::NameDescriptionSearchTyp ndst, WPropertyBase::PropertyChangeNotifierType notifier)
Creates the individual WItemSelection.
std::shared_ptr< WItemSelection > initializeSelectionItem(std::list< std::string > typeName)
creates the content (options) of the WItemSelection
void updateProperty()
update current group property and subproperty
WPropGroup m_columnSelectionGroup
Property group for column selection.
WColumnPropertyHandler::CallbackPtr m_externEventMethod
A void function variable that can be use outside.
WColumnPropertyHandler::CallbackPtr m_dataUpdate
A function variable that reinitializes the WDataSets.
void createProperties()
creates the group property and the subproperty
std::map< WPropSelection, std::string > mapPropSelectionsToString
A map between WPropSelection items and column names as strings.
void setSelectionEventMethod(WColumnPropertyHandler::CallbackPtr externEventMethod)
setter to use a external function
WColumnPropertyHandler(WProtonData::SPtr protonData, WPropertyGroup::SPtr properties, WColumnPropertyHandler::CallbackPtr dataUpdate)
constructor
boost::function< void() > CallbackPtr
Function variables for updating the data.
int getFilterIndex(int index, std::list< std::string > typeName)
converts the index to the filtered index
WProtonData::SPtr m_protonData
Pointer to the content and header of the CSV.
A derivation of WItemSelection which can store a value of any type.
static SPtr create(T value, std::string name, std::string description="", const char **icon=NULL)
Create a instance of the item.
A class containing a list of named items.
std::shared_ptr< WItemSelection > SPtr
Convenience typedef for a std::shared_ptr< WItemSelection >
This class represents a subset of a WItemSelection.
virtual const std::shared_ptr< WItemSelectionItem > at(size_t index) const
Gets the selected item with the given index.
boost::function< void(std::shared_ptr< WPropertyBase >)> PropertyChangeNotifierType
Signal signature emitted during set operations.
std::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyBase >
std::shared_ptr< WPropertyGroup > SPtr
shared pointer to object of this type
std::shared_ptr< WProtonData > SPtr
shared_ptr that points to itself
static std::list< WSingleSelectorName::NameDescriptionSearchTyp > getListOfSelectorContent()
getter
void addTo(WPropSelection prop)
Add the PC_NOTEMPTY constraint to the property.
void addTo(WPropSelection prop)
Add the PC_SELECTONLYONE constraint to the property.