} else if (myIsProcessWidgets && isWidgetNode(theNode)) {
boost::shared_ptr<Config_AttributeMessage> aMessage(new Config_AttributeMessage(aMenuItemEvent, this));
aMessage->setFeatureId(restoreAttribute(NODE_FEATURE, _ID));
- aMessage->setAttributeId(getProperty(theNode, _ID));
- aMessage->setObligatory(getBooleanAttribute(theNode, ATTRIBUTE_OBLIGATORY, true));
- aMessage->setConcealment(getBooleanAttribute(theNode, ATTRIBUTE_CONCEALMENT, false));
- Events_Loop::loop()->send(aMessage);
+ std::string anAttributeID = getProperty(theNode, _ID);
+ if (!anAttributeID.empty()) {
+ aMessage->setAttributeId(anAttributeID);
+ aMessage->setObligatory(getBooleanAttribute(theNode, ATTRIBUTE_OBLIGATORY, true));
+ aMessage->setConcealment(getBooleanAttribute(theNode, ATTRIBUTE_CONCEALMENT, false));
+ Events_Loop::loop()->send(aMessage);
+ }
}
//Process SOURCE, VALIDATOR nodes.
Config_XMLReader::processNode(theNode);
#include <Events_Loop.h>
#include <Events_Error.h>
#include <Config_FeatureMessage.h>
+#include <Config_AttributeMessage.h>
#include <Config_ValidatorMessage.h>
#include <Config_ModuleReader.h>
if (this != myImpl)
return myImpl->createFeature(theFeatureID);
- LoadPluginsInfo();
if (myPlugins.find(theFeatureID) != myPlugins.end()) {
std::pair<std::string, std::string>& aPlugin = myPlugins[theFeatureID]; // plugin and doc kind
if (!aPlugin.second.empty() && aPlugin.second != activeDocument()->kind()) {
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED), 0, true);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED), 0, true);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_VALIDATOR_LOADED));
+
+ // load all information about plugins, features and attributes
+ LoadPluginsInfo();
}
void Model_Session::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
myPlugins[aMsg->id()] = std::pair<std::string, std::string>(
aMsg->pluginLibrary(), aMsg->documentKind());
}
+ } else {
+ const boost::shared_ptr<Config_AttributeMessage> aMsgAttr =
+ boost::dynamic_pointer_cast<Config_AttributeMessage>(theMessage);
+ if (aMsgAttr) {
+ if (!aMsgAttr->isObligatory()) {
+ validators()->registerNotObligatory(aMsgAttr->featureId(), aMsgAttr->attributeId());
+ }
+ if(aMsgAttr->isConcealment()) {
+ validators()->registerConcealment(aMsgAttr->featureId(), aMsgAttr->attributeId());
+ }
+
+ }
}
// plugins information was started to load, so, it will be loaded
myPluginsInfoLoaded = true;
}
// check all attributes for validity
boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- if (!aData->isValid())
+ if (!aData || !aData->isValid())
return false;
static const std::string kAllTypes = "";
std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeatureIter =