return false;\r
}\r
\r
-bool getValidatorInfo(xmlNodePtr theNode, std::string& outValidatorId,\r
+bool getParametersInfo(xmlNodePtr theNode, std::string& outValidatorId,\r
std::list<std::string>& outValidatorParameters)\r
{\r
//Validator id:\r
outValidatorId = std::string(anIdProp);\r
\r
//Validator parameters:\r
- char* aParamProp = (char*) xmlGetProp(theNode, BAD_CAST VALIDATOR_PARAMETERS);\r
+ char* aParamProp = (char*) xmlGetProp(theNode, BAD_CAST _PARAMETERS);\r
if (aParamProp && aParamProp[0] != 0) {\r
std::string aPropString = std::string(aParamProp);\r
std::stringstream aPropStringStream(aPropString);\r
CONFIG_EXPORT bool hasChild(xmlNodePtr theNode);
/*
- *
+ * Returns named property for an id node as std::string and the parameters of the node.
*/
-CONFIG_EXPORT bool getValidatorInfo(xmlNodePtr theNode, std::string& outValidatorId,
- std::list<std::string>& outValidatorParameters);
+CONFIG_EXPORT bool getParametersInfo(xmlNodePtr theNode, std::string& outPropertyId,
+ std::list<std::string>& outValidatorParameters);
/*!
\brief Convert the given parameter to the platform-specific library name.
const static char* FEATURE_KEYSEQUENCE = "keysequence";
const static char* FEATURE_NESTED = "nested";
const static char* FEATURE_DOC = WORKBENCH_DOC;
-// NODE_VALIDATOR properties
-const static char* VALIDATOR_PARAMETERS = "parameters";
+// NODE_VALIDATOR properties, NODE_SELFILTER properties
+const static char* _PARAMETERS = "parameters";
+
// Widget (attribute) properties
const static char* ATTR_TOOLTIP = FEATURE_TOOLTIP;
const static char* ATTR_ICON = FEATURE_ICON;
return myAttributeId;
}
+const std::list<std::string>& Config_SelectionFilterMessage::parameters() const
+{
+ return myFilterParameters;
+}
+
void Config_SelectionFilterMessage::setFeatureId(const std::string& theId)
{
myFeatureId = theId;
myAttributeId = theId;
}
+void Config_SelectionFilterMessage::setFilterParameters(const std::list<std::string>& parameters)
+{
+ myFilterParameters = parameters;
+}
+
std::string mySelectionFilterId;
std::string myFeatureId;
std::string myAttributeId;
+ std::list<std::string> myFilterParameters;
public:
CONFIG_EXPORT Config_SelectionFilterMessage(const Events_ID theId, const void* theParent = 0);
CONFIG_EXPORT const std::string& selectionFilterId() const;
CONFIG_EXPORT const std::string& featureId() const;
CONFIG_EXPORT const std::string& attributeId() const;
+ CONFIG_EXPORT const std::list<std::string>& parameters() const;
CONFIG_EXPORT void setSelectionFilterId(const std::string& theId);
CONFIG_EXPORT void setFeatureId(const std::string& theId);
CONFIG_EXPORT void setAttributeId(const std::string& theId);
+ CONFIG_EXPORT void setFilterParameters(const std::list<std::string>& parameters);
};
#endif /* CONFIG_SELECTIONFILTERMESSAGE_H_ */
std::shared_ptr<Config_ValidatorMessage>
aMessage(new Config_ValidatorMessage(aValidatoEvent, this));
std::string aValidatorId;
- std::list<std::string> aValidatorParameters;
- getValidatorInfo(theNode, aValidatorId, aValidatorParameters);
+ std::list<std::string> aParameters;
+ getParametersInfo(theNode, aValidatorId, aParameters);
aMessage->setValidatorId(aValidatorId);
- aMessage->setValidatorParameters(aValidatorParameters);
+ aMessage->setValidatorParameters(aParameters);
xmlNodePtr aFeatureOrWdgNode = theNode->parent;
if (isNode(aFeatureOrWdgNode, NODE_FEATURE, NULL)) {
aMessage->setFeatureId(getProperty(aFeatureOrWdgNode, _ID));
Events_Loop* aEvLoop = Events_Loop::loop();
std::shared_ptr<Config_SelectionFilterMessage> aMessage =
std::make_shared<Config_SelectionFilterMessage>(aFilterEvent, this);
- std::string aSelectionFilterId = getProperty(theNode, _ID);
+ std::string aSelectionFilterId;
+ std::list<std::string> aParameters;
+ getParametersInfo(theNode, aSelectionFilterId, aParameters);
aMessage->setSelectionFilterId(aSelectionFilterId);
+ aMessage->setFilterParameters(aParameters);
+
xmlNodePtr aFeatureOrWdgNode = theNode->parent;
if (isNode(aFeatureOrWdgNode, NODE_FEATURE, NULL)) {
aMessage->setFeatureId(getProperty(aFeatureOrWdgNode, _ID));
void ModuleBase_FilterFactory::assignFilter(const std::string& theID,
const std::string& theFeatureID,
- const std::string& theAttrID)
+ const std::string& theAttrID,
+ const std::list<std::string>& theArguments)
{
// create feature-structures if not exist
std::map<std::string, std::map<std::string, AttrFilters> >::iterator aFeature = myAttrs.find(
if (anAttr == aFeature->second.end()) {
aFeature->second[theAttrID] = AttrFilters();
}
- aFeature->second[theAttrID][theID] = std::list<std::string>();
+ aFeature->second[theAttrID][theID] = theArguments;
}
void ModuleBase_FilterFactory::filters(const std::string& theFeatureID,
/// Assigns filter to the attribute of the feature
MODULEBASE_EXPORT virtual void assignFilter(const std::string& theID,
const std::string& theFeatureID,
- const std::string& theAttrID);
+ const std::string& theAttrID,
+ const std::list<std::string>& theArguments);
/// Provides a filter for the attribute, returns NULL if no filter
MODULEBASE_EXPORT void filters(const std::string& theFeatureID,
std::dynamic_pointer_cast<Config_SelectionFilterMessage>(theMessage);
if (aMsg) {
ModuleBase_FilterFactory* aFactory = moduleConnector()->selectionFilters();
- if (aMsg->attributeId().empty()) { // feature validator
- //aFactory->assignFilter(aMsg->selectionFilterId(), aMsg->featureId());
- } else { // attribute validator
- aFactory->assignFilter(aMsg->selectionFilterId(), aMsg->featureId(), aMsg->attributeId());
+ if (!aMsg->attributeId().empty()) {
+ aFactory->assignFilter(aMsg->selectionFilterId(), aMsg->featureId(), aMsg->attributeId(),
+ aMsg->parameters());
}
}
}